{
  "id": 199511,
  "title": "How to save trained model in Kaggle?",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/199511",
  "author_name": "",
  "post_date": "2020-11-26T02:28:05.861834200Z",
  "votes": 1,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I am new on Kaggle.  Does anyway have a good way to save a trained model from the notebook for next version?</p>\n<p>I have searched the Internet and couldn't find any way to save a trained model for later use.  I know some people suggested pickle,  pickle give me an error complaining the model contained some function.</p>",
  "messages": [
    {
      "id": "1091420",
      "postDate": "11/26/2020 02:28:05",
      "content": "<p>I am new on Kaggle.  Does anyway have a good way to save a trained model from the notebook for next version?</p>\n<p>I have searched the Internet and couldn't find any way to save a trained model for later use.  I know some people suggested pickle,  pickle give me an error complaining the model contained some function.</p>",
      "rawMarkdown": "I am new on Kaggle.  Does anyway have a good way to save a trained model from the notebook for next version?\n\nI have searched the Internet and couldn't find any way to save a trained model for later use.  I know some people suggested pickle,  pickle give me an error complaining the model contained some function.",
      "votes": null
    },
    {
      "id": "1091423",
      "postDate": "11/26/2020 02:32:02",
      "content": "<p>Typically:</p>\n<p>save:</p>\n<p>model.save(write_filename)</p>\n<p>reload:<br>\nmodel = load_model(write_filename)</p>\n<p>With EfficientNet I find I have to redefine and recompile the model before I can reload it. I haven't seen that with other models.</p>\n<p>I suspect there are multiple notebooks demonstrating these techniques.</p>\n<p>-Rich</p>",
      "rawMarkdown": "Typically:\n\nsave:\n\nmodel.save(write_filename)\n\nreload:\nmodel = load_model(write_filename)\n\nWith EfficientNet I find I have to redefine and recompile the model before I can reload it. I haven't seen that with other models.\n\nI suspect there are multiple notebooks demonstrating these techniques.\n\n-Rich",
      "votes": null
    },
    {
      "id": "1096523",
      "postDate": "11/30/2020 15:17:30",
      "content": "<p>Thanks for your reply</p>",
      "rawMarkdown": "Thanks for your reply",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1091423,
      "author_name": "richardepstein",
      "author_url": "",
      "post_date": "11/26/2020 02:32:02",
      "content": "<p>Typically:</p>\n<p>save:</p>\n<p>model.save(write_filename)</p>\n<p>reload:<br>\nmodel = load_model(write_filename)</p>\n<p>With EfficientNet I find I have to redefine and recompile the model before I can reload it. I haven't seen that with other models.</p>\n<p>I suspect there are multiple notebooks demonstrating these techniques.</p>\n<p>-Rich</p>",
      "votes": null,
      "replies": [
        {
          "id": 1096523,
          "author_name": "luqing2",
          "author_url": "",
          "post_date": "11/30/2020 15:17:30",
          "content": "<p>Thanks for your reply</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1091420": "I am new on Kaggle.  Does anyway have a good way to save a trained model from the notebook for next version?\n\nI have searched the Internet and couldn't find any way to save a trained model for later use.  I know some people suggested pickle,  pickle give me an error complaining the model contained some function.",
    "1091423": "Typically:\n\nsave:\n\nmodel.save(write_filename)\n\nreload:\nmodel = load_model(write_filename)\n\nWith EfficientNet I find I have to redefine and recompile the model before I can reload it. I haven't seen that with other models.\n\nI suspect there are multiple notebooks demonstrating these techniques.\n\n-Rich",
    "1096523": "Thanks for your reply"
  },
  "source": "meta"
}