{
  "id": 390262,
  "title": "How do I use pretrained weights when the notebook doesn't allow internet?",
  "url": "/competitions/nfl-player-contact-detection/discussion/390262",
  "author_name": "",
  "post_date": "2023-02-24T20:09:11.325902600Z",
  "votes": null,
  "comment_count": 1,
  "views": 0,
  "content": "<p>As per the title, how do I use pretrained weights when the notebook doesn't allow internet?</p>\n<p>I have tried the following, none of which works</p>\n<ol>\n<li><p>I use the create new dataset button in an attempt to upload my timm pretrained weights (that is already downloaded into my pc). But the download gets stuck with no progress forever. On this I have also switched to multiple wifis, all of them are stuck :/ (image attached) <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F3c5dc7964487b15d7b5a3868dc6fa410%2Fkaggle_stuck.png?generation=1677269032181656&amp;alt=media\" alt=\"\"></p></li>\n<li><p>I tried adding the dataset via the external URL option instead, the link is <a href=\"https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth\" target=\"_blank\">https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth</a> which I confirm that it does point to the correct model url, but kaggle complains that it's not (image attached) <br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F8eeb706fdc7ca849cde9c6a8b673184a%2Fkaggle_fail.png?generation=1677269156706964&amp;alt=media\" alt=\"\"></p></li>\n<li><p>I made sure I didn't do something dumb by trying to call <code>python\ntimm.create_model(\"efficientnet_b4\", pretrained=True, num_classes=1, in_chans=3)</code> As expected, the code stuck and after a while fails due to no internet.</p></li>\n</ol>\n<p>I'm new to kaggle so there's probably a good way around this that I didn't know. I don't want to use public dataset with pretrained models either because they are different to what timm offers.</p>\n<p>Thank you</p>",
  "messages": [
    {
      "id": "2158387",
      "postDate": "02/24/2023 20:09:11",
      "content": "<p>As per the title, how do I use pretrained weights when the notebook doesn't allow internet?</p>\n<p>I have tried the following, none of which works</p>\n<ol>\n<li><p>I use the create new dataset button in an attempt to upload my timm pretrained weights (that is already downloaded into my pc). But the download gets stuck with no progress forever. On this I have also switched to multiple wifis, all of them are stuck :/ (image attached) <img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F3c5dc7964487b15d7b5a3868dc6fa410%2Fkaggle_stuck.png?generation=1677269032181656&amp;alt=media\" alt=\"\"></p></li>\n<li><p>I tried adding the dataset via the external URL option instead, the link is <a href=\"https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth\" target=\"_blank\">https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth</a> which I confirm that it does point to the correct model url, but kaggle complains that it's not (image attached) <br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F8eeb706fdc7ca849cde9c6a8b673184a%2Fkaggle_fail.png?generation=1677269156706964&amp;alt=media\" alt=\"\"></p></li>\n<li><p>I made sure I didn't do something dumb by trying to call <code>python\ntimm.create_model(\"efficientnet_b4\", pretrained=True, num_classes=1, in_chans=3)</code> As expected, the code stuck and after a while fails due to no internet.</p></li>\n</ol>\n<p>I'm new to kaggle so there's probably a good way around this that I didn't know. I don't want to use public dataset with pretrained models either because they are different to what timm offers.</p>\n<p>Thank you</p>",
      "rawMarkdown": "As per the title, how do I use pretrained weights when the notebook doesn't allow internet?\n\nI have tried the following, none of which works\n\n1. I use the create new dataset button in an attempt to upload my timm pretrained weights (that is already downloaded into my pc). But the download gets stuck with no progress forever. On this I have also switched to multiple wifis, all of them are stuck :/ (image attached) ![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F3c5dc7964487b15d7b5a3868dc6fa410%2Fkaggle_stuck.png?generation=1677269032181656&alt=media)\n\n2. I tried adding the dataset via the external URL option instead, the link is https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth which I confirm that it does point to the correct model url, but kaggle complains that it's not (image attached) \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F8eeb706fdc7ca849cde9c6a8b673184a%2Fkaggle_fail.png?generation=1677269156706964&alt=media)\n\n3. I made sure I didn't do something dumb by trying to call ```python\ntimm.create_model(\"efficientnet_b4\", pretrained=True, num_classes=1, in_chans=3)``` As expected, the code stuck and after a while fails due to no internet.\n\nI'm new to kaggle so there's probably a good way around this that I didn't know. I don't want to use public dataset with pretrained models either because they are different to what timm offers.\n\nThank you",
      "votes": null
    },
    {
      "id": "2158391",
      "postDate": "02/24/2023 20:14:44",
      "content": "<p>Just tried a couple more stuffs, found 3 solutions on this :D</p>\n<ol>\n<li>For efficient net, use the public dataset \"timm-pretrained-efficientnet\", they have the exact same weight</li>\n<li>For resnet50, use the public dataset \"Pretrained ResNet Models from PIM\"</li>\n<li>Otherwise to upload local files, don't drag the file to the box, but click the button and navigate to the file instead. Somehow it doesn't get stuck that way</li>\n</ol>",
      "rawMarkdown": "Just tried a couple more stuffs, found 3 solutions on this :D\n\n1. For efficient net, use the public dataset \"timm-pretrained-efficientnet\", they have the exact same weight\n2. For resnet50, use the public dataset \"Pretrained ResNet Models from PIM\"\n3. Otherwise to upload local files, don't drag the file to the box, but click the button and navigate to the file instead. Somehow it doesn't get stuck that way",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2158391,
      "author_name": "sirapoabchaikunsaeng",
      "author_url": "",
      "post_date": "02/24/2023 20:14:44",
      "content": "<p>Just tried a couple more stuffs, found 3 solutions on this :D</p>\n<ol>\n<li>For efficient net, use the public dataset \"timm-pretrained-efficientnet\", they have the exact same weight</li>\n<li>For resnet50, use the public dataset \"Pretrained ResNet Models from PIM\"</li>\n<li>Otherwise to upload local files, don't drag the file to the box, but click the button and navigate to the file instead. Somehow it doesn't get stuck that way</li>\n</ol>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2158387": "As per the title, how do I use pretrained weights when the notebook doesn't allow internet?\n\nI have tried the following, none of which works\n\n1. I use the create new dataset button in an attempt to upload my timm pretrained weights (that is already downloaded into my pc). But the download gets stuck with no progress forever. On this I have also switched to multiple wifis, all of them are stuck :/ (image attached) ![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F3c5dc7964487b15d7b5a3868dc6fa410%2Fkaggle_stuck.png?generation=1677269032181656&alt=media)\n\n2. I tried adding the dataset via the external URL option instead, the link is https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b4_ra2_320-7eb33cd5.pth which I confirm that it does point to the correct model url, but kaggle complains that it's not (image attached) \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11372549%2F8eeb706fdc7ca849cde9c6a8b673184a%2Fkaggle_fail.png?generation=1677269156706964&alt=media)\n\n3. I made sure I didn't do something dumb by trying to call ```python\ntimm.create_model(\"efficientnet_b4\", pretrained=True, num_classes=1, in_chans=3)``` As expected, the code stuck and after a while fails due to no internet.\n\nI'm new to kaggle so there's probably a good way around this that I didn't know. I don't want to use public dataset with pretrained models either because they are different to what timm offers.\n\nThank you",
    "2158391": "Just tried a couple more stuffs, found 3 solutions on this :D\n\n1. For efficient net, use the public dataset \"timm-pretrained-efficientnet\", they have the exact same weight\n2. For resnet50, use the public dataset \"Pretrained ResNet Models from PIM\"\n3. Otherwise to upload local files, don't drag the file to the box, but click the button and navigate to the file instead. Somehow it doesn't get stuck that way"
  },
  "source": "meta"
}