{
  "id": 107307,
  "title": "Please help me!RuntimeError: CUDA out of memory",
  "url": "/competitions/aptos2019-blindness-detection/discussion/107307",
  "author_name": "",
  "post_date": "2019-09-03T16:10:57.600144Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>When I run the kernel ,an error occurred,\"RuntimeError: CUDA out of memory. Tried to allocate 288.00 MiB (GPU 0; 15.90 GiB total capacity; 820.80 MiB already allocated; 275.88 MiB free; 273.20 MiB cached)\" .What should I do to solve this error?\nWill it be because of the version of pytorch?I ran this kernel and install the pytorch1.1.0.(<a href=\"https://www.kaggle.com/chanhu/eye-efficientnet-pytorch-lb-0-777).Then\">https://www.kaggle.com/chanhu/eye-efficientnet-pytorch-lb-0-777).Then</a> when I ran a kernel that was improved from the kernel（<a href=\"https://www.kaggle.com/ahoukang/aptos-vote\">https://www.kaggle.com/ahoukang/aptos-vote</a>）,the error occurred.</p>",
  "messages": [
    {
      "id": "616952",
      "postDate": "09/03/2019 16:10:57",
      "content": "<p>When I run the kernel ,an error occurred,\"RuntimeError: CUDA out of memory. Tried to allocate 288.00 MiB (GPU 0; 15.90 GiB total capacity; 820.80 MiB already allocated; 275.88 MiB free; 273.20 MiB cached)\" .What should I do to solve this error?\nWill it be because of the version of pytorch?I ran this kernel and install the pytorch1.1.0.(<a href=\"https://www.kaggle.com/chanhu/eye-efficientnet-pytorch-lb-0-777).Then\">https://www.kaggle.com/chanhu/eye-efficientnet-pytorch-lb-0-777).Then</a> when I ran a kernel that was improved from the kernel（<a href=\"https://www.kaggle.com/ahoukang/aptos-vote\">https://www.kaggle.com/ahoukang/aptos-vote</a>）,the error occurred.</p>",
      "rawMarkdown": "When I run the kernel ,an error occurred,\"RuntimeError: CUDA out of memory. Tried to allocate 288.00 MiB (GPU 0; 15.90 GiB total capacity; 820.80 MiB already allocated; 275.88 MiB free; 273.20 MiB cached)\" .What should I do to solve this error?\nWill it be because of the version of pytorch?I ran this kernel and install the pytorch1.1.0.(https://www.kaggle.com/chanhu/eye-efficientnet-pytorch-lb-0-777).Then when I ran a kernel that was improved from the kernel（https://www.kaggle.com/ahoukang/aptos-vote）,the error occurred.",
      "votes": null
    },
    {
      "id": "616960",
      "postDate": "09/03/2019 16:18:48",
      "content": "<p>Try reducing batch size. </p>",
      "rawMarkdown": "Try reducing batch size.",
      "votes": null
    },
    {
      "id": "617435",
      "postDate": "09/04/2019 05:59:56",
      "content": "<p>I had similar problem. I reduced the batch size to around 16. The error still persist. I also tried to clear VRAM. this are list of this I tried out and none worked.</p>\n\n<p><strong>keras.backend.clear_session()</strong></p>\n\n<p><strong>torch.cuda.empty_cache()</strong> </p>\n\n<p><strong>from numba import cuda</strong>\n**cuda.select_device(0)**\n<strong>cuda.close()</strong></p>\n\n<p>The latter seems to work at first, then this haapened <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1301835%2F4f3461d98183ceb5e8894c10714a5550%2FUntitled.png?generation=1567576268840301&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "I had similar problem. I reduced the batch size to around 16. The error still persist. I also tried to clear VRAM. this are list of this I tried out and none worked.\n\n**keras.backend.clear_session()**\n\n**torch.cuda.empty_cache()** \n\n**from numba import cuda**\n**cuda.select_device(0)**\n**cuda.close()**\n\nThe latter seems to work at first, then this haapened ![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1301835%2F4f3461d98183ceb5e8894c10714a5550%2FUntitled.png?generation=1567576268840301&amp;alt=media)",
      "votes": null
    },
    {
      "id": "617771",
      "postDate": "09/04/2019 13:09:58",
      "content": "<p>Thank you very much！I reduced the batch size,and  error has been solved now.I submitted my kernel and successfully scored. Does it mean that my kernel is also successfully running on the private dataset? and meet the runtime limit?</p>",
      "rawMarkdown": "Thank you very much！I reduced the batch size,and  error has been solved now.I submitted my kernel and successfully scored. Does it mean that my kernel is also successfully running on the private dataset? and meet the runtime limit?",
      "votes": null
    },
    {
      "id": "617772",
      "postDate": "09/04/2019 13:11:06",
      "content": "<p>Yes, it does</p>",
      "rawMarkdown": "Yes, it does",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 616960,
      "author_name": "drhabib",
      "author_url": "",
      "post_date": "09/03/2019 16:18:48",
      "content": "<p>Try reducing batch size. </p>",
      "votes": null,
      "replies": [
        {
          "id": 617771,
          "author_name": "aiyl2020",
          "author_url": "",
          "post_date": "09/04/2019 13:09:58",
          "content": "<p>Thank you very much！I reduced the batch size,and  error has been solved now.I submitted my kernel and successfully scored. Does it mean that my kernel is also successfully running on the private dataset? and meet the runtime limit?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 617772,
          "author_name": "kvlmll",
          "author_url": "",
          "post_date": "09/04/2019 13:11:06",
          "content": "<p>Yes, it does</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 617435,
      "author_name": "filemide",
      "author_url": "",
      "post_date": "09/04/2019 05:59:56",
      "content": "<p>I had similar problem. I reduced the batch size to around 16. The error still persist. I also tried to clear VRAM. this are list of this I tried out and none worked.</p>\n\n<p><strong>keras.backend.clear_session()</strong></p>\n\n<p><strong>torch.cuda.empty_cache()</strong> </p>\n\n<p><strong>from numba import cuda</strong>\n**cuda.select_device(0)**\n<strong>cuda.close()</strong></p>\n\n<p>The latter seems to work at first, then this haapened <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1301835%2F4f3461d98183ceb5e8894c10714a5550%2FUntitled.png?generation=1567576268840301&amp;alt=media\" alt=\"\"></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "616952": "When I run the kernel ,an error occurred,\"RuntimeError: CUDA out of memory. Tried to allocate 288.00 MiB (GPU 0; 15.90 GiB total capacity; 820.80 MiB already allocated; 275.88 MiB free; 273.20 MiB cached)\" .What should I do to solve this error?\nWill it be because of the version of pytorch?I ran this kernel and install the pytorch1.1.0.(https://www.kaggle.com/chanhu/eye-efficientnet-pytorch-lb-0-777).Then when I ran a kernel that was improved from the kernel（https://www.kaggle.com/ahoukang/aptos-vote）,the error occurred.",
    "616960": "Try reducing batch size.",
    "617435": "I had similar problem. I reduced the batch size to around 16. The error still persist. I also tried to clear VRAM. this are list of this I tried out and none worked.\n\n**keras.backend.clear_session()**\n\n**torch.cuda.empty_cache()** \n\n**from numba import cuda**\n**cuda.select_device(0)**\n**cuda.close()**\n\nThe latter seems to work at first, then this haapened ![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1301835%2F4f3461d98183ceb5e8894c10714a5550%2FUntitled.png?generation=1567576268840301&amp;alt=media)",
    "617771": "Thank you very much！I reduced the batch size,and  error has been solved now.I submitted my kernel and successfully scored. Does it mean that my kernel is also successfully running on the private dataset? and meet the runtime limit?",
    "617772": "Yes, it does"
  },
  "source": "meta"
}