{
  "id": 340518,
  "title": "How to solve this error \"CUDA out of memory\"?",
  "url": "/competitions/goodreads-books-reviews-290312/discussion/340518",
  "author_name": "Nandita Bhattacharya",
  "post_date": "2022-07-29T13:48:26.371000",
  "votes": 0,
  "comment_count": 0,
  "views": 0,
  "content": "<p>hi,<br>\nI am getting the following error while training \"bert-base-multilingual-cased\" model:</p>\n<p>\"CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 460.17 MiB already allocated; 25.75 MiB free; 474.00 MiB reserved in total by PyTorch) If reserved memory is &gt;&gt; allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF\"</p>\n<p>I tried reducing batch_size from 32 to 8, but that also did not help.</p>\n<p>Please suggest any possible workaround. Thanks in advance!</p>",
  "messages": [
    {
      "id": 1875988,
      "postDate": "2022-07-29T13:48:26.373Z",
      "content": "<p>hi,<br>\nI am getting the following error while training \"bert-base-multilingual-cased\" model:</p>\n<p>\"CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 460.17 MiB already allocated; 25.75 MiB free; 474.00 MiB reserved in total by PyTorch) If reserved memory is &gt;&gt; allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF\"</p>\n<p>I tried reducing batch_size from 32 to 8, but that also did not help.</p>\n<p>Please suggest any possible workaround. Thanks in advance!</p>",
      "rawMarkdown": "hi,\nI am getting the following error while training \"bert-base-multilingual-cased\" model:\n\n\"CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 460.17 MiB already allocated; 25.75 MiB free; 474.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF\"\n\nI tried reducing batch_size from 32 to 8, but that also did not help.\n\nPlease suggest any possible workaround. Thanks in advance!"
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "1875988": "hi,\nI am getting the following error while training \"bert-base-multilingual-cased\" model:\n\n\"CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 15.90 GiB total capacity; 460.17 MiB already allocated; 25.75 MiB free; 474.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF\"\n\nI tried reducing batch_size from 32 to 8, but that also did not help.\n\nPlease suggest any possible workaround. Thanks in advance!"
  }
}