{
  "id": 298972,
  "title": "Your notebook tried to allocate more memory than is available. It has restarted.",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/298972",
  "author_name": "",
  "post_date": "2022-01-05T16:07:11.901693900Z",
  "votes": null,
  "comment_count": 6,
  "views": 0,
  "content": "<p>This is the most painful yet I've experienced. When I tried to train YOLOv5, my RAM (aka memory) has filled up rapidly, causing the error message saying that \"Your notebook tried to allocate more memory than is available. It has restarted.\" Reducing the batch size works, but I want to keep the batch size to 18 so that my model will detect the COTS accurately. How do I have to keep my memory low while training YOLOv5 with batch size being set to 18 rather than reducing the batch size? (gc didn't work)</p>",
  "messages": [
    {
      "id": "1639418",
      "postDate": "01/05/2022 16:07:11",
      "content": "<p>This is the most painful yet I've experienced. When I tried to train YOLOv5, my RAM (aka memory) has filled up rapidly, causing the error message saying that \"Your notebook tried to allocate more memory than is available. It has restarted.\" Reducing the batch size works, but I want to keep the batch size to 18 so that my model will detect the COTS accurately. How do I have to keep my memory low while training YOLOv5 with batch size being set to 18 rather than reducing the batch size? (gc didn't work)</p>",
      "rawMarkdown": "This is the most painful yet I've experienced. When I tried to train YOLOv5, my RAM (aka memory) has filled up rapidly, causing the error message saying that \"Your notebook tried to allocate more memory than is available. It has restarted.\" Reducing the batch size works, but I want to keep the batch size to 18 so that my model will detect the COTS accurately. How do I have to keep my memory low while training YOLOv5 with batch size being set to 18 rather than reducing the batch size? (gc didn't work)",
      "votes": null
    },
    {
      "id": "1639428",
      "postDate": "01/05/2022 16:14:16",
      "content": "<p>I think you're using <code>--cache</code> it caches the images into memory. If you are training using huge image size to train then memory will get exhausted hence you'll get <strong>OOM</strong></p>",
      "rawMarkdown": "I think you're using `--cache` it caches the images into memory. If you are training using huge image size to train then memory will get exhausted hence you'll get **OOM**",
      "votes": null
    },
    {
      "id": "1639443",
      "postDate": "01/05/2022 16:28:12",
      "content": "<p>There is no <code>--cache</code> in my code.</p>",
      "rawMarkdown": "There is no `--cache` in my code.",
      "votes": null
    },
    {
      "id": "1639447",
      "postDate": "01/05/2022 16:31:18",
      "content": "<p>in that case, I think you are running your code on <strong>CPU</strong> instead of <strong>GPU</strong>. In CPU you'll get the same error. Please check if have turned on <strong>GPU</strong>?</p>",
      "rawMarkdown": "in that case, I think you are running your code on **CPU** instead of **GPU**. In CPU you'll get the same error. Please check if have turned on **GPU**?",
      "votes": null
    },
    {
      "id": "1639451",
      "postDate": "01/05/2022 16:33:57",
      "content": "<p>Uh, but how?</p>",
      "rawMarkdown": "Uh, but how?",
      "votes": null
    },
    {
      "id": "1639466",
      "postDate": "01/05/2022 16:46:20",
      "content": "<p>check the <strong>CPU</strong> or <strong>GPU</strong> drop-down button in the bottom right. You can also check it using <code>!nvidia-smi</code> command in notebook.</p>",
      "rawMarkdown": "check the **CPU** or **GPU** drop-down button in the bottom right. You can also check it using `!nvidia-smi` command in notebook.",
      "votes": null
    },
    {
      "id": "1639931",
      "postDate": "01/06/2022 04:23:10",
      "content": "<p>I have had this too in my projects. Typically you need to go through your code and try to optimize it. There are many things that makes RAM go up like multiprocessing, many objects creation, etc.</p>",
      "rawMarkdown": "I have had this too in my projects. Typically you need to go through your code and try to optimize it. There are many things that makes RAM go up like multiprocessing, many objects creation, etc.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1639428,
      "author_name": "awsaf49",
      "author_url": "",
      "post_date": "01/05/2022 16:14:16",
      "content": "<p>I think you're using <code>--cache</code> it caches the images into memory. If you are training using huge image size to train then memory will get exhausted hence you'll get <strong>OOM</strong></p>",
      "votes": null,
      "replies": [
        {
          "id": 1639443,
          "author_name": "dinowun",
          "author_url": "",
          "post_date": "01/05/2022 16:28:12",
          "content": "<p>There is no <code>--cache</code> in my code.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1639447,
          "author_name": "awsaf49",
          "author_url": "",
          "post_date": "01/05/2022 16:31:18",
          "content": "<p>in that case, I think you are running your code on <strong>CPU</strong> instead of <strong>GPU</strong>. In CPU you'll get the same error. Please check if have turned on <strong>GPU</strong>?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1639451,
          "author_name": "dinowun",
          "author_url": "",
          "post_date": "01/05/2022 16:33:57",
          "content": "<p>Uh, but how?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1639466,
          "author_name": "awsaf49",
          "author_url": "",
          "post_date": "01/05/2022 16:46:20",
          "content": "<p>check the <strong>CPU</strong> or <strong>GPU</strong> drop-down button in the bottom right. You can also check it using <code>!nvidia-smi</code> command in notebook.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1639931,
      "author_name": "maulberto3",
      "author_url": "",
      "post_date": "01/06/2022 04:23:10",
      "content": "<p>I have had this too in my projects. Typically you need to go through your code and try to optimize it. There are many things that makes RAM go up like multiprocessing, many objects creation, etc.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1639418": "This is the most painful yet I've experienced. When I tried to train YOLOv5, my RAM (aka memory) has filled up rapidly, causing the error message saying that \"Your notebook tried to allocate more memory than is available. It has restarted.\" Reducing the batch size works, but I want to keep the batch size to 18 so that my model will detect the COTS accurately. How do I have to keep my memory low while training YOLOv5 with batch size being set to 18 rather than reducing the batch size? (gc didn't work)",
    "1639428": "I think you're using `--cache` it caches the images into memory. If you are training using huge image size to train then memory will get exhausted hence you'll get **OOM**",
    "1639443": "There is no `--cache` in my code.",
    "1639447": "in that case, I think you are running your code on **CPU** instead of **GPU**. In CPU you'll get the same error. Please check if have turned on **GPU**?",
    "1639451": "Uh, but how?",
    "1639466": "check the **CPU** or **GPU** drop-down button in the bottom right. You can also check it using `!nvidia-smi` command in notebook.",
    "1639931": "I have had this too in my projects. Typically you need to go through your code and try to optimize it. There are many things that makes RAM go up like multiprocessing, many objects creation, etc."
  },
  "source": "meta"
}