{
  "id": 126915,
  "title": "Getting Pretrained Model",
  "url": "/competitions/deepfake-detection-challenge/discussion/126915",
  "author_name": "",
  "post_date": "2020-01-21T06:25:03.867962Z",
  "votes": 1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I am trying to use a pretrained resnet34 model, using the code:</p>\n\n<pre><code>     self.model = models.resnet34(pretrained=True)\n</code></pre>\n\n<p>after importing: (from torchvision import  models and torch version 1.3.0)</p>\n\n<p>After the message:\n Downloading: \"<a href=\"https://download.pytorch.org/models/resnet34-333f7ec4.pth\">https://download.pytorch.org/models/resnet34-333f7ec4.pth</a>\" to /root/.cache/torch/checkpoints/resnet34-333f7ec4.pth</p>\n\n<p>It crashes in a long error message terminating with: \nURLError: </p>\n\n<p>I'm not experienced in running kaggle kernels so it's probably a relatively simple thing. Can anyone give me any hints?</p>\n\n<p>Thanks</p>",
  "messages": [
    {
      "id": "724427",
      "postDate": "01/21/2020 06:25:03",
      "content": "<p>I am trying to use a pretrained resnet34 model, using the code:</p>\n\n<pre><code>     self.model = models.resnet34(pretrained=True)\n</code></pre>\n\n<p>after importing: (from torchvision import  models and torch version 1.3.0)</p>\n\n<p>After the message:\n Downloading: \"<a href=\"https://download.pytorch.org/models/resnet34-333f7ec4.pth\">https://download.pytorch.org/models/resnet34-333f7ec4.pth</a>\" to /root/.cache/torch/checkpoints/resnet34-333f7ec4.pth</p>\n\n<p>It crashes in a long error message terminating with: \nURLError: </p>\n\n<p>I'm not experienced in running kaggle kernels so it's probably a relatively simple thing. Can anyone give me any hints?</p>\n\n<p>Thanks</p>",
      "rawMarkdown": "I am trying to use a pretrained resnet34 model, using the code:\n\n         self.model = models.resnet34(pretrained=True)\n\nafter importing: (from torchvision import  models and torch version 1.3.0)\n\nAfter the message:\n Downloading: \"https://download.pytorch.org/models/resnet34-333f7ec4.pth\" to /root/.cache/torch/checkpoints/resnet34-333f7ec4.pth\n\nIt crashes in a long error message terminating with: \nURLError:",
      "votes": null
    },
    {
      "id": "724553",
      "postDate": "01/21/2020 08:37:37",
      "content": "<p>When you specify pretrained=True, it searches for the model and if it doesn't find it it will attempt to download it from the internet. Since your interned is turned off by default inside the kernel it will crash. Two things you can do to prevent it: one is turn on the internet (similar to how you turn on the GPU in kernel) - this is okay for training but will not work for testing (internet is not allowed when you'll submit). The second and safest way is to add the weights of the resnet34 by yourself as an external dataset.</p>",
      "rawMarkdown": "When you specify pretrained=True, it searches for the model and if it doesn't find it it will attempt to download it from the internet. Since your interned is turned off by default inside the kernel it will crash. Two things you can do to prevent it: one is turn on the internet (similar to how you turn on the GPU in kernel) - this is okay for training but will not work for testing (internet is not allowed when you'll submit). The second and safest way is to add the weights of the resnet34 by yourself as an external dataset.",
      "votes": null
    },
    {
      "id": "725371",
      "postDate": "01/22/2020 03:10:58",
      "content": "<p>Thanks, that was the correct answer. I ended up including as an external dataset, where I got the files by looking in my cache on my linux box after running the inference locally.</p>",
      "rawMarkdown": "Thanks, that was the correct answer. I ended up including as an external dataset, where I got the files by looking in my cache on my linux box after running the inference locally.",
      "votes": null
    },
    {
      "id": "725710",
      "postDate": "01/22/2020 12:20:55",
      "content": "<p>Sure, glad it worked out</p>",
      "rawMarkdown": "Sure, glad it worked out",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 724553,
      "author_name": "rafiko1",
      "author_url": "",
      "post_date": "01/21/2020 08:37:37",
      "content": "<p>When you specify pretrained=True, it searches for the model and if it doesn't find it it will attempt to download it from the internet. Since your interned is turned off by default inside the kernel it will crash. Two things you can do to prevent it: one is turn on the internet (similar to how you turn on the GPU in kernel) - this is okay for training but will not work for testing (internet is not allowed when you'll submit). The second and safest way is to add the weights of the resnet34 by yourself as an external dataset.</p>",
      "votes": null,
      "replies": [
        {
          "id": 725371,
          "author_name": "petewills",
          "author_url": "",
          "post_date": "01/22/2020 03:10:58",
          "content": "<p>Thanks, that was the correct answer. I ended up including as an external dataset, where I got the files by looking in my cache on my linux box after running the inference locally.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 725710,
          "author_name": "rafiko1",
          "author_url": "",
          "post_date": "01/22/2020 12:20:55",
          "content": "<p>Sure, glad it worked out</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "724427": "I am trying to use a pretrained resnet34 model, using the code:\n\n         self.model = models.resnet34(pretrained=True)\n\nafter importing: (from torchvision import  models and torch version 1.3.0)\n\nAfter the message:\n Downloading: \"https://download.pytorch.org/models/resnet34-333f7ec4.pth\" to /root/.cache/torch/checkpoints/resnet34-333f7ec4.pth\n\nIt crashes in a long error message terminating with: \nURLError:",
    "724553": "When you specify pretrained=True, it searches for the model and if it doesn't find it it will attempt to download it from the internet. Since your interned is turned off by default inside the kernel it will crash. Two things you can do to prevent it: one is turn on the internet (similar to how you turn on the GPU in kernel) - this is okay for training but will not work for testing (internet is not allowed when you'll submit). The second and safest way is to add the weights of the resnet34 by yourself as an external dataset.",
    "725371": "Thanks, that was the correct answer. I ended up including as an external dataset, where I got the files by looking in my cache on my linux box after running the inference locally.",
    "725710": "Sure, glad it worked out"
  },
  "source": "meta"
}