{
  "id": 131144,
  "title": "Python 3.5 Trainning Problem",
  "url": "/competitions/bengaliai-cv19/discussion/131144",
  "author_name": "",
  "post_date": "2020-02-18T14:04:22.961557100Z",
  "votes": null,
  "comment_count": 9,
  "views": 0,
  "content": "<p>Hy all,\nI trainned my model on google cloud platform notebook, which has the python version 3.5.\nI use keras, created the model architecture using the module (<a href=\"https://github.com/qubvel/classification_models\">https://github.com/qubvel/classification_models</a> ). Than I save the model to .hdf5. The problem is that I cannot load the model in kaggle kernel because the python version is 3.6. When using the load_model is return the error: \"SystemError unknown opcode\", this happens because python versions are different.\nI had tried to save weights instead of model, create the model architecture in code and than load the weights. It works well but need internet connection, which is not allowed to submit.\nAny suggestions to solve this?</p>",
  "messages": [
    {
      "id": "749266",
      "postDate": "02/18/2020 14:04:22",
      "content": "<p>Hy all,\nI trainned my model on google cloud platform notebook, which has the python version 3.5.\nI use keras, created the model architecture using the module (<a href=\"https://github.com/qubvel/classification_models\">https://github.com/qubvel/classification_models</a> ). Than I save the model to .hdf5. The problem is that I cannot load the model in kaggle kernel because the python version is 3.6. When using the load_model is return the error: \"SystemError unknown opcode\", this happens because python versions are different.\nI had tried to save weights instead of model, create the model architecture in code and than load the weights. It works well but need internet connection, which is not allowed to submit.\nAny suggestions to solve this?</p>",
      "rawMarkdown": "Hy all,\nI trainned my model on google cloud platform notebook, which has the python version 3.5.\nI use keras, created the model architecture using the module (https://github.com/qubvel/classification_models ). Than I save the model to .hdf5. The problem is that I cannot load the model in kaggle kernel because the python version is 3.6. When using the load_model is return the error: \"SystemError unknown opcode\", this happens because python versions are different.\nI had tried to save weights instead of model, create the model architecture in code and than load the weights. It works well but need internet connection, which is not allowed to submit.\nAny suggestions to solve this?",
      "votes": null
    },
    {
      "id": "749288",
      "postDate": "02/18/2020 14:33:28",
      "content": "<p>upload py modules you need ( e.g. resnext.py) to /kaggle/input/my_modules folder.  </p>\n\n<p>then you can use the functions of the module without internet connection:</p>\n\n<p>```\nimport sys\nsys.path.append(\"/kaggle/input/my_modules/\")</p>\n\n<p>from resnext import ResNeXt50\n```</p>",
      "rawMarkdown": "upload py modules you need ( e.g. resnext.py) to /kaggle/input/my_modules folder.  \n\nthen you can use the functions of the module without internet connection:\n\n\n```\nimport sys\nsys.path.append(\"/kaggle/input/my_modules/\")\n\nfrom resnext import ResNeXt50\n```",
      "votes": null
    },
    {
      "id": "749304",
      "postDate": "02/18/2020 15:04:44",
      "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2Fbf981cbfd69d597696ff24f6dd5053ac%2FAnotao%202020-02-18%20150323.png?generation=1582038362942725&amp;alt=media\" alt=\"\"></p>\n\n<p>I tried your suggestion, getting error: \"ModuleNotFoundError\nNo module named 'classification_models'\"</p>",
      "rawMarkdown": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2Fbf981cbfd69d597696ff24f6dd5053ac%2FAnotao%202020-02-18%20150323.png?generation=1582038362942725&amp;alt=media)\n\nI tried your suggestion, getting error: \"ModuleNotFoundError\nNo module named 'classification_models'\"",
      "votes": null
    },
    {
      "id": "749313",
      "postDate": "02/18/2020 15:10:44",
      "content": "<p>try\n<code>from keras import Classifiers</code></p>",
      "rawMarkdown": "try\n`from keras import Classifiers`",
      "votes": null
    },
    {
      "id": "749349",
      "postDate": "02/18/2020 16:05:56",
      "content": "<p>ImportError cannot import name \"Classifier\" when using -&gt; from keras import Classifiers\nI tried to change keras folder name to keras_ and error returns to \"No module named 'keras_\".\nI think when using \"from keras\" the code goes to keras modules from tensorflow, not from my folder. So the problem remains including .py from \"kaggle/input/classification_models\" directory</p>",
      "rawMarkdown": "ImportError cannot import name \"Classifier\" when using -&gt; from keras import Classifiers\nI tried to change keras folder name to keras_ and error returns to \"No module named 'keras_\".\nI think when using \"from keras\" the code goes to keras modules from tensorflow, not from my folder. So the problem remains including .py from \"kaggle/input/classification_models\" directory",
      "votes": null
    },
    {
      "id": "749417",
      "postDate": "02/18/2020 17:11:22",
      "content": "<p>I made slight \"change\" of sources. \nit seems to work:\n<a href=\"https://www.kaggle.com/andreyzotov/qubvel-classification-models-test\">https://www.kaggle.com/andreyzotov/qubvel-classification-models-test</a></p>",
      "rawMarkdown": "I made slight \"change\" of sources. \nit seems to work:\nhttps://www.kaggle.com/andreyzotov/qubvel-classification-models-test",
      "votes": null
    },
    {
      "id": "749620",
      "postDate": "02/18/2020 20:16:45",
      "content": "<p>Thank you for the code.\nThe problem remains -&gt; ModuleNotFoundError No module named 'models_factory'\nHow are you uploading the files to kaggle/input? I click 'add data' a create a new dataset with thoose files.</p>",
      "rawMarkdown": "Thank you for the code.\nThe problem remains -&gt; ModuleNotFoundError No module named 'models_factory'\nHow are you uploading the files to kaggle/input? I click 'add data' a create a new dataset with thoose files.",
      "votes": null
    },
    {
      "id": "749643",
      "postDate": "02/18/2020 20:35:52",
      "content": "<blockquote>\n  <p>I click 'add data' a create a new dataset with thoose files.</p>\n</blockquote>\n\n<p>I do the same. Maybe you pass the wrong path  in  sys.path.append command? Anyway you may fork my kernel.</p>",
      "rawMarkdown": "&gt; I click 'add data' a create a new dataset with thoose files.\n\nI do the same. Maybe you pass the wrong path  in  sys.path.append command? Anyway you may fork my kernel.",
      "votes": null
    },
    {
      "id": "749723",
      "postDate": "02/18/2020 21:49:12",
      "content": "<p>even when using your kernel -.-\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2F0264fc565562efb8b2adf997ca80c6fd%2FAnotao%202020-02-18%20150323.png?generation=1582062540019550&amp;alt=media\" alt=\"\">\nI have no idea what is happening</p>",
      "rawMarkdown": "even when using your kernel -.-\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2F0264fc565562efb8b2adf997ca80c6fd%2FAnotao%202020-02-18%20150323.png?generation=1582062540019550&amp;alt=media)\nI have no idea what is happening",
      "votes": null
    },
    {
      "id": "750512",
      "postDate": "02/19/2020 13:13:31",
      "content": "<p>Solved. I was changing the name of the dataset in settings, but the actual folder name didn't change.</p>",
      "rawMarkdown": "Solved. I was changing the name of the dataset in settings, but the actual folder name didn't change.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 749288,
      "author_name": "andreyzotov",
      "author_url": "",
      "post_date": "02/18/2020 14:33:28",
      "content": "<p>upload py modules you need ( e.g. resnext.py) to /kaggle/input/my_modules folder.  </p>\n\n<p>then you can use the functions of the module without internet connection:</p>\n\n<p>```\nimport sys\nsys.path.append(\"/kaggle/input/my_modules/\")</p>\n\n<p>from resnext import ResNeXt50\n```</p>",
      "votes": null,
      "replies": [
        {
          "id": 749304,
          "author_name": "macarrony00",
          "author_url": "",
          "post_date": "02/18/2020 15:04:44",
          "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2Fbf981cbfd69d597696ff24f6dd5053ac%2FAnotao%202020-02-18%20150323.png?generation=1582038362942725&amp;alt=media\" alt=\"\"></p>\n\n<p>I tried your suggestion, getting error: \"ModuleNotFoundError\nNo module named 'classification_models'\"</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749313,
          "author_name": "andreyzotov",
          "author_url": "",
          "post_date": "02/18/2020 15:10:44",
          "content": "<p>try\n<code>from keras import Classifiers</code></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749349,
          "author_name": "macarrony00",
          "author_url": "",
          "post_date": "02/18/2020 16:05:56",
          "content": "<p>ImportError cannot import name \"Classifier\" when using -&gt; from keras import Classifiers\nI tried to change keras folder name to keras_ and error returns to \"No module named 'keras_\".\nI think when using \"from keras\" the code goes to keras modules from tensorflow, not from my folder. So the problem remains including .py from \"kaggle/input/classification_models\" directory</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749417,
          "author_name": "andreyzotov",
          "author_url": "",
          "post_date": "02/18/2020 17:11:22",
          "content": "<p>I made slight \"change\" of sources. \nit seems to work:\n<a href=\"https://www.kaggle.com/andreyzotov/qubvel-classification-models-test\">https://www.kaggle.com/andreyzotov/qubvel-classification-models-test</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749620,
          "author_name": "macarrony00",
          "author_url": "",
          "post_date": "02/18/2020 20:16:45",
          "content": "<p>Thank you for the code.\nThe problem remains -&gt; ModuleNotFoundError No module named 'models_factory'\nHow are you uploading the files to kaggle/input? I click 'add data' a create a new dataset with thoose files.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749643,
          "author_name": "andreyzotov",
          "author_url": "",
          "post_date": "02/18/2020 20:35:52",
          "content": "<blockquote>\n  <p>I click 'add data' a create a new dataset with thoose files.</p>\n</blockquote>\n\n<p>I do the same. Maybe you pass the wrong path  in  sys.path.append command? Anyway you may fork my kernel.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 749723,
          "author_name": "macarrony00",
          "author_url": "",
          "post_date": "02/18/2020 21:49:12",
          "content": "<p>even when using your kernel -.-\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2F0264fc565562efb8b2adf997ca80c6fd%2FAnotao%202020-02-18%20150323.png?generation=1582062540019550&amp;alt=media\" alt=\"\">\nI have no idea what is happening</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 750512,
          "author_name": "macarrony00",
          "author_url": "",
          "post_date": "02/19/2020 13:13:31",
          "content": "<p>Solved. I was changing the name of the dataset in settings, but the actual folder name didn't change.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "749266": "Hy all,\nI trainned my model on google cloud platform notebook, which has the python version 3.5.\nI use keras, created the model architecture using the module (https://github.com/qubvel/classification_models ). Than I save the model to .hdf5. The problem is that I cannot load the model in kaggle kernel because the python version is 3.6. When using the load_model is return the error: \"SystemError unknown opcode\", this happens because python versions are different.\nI had tried to save weights instead of model, create the model architecture in code and than load the weights. It works well but need internet connection, which is not allowed to submit.\nAny suggestions to solve this?",
    "749288": "upload py modules you need ( e.g. resnext.py) to /kaggle/input/my_modules folder.  \n\nthen you can use the functions of the module without internet connection:\n\n\n```\nimport sys\nsys.path.append(\"/kaggle/input/my_modules/\")\n\nfrom resnext import ResNeXt50\n```",
    "749304": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2Fbf981cbfd69d597696ff24f6dd5053ac%2FAnotao%202020-02-18%20150323.png?generation=1582038362942725&amp;alt=media)\n\nI tried your suggestion, getting error: \"ModuleNotFoundError\nNo module named 'classification_models'\"",
    "749313": "try\n`from keras import Classifiers`",
    "749349": "ImportError cannot import name \"Classifier\" when using -&gt; from keras import Classifiers\nI tried to change keras folder name to keras_ and error returns to \"No module named 'keras_\".\nI think when using \"from keras\" the code goes to keras modules from tensorflow, not from my folder. So the problem remains including .py from \"kaggle/input/classification_models\" directory",
    "749417": "I made slight \"change\" of sources. \nit seems to work:\nhttps://www.kaggle.com/andreyzotov/qubvel-classification-models-test",
    "749620": "Thank you for the code.\nThe problem remains -&gt; ModuleNotFoundError No module named 'models_factory'\nHow are you uploading the files to kaggle/input? I click 'add data' a create a new dataset with thoose files.",
    "749643": "&gt; I click 'add data' a create a new dataset with thoose files.\n\nI do the same. Maybe you pass the wrong path  in  sys.path.append command? Anyway you may fork my kernel.",
    "749723": "even when using your kernel -.-\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F1910776%2F0264fc565562efb8b2adf997ca80c6fd%2FAnotao%202020-02-18%20150323.png?generation=1582062540019550&amp;alt=media)\nI have no idea what is happening",
    "750512": "Solved. I was changing the name of the dataset in settings, but the actual folder name didn't change."
  },
  "source": "meta"
}