{
  "id": 347845,
  "title": "segmentation_models_pytorch DOES NOT WORK ON INFERENCE",
  "url": "/competitions/hubmap-organ-segmentation/discussion/347845",
  "author_name": "",
  "post_date": "2022-08-25T15:31:25.798189200Z",
  "votes": -1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I have trained the model using the library segmentation_models_pytorch, however, I couldn't install it on my inference notebook because the internet must be turned off.<br>\nCould you suggest other options so I can use \"segmentation_models_pytorch\" on the inference notebook?</p>",
  "messages": [
    {
      "id": "1913936",
      "postDate": "08/25/2022 15:31:25",
      "content": "<p>I have trained the model using the library segmentation_models_pytorch, however, I couldn't install it on my inference notebook because the internet must be turned off.<br>\nCould you suggest other options so I can use \"segmentation_models_pytorch\" on the inference notebook?</p>",
      "rawMarkdown": "I have trained the model using the library segmentation_models_pytorch, however, I couldn't install it on my inference notebook because the internet must be turned off.\nCould you suggest other options so I can use \"segmentation_models_pytorch\" on the inference notebook?",
      "votes": null
    },
    {
      "id": "1913953",
      "postDate": "08/25/2022 15:47:45",
      "content": "<p>Hi, to install packages without internet you should either 1) upload installation files in your input folder (as an external dataset) or 2) use already available datasets with those files on Kaggle and then install from them (copy first to 'working' dir otherwise you'll get read-only folder error)  Also have a look at this notebook? <a href=\"https://www.kaggle.com/code/vexxingbanana/hubmap-unet-semantic-approach-infer\" target=\"_blank\">https://www.kaggle.com/code/vexxingbanana/hubmap-unet-semantic-approach-infer</a></p>",
      "rawMarkdown": "Hi, to install packages without internet you should either 1) upload installation files in your input folder (as an external dataset) or 2) use already available datasets with those files on Kaggle and then install from them (copy first to 'working' dir otherwise you'll get read-only folder error)  Also have a look at this notebook? https://www.kaggle.com/code/vexxingbanana/hubmap-unet-semantic-approach-infer",
      "votes": null
    },
    {
      "id": "1914058",
      "postDate": "08/25/2022 17:27:30",
      "content": "<p>Thanks for ur response, I installed the on the working directory, but when I try to load initialize the model I got these errors, do you have any ideas on how to solve it? google cant help(<br>\n<code>- \n!cp -r ../input/pytorch-segmentation-models-lib/ ./\n!pip install -q ./pytorch-segmentation-models-lib/pretrainedmodels-0.7.4/pretrainedmodels-0.7.4\n!pip install -q ./pytorch-segmentation-models-lib/efficientnet_pytorch-0.6.3/efficientnet_pytorch-0.6.3\n!pip install -q ./pytorch-segmentation-models-lib/timm-0.4.12-py3-none-any.whl\n!pip install -q ./pytorch-segmentation-models-lib/segmentation_models_pytorch-0.2.0-py3-none-any.whl\nimport segmentation_models_pytorch as smp\ndef init_model():\n    model =  smp.Unet(\n                 encoder_name='efficientnet-b0',\n                 encoder_weights='imagenet',\n                 in_channels=3,\n                 classes=1)\n    return model</code></p>",
      "rawMarkdown": "Thanks for ur response, I installed the on the working directory, but when I try to load initialize the model I got these errors, do you have any ideas on how to solve it? google cant help(\n`- \n!cp -r ../input/pytorch-segmentation-models-lib/ ./\n!pip install -q ./pytorch-segmentation-models-lib/pretrainedmodels-0.7.4/pretrainedmodels-0.7.4\n!pip install -q ./pytorch-segmentation-models-lib/efficientnet_pytorch-0.6.3/efficientnet_pytorch-0.6.3\n!pip install -q ./pytorch-segmentation-models-lib/timm-0.4.12-py3-none-any.whl\n!pip install -q ./pytorch-segmentation-models-lib/segmentation_models_pytorch-0.2.0-py3-none-any.whl\nimport segmentation_models_pytorch as smp\ndef init_model():\n    model =  smp.Unet(\n                 encoder_name='efficientnet-b0',\n                 encoder_weights='imagenet',\n                 in_channels=3,\n                 classes=1)\n    return model`",
      "votes": null
    },
    {
      "id": "1914148",
      "postDate": "08/25/2022 19:14:24",
      "content": "<p>Here, <code>encoder_weights='imagenet'</code>, as you are using the notebook without internet, please, upload your locally saved state dict and use it. While initializing the model with smp just use <code>weights = None</code>. I hope this is what causing the issue</p>",
      "rawMarkdown": "Here, `encoder_weights='imagenet'`, as you are using the notebook without internet, please, upload your locally saved state dict and use it. While initializing the model with smp just use `weights = None`. I hope this is what causing the issue",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1913953,
      "author_name": "katalip22",
      "author_url": "",
      "post_date": "08/25/2022 15:47:45",
      "content": "<p>Hi, to install packages without internet you should either 1) upload installation files in your input folder (as an external dataset) or 2) use already available datasets with those files on Kaggle and then install from them (copy first to 'working' dir otherwise you'll get read-only folder error)  Also have a look at this notebook? <a href=\"https://www.kaggle.com/code/vexxingbanana/hubmap-unet-semantic-approach-infer\" target=\"_blank\">https://www.kaggle.com/code/vexxingbanana/hubmap-unet-semantic-approach-infer</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 1914058,
          "author_name": "nurkhanlaiyk",
          "author_url": "",
          "post_date": "08/25/2022 17:27:30",
          "content": "<p>Thanks for ur response, I installed the on the working directory, but when I try to load initialize the model I got these errors, do you have any ideas on how to solve it? google cant help(<br>\n<code>- \n!cp -r ../input/pytorch-segmentation-models-lib/ ./\n!pip install -q ./pytorch-segmentation-models-lib/pretrainedmodels-0.7.4/pretrainedmodels-0.7.4\n!pip install -q ./pytorch-segmentation-models-lib/efficientnet_pytorch-0.6.3/efficientnet_pytorch-0.6.3\n!pip install -q ./pytorch-segmentation-models-lib/timm-0.4.12-py3-none-any.whl\n!pip install -q ./pytorch-segmentation-models-lib/segmentation_models_pytorch-0.2.0-py3-none-any.whl\nimport segmentation_models_pytorch as smp\ndef init_model():\n    model =  smp.Unet(\n                 encoder_name='efficientnet-b0',\n                 encoder_weights='imagenet',\n                 in_channels=3,\n                 classes=1)\n    return model</code></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1914148,
          "author_name": "katalip22",
          "author_url": "",
          "post_date": "08/25/2022 19:14:24",
          "content": "<p>Here, <code>encoder_weights='imagenet'</code>, as you are using the notebook without internet, please, upload your locally saved state dict and use it. While initializing the model with smp just use <code>weights = None</code>. I hope this is what causing the issue</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1913936": "I have trained the model using the library segmentation_models_pytorch, however, I couldn't install it on my inference notebook because the internet must be turned off.\nCould you suggest other options so I can use \"segmentation_models_pytorch\" on the inference notebook?",
    "1913953": "Hi, to install packages without internet you should either 1) upload installation files in your input folder (as an external dataset) or 2) use already available datasets with those files on Kaggle and then install from them (copy first to 'working' dir otherwise you'll get read-only folder error)  Also have a look at this notebook? https://www.kaggle.com/code/vexxingbanana/hubmap-unet-semantic-approach-infer",
    "1914058": "Thanks for ur response, I installed the on the working directory, but when I try to load initialize the model I got these errors, do you have any ideas on how to solve it? google cant help(\n`- \n!cp -r ../input/pytorch-segmentation-models-lib/ ./\n!pip install -q ./pytorch-segmentation-models-lib/pretrainedmodels-0.7.4/pretrainedmodels-0.7.4\n!pip install -q ./pytorch-segmentation-models-lib/efficientnet_pytorch-0.6.3/efficientnet_pytorch-0.6.3\n!pip install -q ./pytorch-segmentation-models-lib/timm-0.4.12-py3-none-any.whl\n!pip install -q ./pytorch-segmentation-models-lib/segmentation_models_pytorch-0.2.0-py3-none-any.whl\nimport segmentation_models_pytorch as smp\ndef init_model():\n    model =  smp.Unet(\n                 encoder_name='efficientnet-b0',\n                 encoder_weights='imagenet',\n                 in_channels=3,\n                 classes=1)\n    return model`",
    "1914148": "Here, `encoder_weights='imagenet'`, as you are using the notebook without internet, please, upload your locally saved state dict and use it. While initializing the model with smp just use `weights = None`. I hope this is what causing the issue"
  },
  "source": "meta"
}