{
  "id": 125486,
  "title": "fast.ai resnet34 not using GPU",
  "url": "/competitions/bengaliai-cv19/discussion/125486",
  "author_name": "",
  "post_date": "2020-01-11T02:16:42.074109600Z",
  "votes": 3,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hi all, </p>\n\n<p>Newbie here. I am trying out the fast.ai resnet34 as a baseline model. Unfortunately, the GPU seems not to be getting used, as here is what my usage looks like when training: </p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3331121%2Fd1c1d65f08e74ddeb757d5dc1d0f36b4%2FScreen%20Shot%202020-01-10%20at%205.56.42%20PM.png?generation=1578708875535230&amp;alt=media\" alt=\"\"></p>\n\n<p>Here is the code I'm using. It's very simple, pretty much pulled directly from fast.ai lesson 1.\n<code>\nlearn = cnn_learner(data, models.resnet34, metrics=error_rate)\n</code>\n<code>\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n</code>\n<code>\nlearn.model.to(device)\n</code></p>\n\n<p>The last 2 lines was a workaround I was trying, it doesn't work without it also.</p>",
  "messages": [
    {
      "id": "715938",
      "postDate": "01/11/2020 02:16:42",
      "content": "<p>Hi all, </p>\n\n<p>Newbie here. I am trying out the fast.ai resnet34 as a baseline model. Unfortunately, the GPU seems not to be getting used, as here is what my usage looks like when training: </p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3331121%2Fd1c1d65f08e74ddeb757d5dc1d0f36b4%2FScreen%20Shot%202020-01-10%20at%205.56.42%20PM.png?generation=1578708875535230&amp;alt=media\" alt=\"\"></p>\n\n<p>Here is the code I'm using. It's very simple, pretty much pulled directly from fast.ai lesson 1.\n<code>\nlearn = cnn_learner(data, models.resnet34, metrics=error_rate)\n</code>\n<code>\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n</code>\n<code>\nlearn.model.to(device)\n</code></p>\n\n<p>The last 2 lines was a workaround I was trying, it doesn't work without it also.</p>",
      "rawMarkdown": "Hi all, \n\nNewbie here. I am trying out the fast.ai resnet34 as a baseline model. Unfortunately, the GPU seems not to be getting used, as here is what my usage looks like when training: \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3331121%2Fd1c1d65f08e74ddeb757d5dc1d0f36b4%2FScreen%20Shot%202020-01-10%20at%205.56.42%20PM.png?generation=1578708875535230&amp;alt=media)\n\nHere is the code I'm using. It's very simple, pretty much pulled directly from fast.ai lesson 1.\n`\nlearn = cnn_learner(data, models.resnet34, metrics=error_rate)\n`\n`\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n`\n`\nlearn.model.to(device)\n`\n\nThe last 2 lines was a workaround I was trying, it doesn't work without it also.",
      "votes": null
    },
    {
      "id": "716126",
      "postDate": "01/11/2020 09:46:44",
      "content": "<p>What is the value you get from torch.cuda.is_available() ?\nI think it's a bug in the Kaggle Kernels. The GPU usage indicator doesn't seem to be working - in my case it's also showing that only CPU is used, although I'm sure that the computation happens on the GPU.</p>\n\n<p>Another way to test this is to turn off GPU in your Kernel. If computations get significantly slower, that indicates that GPU was indeed working before.</p>",
      "rawMarkdown": "What is the value you get from torch.cuda.is_available() ?\nI think it's a bug in the Kaggle Kernels. The GPU usage indicator doesn't seem to be working - in my case it's also showing that only CPU is used, although I'm sure that the computation happens on the GPU.\n\nAnother way to test this is to turn off GPU in your Kernel. If computations get significantly slower, that indicates that GPU was indeed working before.",
      "votes": null
    },
    {
      "id": "716213",
      "postDate": "01/11/2020 12:20:44",
      "content": "<p>Hi Nicolas, you're totally right. The boolean you mentioned returns true, and the computation without takes like 8 hours per epoch. Thanks for the advice!</p>",
      "rawMarkdown": "Hi Nicolas, you're totally right. The boolean you mentioned returns true, and the computation without takes like 8 hours per epoch. Thanks for the advice!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 716126,
      "author_name": "nkaenzig",
      "author_url": "",
      "post_date": "01/11/2020 09:46:44",
      "content": "<p>What is the value you get from torch.cuda.is_available() ?\nI think it's a bug in the Kaggle Kernels. The GPU usage indicator doesn't seem to be working - in my case it's also showing that only CPU is used, although I'm sure that the computation happens on the GPU.</p>\n\n<p>Another way to test this is to turn off GPU in your Kernel. If computations get significantly slower, that indicates that GPU was indeed working before.</p>",
      "votes": null,
      "replies": [
        {
          "id": 716213,
          "author_name": "linainversez",
          "author_url": "",
          "post_date": "01/11/2020 12:20:44",
          "content": "<p>Hi Nicolas, you're totally right. The boolean you mentioned returns true, and the computation without takes like 8 hours per epoch. Thanks for the advice!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "715938": "Hi all, \n\nNewbie here. I am trying out the fast.ai resnet34 as a baseline model. Unfortunately, the GPU seems not to be getting used, as here is what my usage looks like when training: \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3331121%2Fd1c1d65f08e74ddeb757d5dc1d0f36b4%2FScreen%20Shot%202020-01-10%20at%205.56.42%20PM.png?generation=1578708875535230&amp;alt=media)\n\nHere is the code I'm using. It's very simple, pretty much pulled directly from fast.ai lesson 1.\n`\nlearn = cnn_learner(data, models.resnet34, metrics=error_rate)\n`\n`\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n`\n`\nlearn.model.to(device)\n`\n\nThe last 2 lines was a workaround I was trying, it doesn't work without it also.",
    "716126": "What is the value you get from torch.cuda.is_available() ?\nI think it's a bug in the Kaggle Kernels. The GPU usage indicator doesn't seem to be working - in my case it's also showing that only CPU is used, although I'm sure that the computation happens on the GPU.\n\nAnother way to test this is to turn off GPU in your Kernel. If computations get significantly slower, that indicates that GPU was indeed working before.",
    "716213": "Hi Nicolas, you're totally right. The boolean you mentioned returns true, and the computation without takes like 8 hours per epoch. Thanks for the advice!"
  },
  "source": "meta"
}