{
  "id": 211665,
  "title": "Is there a way to reduce the amount of time required for submit the results? ",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/211665",
  "author_name": "",
  "post_date": "2021-01-16T03:26:30.642911800Z",
  "votes": 2,
  "comment_count": 8,
  "views": 0,
  "content": "<h2><strong>HELP</strong></h2>\n<p>I have two 2 models eff04 and resnex50 every model inference with TTA takes more than 4 hours to submit it with gpu.</p>\n<p>And when I try to blend them it's give me \"<strong>TIME ERROR</strong>\"</p>\n<p><strong>Is there a way to reduce the amount of time required for submitting the results?</strong></p>",
  "messages": [
    {
      "id": "1154916",
      "postDate": "01/16/2021 03:26:30",
      "content": "<h2><strong>HELP</strong></h2>\n<p>I have two 2 models eff04 and resnex50 every model inference with TTA takes more than 4 hours to submit it with gpu.</p>\n<p>And when I try to blend them it's give me \"<strong>TIME ERROR</strong>\"</p>\n<p><strong>Is there a way to reduce the amount of time required for submitting the results?</strong></p>",
      "rawMarkdown": "## **HELP**\n\nI have two 2 models eff04 and resnex50 every model inference with TTA takes more than 4 hours to submit it with gpu.\n\nAnd when I try to blend them it's give me \"**TIME ERROR**\"\n\n**Is there a way to reduce the amount of time required for submitting the results?**",
      "votes": null
    },
    {
      "id": "1155161",
      "postDate": "01/16/2021 08:46:05",
      "content": "<p>Some ideas:</p>\n<ul>\n<li>Reduce TTA augmentations amount </li>\n<li>Reduce image size</li>\n<li>Reduce architecture complexity </li>\n</ul>",
      "rawMarkdown": "Some ideas:\n- Reduce TTA augmentations amount \n- Reduce image size\n- Reduce architecture complexity",
      "votes": null
    },
    {
      "id": "1155627",
      "postDate": "01/16/2021 14:12:49",
      "content": "<p>2 models are less, it shouldn't take that much of time, its definitely TTA steps(or some error in code?) consuming the time, try reducing number of TTA steps(3 should be optimal), reduce some Augs(might not make a difference if you have less), check your code.</p>",
      "rawMarkdown": "2 models are less, it shouldn't take that much of time, its definitely TTA steps(or some error in code?) consuming the time, try reducing number of TTA steps(3 should be optimal), reduce some Augs(might not make a difference if you have less), check your code.",
      "votes": null
    },
    {
      "id": "1155637",
      "postDate": "01/16/2021 14:23:51",
      "content": "<p>How much time should it takes in normal? </p>",
      "rawMarkdown": "How much time should it takes in normal?",
      "votes": null
    },
    {
      "id": "1155638",
      "postDate": "01/16/2021 14:25:18",
      "content": "<p>Good ideas, <br>\nBut I think It will affect the LB badly. </p>",
      "rawMarkdown": "Good ideas, \nBut I think It will affect the LB badly.",
      "votes": null
    },
    {
      "id": "1158194",
      "postDate": "01/18/2021 12:44:52",
      "content": "<p>Probably, the code you wrote that loops over the datasets multiple times is slow and can be improved. How does your TTA loop look like?</p>\n<p>The below pseudocode example does the test predictions in batches. This is pretty fast. Before that, for example, my submission TTA script was actually doing one image at a time and this took at least 10x as long.</p>\n<pre><code>BATCH_SIZE = 32\nREPETITIONS = 5\npredictions = zeros_tensor(size=(NUM_SAMPLES, NUM_CLASSES))\n\nfor _ in range(REPETITIONS):\n   for i, (batch, labels) in enumerate(dataloader):\n\n      probabilities = model(batch)   # size is (BATCH_SIZE, NUM_CLASSES)\n      predictions[i*BATCH_SIZE:i*BATCH_SIZE+ BATCH_SIZE] += probabilities\n\npredictions = predictions / REPETITIONS\nreturn predictions\n</code></pre>",
      "rawMarkdown": "Probably, the code you wrote that loops over the datasets multiple times is slow and can be improved. How does your TTA loop look like?\n\nThe below pseudocode example does the test predictions in batches. This is pretty fast. Before that, for example, my submission TTA script was actually doing one image at a time and this took at least 10x as long.\n```\nBATCH_SIZE = 32\nREPETITIONS = 5\npredictions = zeros_tensor(size=(NUM_SAMPLES, NUM_CLASSES))\n\nfor _ in range(REPETITIONS):\n   for i, (batch, labels) in enumerate(dataloader):\n      \n      probabilities = model(batch)   # size is (BATCH_SIZE, NUM_CLASSES)\n      predictions[i*BATCH_SIZE:i*BATCH_SIZE+ BATCH_SIZE] += probabilities\n\npredictions = predictions / REPETITIONS\nreturn predictions\n```",
      "votes": null
    },
    {
      "id": "1159005",
      "postDate": "01/19/2021 00:59:39",
      "content": "<p>Mine takes around 45 minutes - 1 hour. This is with 4 TTA runs of flip, zoom, and contrast.</p>\n<p>Edit: How long does yours take?</p>",
      "rawMarkdown": "Mine takes around 45 minutes - 1 hour. This is with 4 TTA runs of flip, zoom, and contrast.\n\nEdit: How long does yours take?",
      "votes": null
    },
    {
      "id": "1163795",
      "postDate": "01/22/2021 00:05:26",
      "content": "<p>it takes more than 4 hours to \"<strong>LB submition\"</strong> as i mentioned before, so i thought it a very long time</p>",
      "rawMarkdown": "it takes more than 4 hours to \"**LB submition\"** as i mentioned before, so i thought it a very long time",
      "votes": null
    },
    {
      "id": "1163797",
      "postDate": "01/22/2021 00:09:08",
      "content": "<p><a href=\"https://www.kaggle.com/raivokoot\" target=\"_blank\">@raivokoot</a> Thanks for your time.</p>\n<p>i use a public kernel to submit my results \"https://www.kaggle.com/shubham108/cassava-ensemble-efnetb3-resnet50\" </p>\n<p>I will try yours and back to with the time results </p>",
      "rawMarkdown": "raivokoot Thanks for your time.\n\ni use a public kernel to submit my results \"https://www.kaggle.com/shubham108/cassava-ensemble-efnetb3-resnet50\" \n\nI will try yours and back to with the time results",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1155161,
      "author_name": "volcanoflash",
      "author_url": "",
      "post_date": "01/16/2021 08:46:05",
      "content": "<p>Some ideas:</p>\n<ul>\n<li>Reduce TTA augmentations amount </li>\n<li>Reduce image size</li>\n<li>Reduce architecture complexity </li>\n</ul>",
      "votes": null,
      "replies": [
        {
          "id": 1155638,
          "author_name": "elcaiseri",
          "author_url": "",
          "post_date": "01/16/2021 14:25:18",
          "content": "<p>Good ideas, <br>\nBut I think It will affect the LB badly. </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1155627,
      "author_name": "anku5hk",
      "author_url": "",
      "post_date": "01/16/2021 14:12:49",
      "content": "<p>2 models are less, it shouldn't take that much of time, its definitely TTA steps(or some error in code?) consuming the time, try reducing number of TTA steps(3 should be optimal), reduce some Augs(might not make a difference if you have less), check your code.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1155637,
          "author_name": "elcaiseri",
          "author_url": "",
          "post_date": "01/16/2021 14:23:51",
          "content": "<p>How much time should it takes in normal? </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1159005,
          "author_name": "jasondolorso",
          "author_url": "",
          "post_date": "01/19/2021 00:59:39",
          "content": "<p>Mine takes around 45 minutes - 1 hour. This is with 4 TTA runs of flip, zoom, and contrast.</p>\n<p>Edit: How long does yours take?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1163795,
          "author_name": "elcaiseri",
          "author_url": "",
          "post_date": "01/22/2021 00:05:26",
          "content": "<p>it takes more than 4 hours to \"<strong>LB submition\"</strong> as i mentioned before, so i thought it a very long time</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1158194,
      "author_name": "raivokoot",
      "author_url": "",
      "post_date": "01/18/2021 12:44:52",
      "content": "<p>Probably, the code you wrote that loops over the datasets multiple times is slow and can be improved. How does your TTA loop look like?</p>\n<p>The below pseudocode example does the test predictions in batches. This is pretty fast. Before that, for example, my submission TTA script was actually doing one image at a time and this took at least 10x as long.</p>\n<pre><code>BATCH_SIZE = 32\nREPETITIONS = 5\npredictions = zeros_tensor(size=(NUM_SAMPLES, NUM_CLASSES))\n\nfor _ in range(REPETITIONS):\n   for i, (batch, labels) in enumerate(dataloader):\n\n      probabilities = model(batch)   # size is (BATCH_SIZE, NUM_CLASSES)\n      predictions[i*BATCH_SIZE:i*BATCH_SIZE+ BATCH_SIZE] += probabilities\n\npredictions = predictions / REPETITIONS\nreturn predictions\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 1163797,
          "author_name": "elcaiseri",
          "author_url": "",
          "post_date": "01/22/2021 00:09:08",
          "content": "<p><a href=\"https://www.kaggle.com/raivokoot\" target=\"_blank\">@raivokoot</a> Thanks for your time.</p>\n<p>i use a public kernel to submit my results \"https://www.kaggle.com/shubham108/cassava-ensemble-efnetb3-resnet50\" </p>\n<p>I will try yours and back to with the time results </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1154916": "## **HELP**\n\nI have two 2 models eff04 and resnex50 every model inference with TTA takes more than 4 hours to submit it with gpu.\n\nAnd when I try to blend them it's give me \"**TIME ERROR**\"\n\n**Is there a way to reduce the amount of time required for submitting the results?**",
    "1155161": "Some ideas:\n- Reduce TTA augmentations amount \n- Reduce image size\n- Reduce architecture complexity",
    "1155627": "2 models are less, it shouldn't take that much of time, its definitely TTA steps(or some error in code?) consuming the time, try reducing number of TTA steps(3 should be optimal), reduce some Augs(might not make a difference if you have less), check your code.",
    "1155637": "How much time should it takes in normal?",
    "1155638": "Good ideas, \nBut I think It will affect the LB badly.",
    "1158194": "Probably, the code you wrote that loops over the datasets multiple times is slow and can be improved. How does your TTA loop look like?\n\nThe below pseudocode example does the test predictions in batches. This is pretty fast. Before that, for example, my submission TTA script was actually doing one image at a time and this took at least 10x as long.\n```\nBATCH_SIZE = 32\nREPETITIONS = 5\npredictions = zeros_tensor(size=(NUM_SAMPLES, NUM_CLASSES))\n\nfor _ in range(REPETITIONS):\n   for i, (batch, labels) in enumerate(dataloader):\n      \n      probabilities = model(batch)   # size is (BATCH_SIZE, NUM_CLASSES)\n      predictions[i*BATCH_SIZE:i*BATCH_SIZE+ BATCH_SIZE] += probabilities\n\npredictions = predictions / REPETITIONS\nreturn predictions\n```",
    "1159005": "Mine takes around 45 minutes - 1 hour. This is with 4 TTA runs of flip, zoom, and contrast.\n\nEdit: How long does yours take?",
    "1163795": "it takes more than 4 hours to \"**LB submition\"** as i mentioned before, so i thought it a very long time",
    "1163797": "raivokoot Thanks for your time.\n\ni use a public kernel to submit my results \"https://www.kaggle.com/shubham108/cassava-ensemble-efnetb3-resnet50\" \n\nI will try yours and back to with the time results"
  },
  "source": "meta"
}