{
  "id": 198725,
  "title": "How to import Keras models without internet for submission notebook?",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/198725",
  "author_name": "Kevin Joseph Scaria",
  "post_date": "2020-11-22T17:36:43.610000",
  "votes": 2,
  "comment_count": 7,
  "views": 0,
  "content": "<p>I used several Keras models for training. However, notebook contest doesn't allow to use internet. So my submission is failing when importing keras model architectures like Xception/EfficientNet.</p>\n<p>Could anyone suggest me how to do the same?</p>",
  "messages": [
    {
      "id": 1087722,
      "postDate": "2020-11-23T03:19:28.080Z",
      "content": "<p><a href=\"https://www.kaggle.com/dimitreoliveira\" target=\"_blank\">@dimitreoliveira</a> and <a href=\"https://www.kaggle.com/serigne\" target=\"_blank\">@serigne</a> Thanks for the quick response. </p>",
      "rawMarkdown": "@dimitreoliveira and @serigne Thanks for the quick response. ",
      "votes": 1
    },
    {
      "id": 1087538,
      "postDate": "2020-11-22T20:14:32.190Z",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/kevinscaria\" target=\"_blank\">@kevinscaria</a> just posted about that, take a look <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/198738\" target=\"_blank\">here</a>, I also have a working code example.</p>",
      "rawMarkdown": "Hey @kevinscaria just posted about that, take a look [here](https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/198738), I also have a working code example.",
      "votes": 1
    },
    {
      "id": 1087421,
      "postDate": "2020-11-22T17:36:43.610Z",
      "content": "<p>I used several Keras models for training. However, notebook contest doesn't allow to use internet. So my submission is failing when importing keras model architectures like Xception/EfficientNet.</p>\n<p>Could anyone suggest me how to do the same?</p>",
      "rawMarkdown": "I used several Keras models for training. However, notebook contest doesn't allow to use internet. So my submission is failing when importing keras model architectures like Xception/EfficientNet.\n\nCould anyone suggest me how to do the same?",
      "votes": 2
    },
    {
      "id": 1088582,
      "postDate": "2020-11-23T18:59:00.420Z",
      "content": "<p>What's the problem if you train the model (with net) and inference separately in different files (without a net)? In that case, you don't need to import any weights additionally. Also for EfficientNets are imported in TF 2.3. </p>",
      "rawMarkdown": "What's the problem if you train the model (with net) and inference separately in different files (without a net)? In that case, you don't need to import any weights additionally. Also for EfficientNets are imported in TF 2.3. ",
      "replies": [
        {
          "id": 1088645,
          "postDate": "2020-11-23T20:24:06.603Z",
          "content": "<p>I have found that with EfficientNet I cannot just load the model and weights. Instead I have to redefine the EfficientNet architecture and then I can load the weights.</p>\n<p>So, I need to load EfficientNet from a dataset when Internet is not available.</p>\n<p>As a note, I also found some compatibility problems with the default Kaggle Notebook (last checked about two months ago). To get things to work, I use an old notebook that has an older release of Kaggle Notebook on it.</p>\n<p>Not sure if the above instructions by Serigne avoid this problem.</p>\n<p>I don't have these issues with networks defined in the Tensorflow release, so sometimes I use things other than EfficientNet just for that reason. But I do like EfficientNet!</p>\n<p>-Rich</p>",
          "rawMarkdown": "I have found that with EfficientNet I cannot just load the model and weights. Instead I have to redefine the EfficientNet architecture and then I can load the weights.\n\nSo, I need to load EfficientNet from a dataset when Internet is not available.\n\nAs a note, I also found some compatibility problems with the default Kaggle Notebook (last checked about two months ago). To get things to work, I use an old notebook that has an older release of Kaggle Notebook on it.\n\nNot sure if the above instructions by Serigne avoid this problem.\n\nI don't have these issues with networks defined in the Tensorflow release, so sometimes I use things other than EfficientNet just for that reason. But I do like EfficientNet!\n\n-Rich"
        }
      ]
    },
    {
      "id": 1087460,
      "postDate": "2020-11-22T18:09:33.317Z",
      "content": "<p>I know that it can be added as a dataset. I am asking specifically for efficient net. I loaded one of the datasets available on kaggle. But it's throwing an error called no model named keras_applications. Will I be able to get a whl file from somewhere? </p>",
      "rawMarkdown": "I know that it can be added as a dataset. I am asking specifically for efficient net. I loaded one of the datasets available on kaggle. But it's throwing an error called no model named keras_applications. Will I be able to get a whl file from somewhere? ",
      "replies": [
        {
          "id": 1087533,
          "postDate": "2020-11-22T20:11:53.867Z",
          "content": "<p>You will need to upload both <a href=\"https://github.com/keras-team/keras-applications\" target=\"_blank\">keras-applications</a> and <a href=\"https://github.com/qubvel/efficientnet\" target=\"_blank\">efficientnet</a> as datasets.</p>\n<p>Once done you can install them in this order :</p>\n<pre><code>import sys\n\n! pip install ../input/keras-applications/keras-applications-master/ \npackage_path = '/kaggle/input/efficientnet/efficientnet-master/'\nsys.path.append(package_path)\n\n#test\nfrom efficientnet import tfkeras as efnet\n</code></pre>",
          "rawMarkdown": "You will need to upload both [keras-applications](https://github.com/keras-team/keras-applications) and [efficientnet](https://github.com/qubvel/efficientnet) as datasets.\n\nOnce done you can install them in this order :\n\n```\nimport sys\n\n! pip install ../input/keras-applications/keras-applications-master/ \npackage_path = '/kaggle/input/efficientnet/efficientnet-master/'\nsys.path.append(package_path)\n\n#test\nfrom efficientnet import tfkeras as efnet\n```\n\n",
          "votes": 3
        }
      ]
    },
    {
      "id": 1087423,
      "postDate": "2020-11-22T17:38:13.403Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1087722,
      "author_name": "Kevin Joseph Scaria",
      "author_url": "",
      "post_date": "2020-11-23T03:19:28.080000",
      "content": "<p><a href=\"https://www.kaggle.com/dimitreoliveira\" target=\"_blank\">@dimitreoliveira</a> and <a href=\"https://www.kaggle.com/serigne\" target=\"_blank\">@serigne</a> Thanks for the quick response. </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1087538,
      "author_name": "DimitreOliveira",
      "author_url": "",
      "post_date": "2020-11-22T20:14:32.190000",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/kevinscaria\" target=\"_blank\">@kevinscaria</a> just posted about that, take a look <a href=\"https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/198738\" target=\"_blank\">here</a>, I also have a working code example.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1088582,
      "author_name": "Innat",
      "author_url": "",
      "post_date": "2020-11-23T18:59:00.420000",
      "content": "<p>What's the problem if you train the model (with net) and inference separately in different files (without a net)? In that case, you don't need to import any weights additionally. Also for EfficientNets are imported in TF 2.3. </p>",
      "votes": 0,
      "replies": [
        {
          "id": 1088645,
          "author_name": "quadcore/Richard Epstein",
          "author_url": "",
          "post_date": "2020-11-23T20:24:06.603000",
          "content": "<p>I have found that with EfficientNet I cannot just load the model and weights. Instead I have to redefine the EfficientNet architecture and then I can load the weights.</p>\n<p>So, I need to load EfficientNet from a dataset when Internet is not available.</p>\n<p>As a note, I also found some compatibility problems with the default Kaggle Notebook (last checked about two months ago). To get things to work, I use an old notebook that has an older release of Kaggle Notebook on it.</p>\n<p>Not sure if the above instructions by Serigne avoid this problem.</p>\n<p>I don't have these issues with networks defined in the Tensorflow release, so sometimes I use things other than EfficientNet just for that reason. But I do like EfficientNet!</p>\n<p>-Rich</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1087460,
      "author_name": "Kevin Joseph Scaria",
      "author_url": "",
      "post_date": "2020-11-22T18:09:33.317000",
      "content": "<p>I know that it can be added as a dataset. I am asking specifically for efficient net. I loaded one of the datasets available on kaggle. But it's throwing an error called no model named keras_applications. Will I be able to get a whl file from somewhere? </p>",
      "votes": 0,
      "replies": [
        {
          "id": 1087533,
          "author_name": "Serigne ",
          "author_url": "",
          "post_date": "2020-11-22T20:11:53.867000",
          "content": "<p>You will need to upload both <a href=\"https://github.com/keras-team/keras-applications\" target=\"_blank\">keras-applications</a> and <a href=\"https://github.com/qubvel/efficientnet\" target=\"_blank\">efficientnet</a> as datasets.</p>\n<p>Once done you can install them in this order :</p>\n<pre><code>import sys\n\n! pip install ../input/keras-applications/keras-applications-master/ \npackage_path = '/kaggle/input/efficientnet/efficientnet-master/'\nsys.path.append(package_path)\n\n#test\nfrom efficientnet import tfkeras as efnet\n</code></pre>",
          "votes": 3,
          "replies": []
        }
      ]
    },
    {
      "id": 1087423,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-11-22T17:38:13.403000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1087722": "@dimitreoliveira and @serigne Thanks for the quick response. ",
    "1087538": "Hey @kevinscaria just posted about that, take a look [here](https://www.kaggle.com/c/cassava-leaf-disease-classification/discussion/198738), I also have a working code example.",
    "1087421": "I used several Keras models for training. However, notebook contest doesn't allow to use internet. So my submission is failing when importing keras model architectures like Xception/EfficientNet.\n\nCould anyone suggest me how to do the same?",
    "1088582": "What's the problem if you train the model (with net) and inference separately in different files (without a net)? In that case, you don't need to import any weights additionally. Also for EfficientNets are imported in TF 2.3. ",
    "1087460": "I know that it can be added as a dataset. I am asking specifically for efficient net. I loaded one of the datasets available on kaggle. But it's throwing an error called no model named keras_applications. Will I be able to get a whl file from somewhere? ",
    "1087423": ""
  }
}