{
  "id": 313959,
  "title": "CUDA out of memory!!",
  "url": "/competitions/ultra-mnist/discussion/313959",
  "author_name": "",
  "post_date": "2022-03-20T01:10:02.049201900Z",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I am getting this error in pytorch.</p>\n<p>RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 15.01 GiB already allocated; 41.75 MiB free; 15.03 GiB reserved in total by PyTorch).</p>\n<p>Please🙏 help me in resolving this issue.</p>",
  "messages": [
    {
      "id": "1729355",
      "postDate": "03/20/2022 01:10:02",
      "content": "<p>I am getting this error in pytorch.</p>\n<p>RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 15.01 GiB already allocated; 41.75 MiB free; 15.03 GiB reserved in total by PyTorch).</p>\n<p>Please🙏 help me in resolving this issue.</p>",
      "rawMarkdown": "I am getting this error in pytorch.\n\nRuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 15.01 GiB already allocated; 41.75 MiB free; 15.03 GiB reserved in total by PyTorch).\n\nPlease🙏 help me in resolving this issue.",
      "votes": null
    },
    {
      "id": "1729543",
      "postDate": "03/20/2022 07:41:52",
      "content": "<p>I guess you are trying to feed the image as it is (4000x4000) which wouldn't fit in GPU memory. Try downscaling it before feeding it to the model.</p>",
      "rawMarkdown": "I guess you are trying to feed the image as it is (4000x4000) which wouldn't fit in GPU memory. Try downscaling it before feeding it to the model.",
      "votes": null
    },
    {
      "id": "1729550",
      "postDate": "03/20/2022 07:46:19",
      "content": "<p>Hello Mohammad,</p>\n<p>Kaggle notebooks only have 16 GB of GPU memory. If you are using a large model, GPU may run out of memory. You can try these tricks:</p>\n<p>1- Try Mixed precision training and inference (complicated but you can find examples on the internet)<br>\n2- Decrease batch size. It might help but should be chosen wisely.<br>\n3- Switch it to a smaller model.<br>\n4- Downsize the images, however, this makes training harder.</p>",
      "rawMarkdown": "Hello Mohammad,\n\nKaggle notebooks only have 16 GB of GPU memory. If you are using a large model, GPU may run out of memory. You can try these tricks:\n\n1- Try Mixed precision training and inference (complicated but you can find examples on the internet)\n2- Decrease batch size. It might help but should be chosen wisely.\n3- Switch it to a smaller model.\n4- Downsize the images, however, this makes training harder.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1729543,
      "author_name": "shankarmahadevan",
      "author_url": "",
      "post_date": "03/20/2022 07:41:52",
      "content": "<p>I guess you are trying to feed the image as it is (4000x4000) which wouldn't fit in GPU memory. Try downscaling it before feeding it to the model.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1729550,
      "author_name": "sarperyurttas",
      "author_url": "",
      "post_date": "03/20/2022 07:46:19",
      "content": "<p>Hello Mohammad,</p>\n<p>Kaggle notebooks only have 16 GB of GPU memory. If you are using a large model, GPU may run out of memory. You can try these tricks:</p>\n<p>1- Try Mixed precision training and inference (complicated but you can find examples on the internet)<br>\n2- Decrease batch size. It might help but should be chosen wisely.<br>\n3- Switch it to a smaller model.<br>\n4- Downsize the images, however, this makes training harder.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1729355": "I am getting this error in pytorch.\n\nRuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 15.01 GiB already allocated; 41.75 MiB free; 15.03 GiB reserved in total by PyTorch).\n\nPlease🙏 help me in resolving this issue.",
    "1729543": "I guess you are trying to feed the image as it is (4000x4000) which wouldn't fit in GPU memory. Try downscaling it before feeding it to the model.",
    "1729550": "Hello Mohammad,\n\nKaggle notebooks only have 16 GB of GPU memory. If you are using a large model, GPU may run out of memory. You can try these tricks:\n\n1- Try Mixed precision training and inference (complicated but you can find examples on the internet)\n2- Decrease batch size. It might help but should be chosen wisely.\n3- Switch it to a smaller model.\n4- Downsize the images, however, this makes training harder."
  },
  "source": "meta"
}