{
  "id": 293175,
  "title": "Cuda out of Memory",
  "url": "/competitions/sartorius-cell-instance-segmentation/discussion/293175",
  "author_name": "Pitsillos",
  "post_date": "2021-12-04T19:23:05.573000",
  "votes": 5,
  "comment_count": 5,
  "views": 0,
  "content": "<p>I know this is a self explained error but I always have this problem no matter what I change.  This is the notebook that causes this <a href=\"https://www.kaggle.com/npitsillos/mask-rcnn-w-resnetv2-50-train/notebook?scriptVersionId=81543743\" target=\"_blank\">https://www.kaggle.com/npitsillos/mask-rcnn-w-resnetv2-50-train/notebook?scriptVersionId=81543743</a>.  What is odd is that the batch size is 2 images of size 224x224 with the only transform being normalise since I believe albumentations was causing this initially. I have removed it and I still get this though.</p>\n<p>Any thoughts? Am I missing something straightforward here?</p>",
  "messages": [
    {
      "id": 1606003,
      "postDate": "2021-12-04T19:23:05.573Z",
      "content": "<p>I know this is a self explained error but I always have this problem no matter what I change.  This is the notebook that causes this <a href=\"https://www.kaggle.com/npitsillos/mask-rcnn-w-resnetv2-50-train/notebook?scriptVersionId=81543743\" target=\"_blank\">https://www.kaggle.com/npitsillos/mask-rcnn-w-resnetv2-50-train/notebook?scriptVersionId=81543743</a>.  What is odd is that the batch size is 2 images of size 224x224 with the only transform being normalise since I believe albumentations was causing this initially. I have removed it and I still get this though.</p>\n<p>Any thoughts? Am I missing something straightforward here?</p>",
      "rawMarkdown": "I know this is a self explained error but I always have this problem no matter what I change.  This is the notebook that causes this https://www.kaggle.com/npitsillos/mask-rcnn-w-resnetv2-50-train/notebook?scriptVersionId=81543743.  What is odd is that the batch size is 2 images of size 224x224 with the only transform being normalise since I believe albumentations was causing this initially. I have removed it and I still get this though.\n\nAny thoughts? Am I missing something straightforward here?",
      "votes": 5
    },
    {
      "id": 1610888,
      "postDate": "2021-12-07T15:24:12.710Z",
      "content": "<p><a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894\" target=\"_blank\">solution</a></p>",
      "rawMarkdown": "[solution](https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894)",
      "votes": 1,
      "replies": [
        {
          "id": 1611027,
          "postDate": "2021-12-07T17:05:18.983Z",
          "content": "<p>Thank you!</p>",
          "rawMarkdown": "Thank you!"
        }
      ]
    },
    {
      "id": 1606865,
      "postDate": "2021-12-05T10:44:43.083Z",
      "content": "<p>Try to add the following in the beginning of the notebook:</p>\n<pre><code>import os\nos.environ[\"PYTORCH_NO_CUDA_MEMORY_CACHING\"] = str(1)\n</code></pre>\n<p>it is not going to help if you need a lot of memory, but if you need just a little bit more then it may help by adding a small room by disabling a cache (it is likely to slow down your notebook as well, unfortunately. Slow is better than \"out of memory\" though).</p>",
      "rawMarkdown": "Try to add the following in the beginning of the notebook:\n\n```Python\nimport os\nos.environ[\"PYTORCH_NO_CUDA_MEMORY_CACHING\"] = str(1)\n```\nit is not going to help if you need a lot of memory, but if you need just a little bit more then it may help by adding a small room by disabling a cache (it is likely to slow down your notebook as well, unfortunately. Slow is better than \"out of memory\" though).",
      "votes": 1,
      "replies": [
        {
          "id": 1606968,
          "postDate": "2021-12-05T12:38:46.740Z",
          "content": "<p>Thank you for your comment! I will try this and see however using a batch size of 2 with image size reduced should do the job. I am starting to think this is the model itself or a problem with pytorch.</p>\n<p><a href=\"https://github.com/pytorch/pytorch/issues/16417\" target=\"_blank\">https://github.com/pytorch/pytorch/issues/16417</a></p>",
          "rawMarkdown": "Thank you for your comment! I will try this and see however using a batch size of 2 with image size reduced should do the job. I am starting to think this is the model itself or a problem with pytorch.\n\nhttps://github.com/pytorch/pytorch/issues/16417"
        }
      ]
    },
    {
      "id": 1606966,
      "postDate": "2021-12-05T12:38:05.253Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1610888,
      "author_name": "Hannah B",
      "author_url": "",
      "post_date": "2021-12-07T15:24:12.710000",
      "content": "<p><a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894\" target=\"_blank\">solution</a></p>",
      "votes": 1,
      "replies": [
        {
          "id": 1611027,
          "author_name": "Pitsillos",
          "author_url": "",
          "post_date": "2021-12-07T17:05:18.983000",
          "content": "<p>Thank you!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1606865,
      "author_name": "Sentinel-1",
      "author_url": "",
      "post_date": "2021-12-05T10:44:43.083000",
      "content": "<p>Try to add the following in the beginning of the notebook:</p>\n<pre><code>import os\nos.environ[\"PYTORCH_NO_CUDA_MEMORY_CACHING\"] = str(1)\n</code></pre>\n<p>it is not going to help if you need a lot of memory, but if you need just a little bit more then it may help by adding a small room by disabling a cache (it is likely to slow down your notebook as well, unfortunately. Slow is better than \"out of memory\" though).</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1606968,
          "author_name": "Pitsillos",
          "author_url": "",
          "post_date": "2021-12-05T12:38:46.740000",
          "content": "<p>Thank you for your comment! I will try this and see however using a batch size of 2 with image size reduced should do the job. I am starting to think this is the model itself or a problem with pytorch.</p>\n<p><a href=\"https://github.com/pytorch/pytorch/issues/16417\" target=\"_blank\">https://github.com/pytorch/pytorch/issues/16417</a></p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1606966,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-12-05T12:38:05.253000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1606003": "I know this is a self explained error but I always have this problem no matter what I change.  This is the notebook that causes this https://www.kaggle.com/npitsillos/mask-rcnn-w-resnetv2-50-train/notebook?scriptVersionId=81543743.  What is odd is that the batch size is 2 images of size 224x224 with the only transform being normalise since I believe albumentations was causing this initially. I have removed it and I still get this though.\n\nAny thoughts? Am I missing something straightforward here?",
    "1610888": "[solution](https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/293894)",
    "1606865": "Try to add the following in the beginning of the notebook:\n\n```Python\nimport os\nos.environ[\"PYTORCH_NO_CUDA_MEMORY_CACHING\"] = str(1)\n```\nit is not going to help if you need a lot of memory, but if you need just a little bit more then it may help by adding a small room by disabling a cache (it is likely to slow down your notebook as well, unfortunately. Slow is better than \"out of memory\" though).",
    "1606966": ""
  }
}