{
  "id": 132215,
  "title": "Keras callback model checkpoint",
  "url": "/competitions/flower-classification-with-tpus/discussion/132215",
  "author_name": "",
  "post_date": "2020-02-24T22:48:38.633747800Z",
  "votes": null,
  "comment_count": 11,
  "views": 0,
  "content": "<p>I get an error when using keras callback model checkpoint. The error is \"unimplemented error\". I searched about it and it seems that means it does not work with TPU yet. Is there any solutions for this or another way for model checkpointing.</p>",
  "messages": [
    {
      "id": "755578",
      "postDate": "02/24/2020 22:48:38",
      "content": "<p>I get an error when using keras callback model checkpoint. The error is \"unimplemented error\". I searched about it and it seems that means it does not work with TPU yet. Is there any solutions for this or another way for model checkpointing.</p>",
      "rawMarkdown": "I get an error when using keras callback model checkpoint. The error is \"unimplemented error\". I searched about it and it seems that means it does not work with TPU yet. Is there any solutions for this or another way for model checkpointing.",
      "votes": null
    },
    {
      "id": "755618",
      "postDate": "02/25/2020 00:29:26",
      "content": "<p>The TPU can only write to GCS and Kaggle does not offer a writable GCS bucket for your TPUs.\nThere is model saving code in the <a href=\"https://www.kaggle.com/mgornergoogle/five-flowers-with-keras-and-xception-on-tpu\">TPU starter notebook</a> in the <a href=\"https://www.kaggle.com/docs/tpu\">TPU docs</a>. Not exactly the same thing as a checkpoint but close. Look for cells \"Save the mode;\" and \"Reload the model\"</p>",
      "rawMarkdown": "The TPU can only write to GCS and Kaggle does not offer a writable GCS bucket for your TPUs.\nThere is model saving code in the [TPU starter notebook](https://www.kaggle.com/mgornergoogle/five-flowers-with-keras-and-xception-on-tpu) in the [TPU docs](https://www.kaggle.com/docs/tpu). Not exactly the same thing as a checkpoint but close. Look for cells \"Save the mode;\" and \"Reload the model\"",
      "votes": null
    },
    {
      "id": "755659",
      "postDate": "02/25/2020 01:45:26",
      "content": "<p>I checked the kernel you mentioned. This means that if I want to use the model checkpoint callback, I would need to re implement it using the technique in your notebook. </p>",
      "rawMarkdown": "I checked the kernel you mentioned. This means that if I want to use the model checkpoint callback, I would need to re implement it using the technique in your notebook.",
      "votes": null
    },
    {
      "id": "755721",
      "postDate": "02/25/2020 03:57:56",
      "content": "<p>sir i need  lung cancer CT dataset. How can i get it?</p>",
      "rawMarkdown": "sir i need  lung cancer CT dataset. How can i get it?",
      "votes": null
    },
    {
      "id": "756628",
      "postDate": "02/25/2020 22:46:10",
      "content": "<p>yes, or not use a callback at all and just save the model at the end of the training</p>",
      "rawMarkdown": "yes, or not use a callback at all and just save the model at the end of the training",
      "votes": null
    },
    {
      "id": "757455",
      "postDate": "02/26/2020 19:27:49",
      "content": "<p>Hey <a href=\"/ibrahimsherify\">@ibrahimsherify</a> and <a href=\"/mgornergoogle\">@mgornergoogle</a> I'm using Keras <code>ModelCheckpoint</code> on <a href=\"https://www.kaggle.com/dimitreoliveira/flower-classification-with-tpus-eda-and-baseline/notebook\">my code here</a> and it seems to be working fine.</p>",
      "rawMarkdown": "Hey @ibrahimsherify and @mgornergoogle I'm using Keras `ModelCheckpoint` on [my code here](https://www.kaggle.com/dimitreoliveira/flower-classification-with-tpus-eda-and-baseline/notebook) and it seems to be working fine.",
      "votes": null
    },
    {
      "id": "757474",
      "postDate": "02/26/2020 19:50:52",
      "content": "<p>Thank for the notebook. So it looks like ModelCheckpoint will work with a TPU if the model_dir is local and the checkpoint format is .h5. Thank you for the find. There is definitely room for improvement on our end here.</p>",
      "rawMarkdown": "Thank for the notebook. So it looks like ModelCheckpoint will work with a TPU if the model_dir is local and the checkpoint format is .h5. Thank you for the find. There is definitely room for improvement on our end here.",
      "votes": null
    },
    {
      "id": "757498",
      "postDate": "02/26/2020 20:59:28",
      "content": "<p>You're welcome <a href=\"/mgornergoogle\">@mgornergoogle</a> , that's the beauty of open-sourced code, the community integration!</p>",
      "rawMarkdown": "You're welcome @mgornergoogle , that's the beauty of open-sourced code, the community integration!",
      "votes": null
    },
    {
      "id": "757681",
      "postDate": "02/27/2020 02:37:23",
      "content": "<p>I tried it and it worked. Thanks for your help.</p>",
      "rawMarkdown": "I tried it and it worked. Thanks for your help.",
      "votes": null
    },
    {
      "id": "758038",
      "postDate": "02/27/2020 11:45:37",
      "content": "<p>You're welcome <a href=\"/ibrahimsherify\">@ibrahimsherify</a> </p>",
      "rawMarkdown": "You're welcome @ibrahimsherify",
      "votes": null
    },
    {
      "id": "759408",
      "postDate": "02/29/2020 02:07:26",
      "content": "<p>Thanks! I hope <code>ModelCheckpoint</code> can also be used in a custom training loop also. I will try it.</p>",
      "rawMarkdown": "Thanks! I hope `ModelCheckpoint` can also be used in a custom training loop also. I will try it.",
      "votes": null
    },
    {
      "id": "759410",
      "postDate": "02/29/2020 02:09:56",
      "content": "<p>It should work but in a custom training loop, you have access to the model at every step so you can just call model.save()</p>",
      "rawMarkdown": "It should work but in a custom training loop, you have access to the model at every step so you can just call model.save()",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 755618,
      "author_name": "mgorner",
      "author_url": "",
      "post_date": "02/25/2020 00:29:26",
      "content": "<p>The TPU can only write to GCS and Kaggle does not offer a writable GCS bucket for your TPUs.\nThere is model saving code in the <a href=\"https://www.kaggle.com/mgornergoogle/five-flowers-with-keras-and-xception-on-tpu\">TPU starter notebook</a> in the <a href=\"https://www.kaggle.com/docs/tpu\">TPU docs</a>. Not exactly the same thing as a checkpoint but close. Look for cells \"Save the mode;\" and \"Reload the model\"</p>",
      "votes": null,
      "replies": [
        {
          "id": 755659,
          "author_name": "ibrahimsherify",
          "author_url": "",
          "post_date": "02/25/2020 01:45:26",
          "content": "<p>I checked the kernel you mentioned. This means that if I want to use the model checkpoint callback, I would need to re implement it using the technique in your notebook. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 756628,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/25/2020 22:46:10",
          "content": "<p>yes, or not use a callback at all and just save the model at the end of the training</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 755721,
      "author_name": "halakajalms",
      "author_url": "",
      "post_date": "02/25/2020 03:57:56",
      "content": "<p>sir i need  lung cancer CT dataset. How can i get it?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 757455,
      "author_name": "dimitreoliveira",
      "author_url": "",
      "post_date": "02/26/2020 19:27:49",
      "content": "<p>Hey <a href=\"/ibrahimsherify\">@ibrahimsherify</a> and <a href=\"/mgornergoogle\">@mgornergoogle</a> I'm using Keras <code>ModelCheckpoint</code> on <a href=\"https://www.kaggle.com/dimitreoliveira/flower-classification-with-tpus-eda-and-baseline/notebook\">my code here</a> and it seems to be working fine.</p>",
      "votes": null,
      "replies": [
        {
          "id": 757474,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/26/2020 19:50:52",
          "content": "<p>Thank for the notebook. So it looks like ModelCheckpoint will work with a TPU if the model_dir is local and the checkpoint format is .h5. Thank you for the find. There is definitely room for improvement on our end here.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 757498,
          "author_name": "dimitreoliveira",
          "author_url": "",
          "post_date": "02/26/2020 20:59:28",
          "content": "<p>You're welcome <a href=\"/mgornergoogle\">@mgornergoogle</a> , that's the beauty of open-sourced code, the community integration!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 757681,
          "author_name": "ibrahimsherify",
          "author_url": "",
          "post_date": "02/27/2020 02:37:23",
          "content": "<p>I tried it and it worked. Thanks for your help.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 758038,
          "author_name": "dimitreoliveira",
          "author_url": "",
          "post_date": "02/27/2020 11:45:37",
          "content": "<p>You're welcome <a href=\"/ibrahimsherify\">@ibrahimsherify</a> </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 759408,
          "author_name": "yihdarshieh",
          "author_url": "",
          "post_date": "02/29/2020 02:07:26",
          "content": "<p>Thanks! I hope <code>ModelCheckpoint</code> can also be used in a custom training loop also. I will try it.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 759410,
          "author_name": "mgorner",
          "author_url": "",
          "post_date": "02/29/2020 02:09:56",
          "content": "<p>It should work but in a custom training loop, you have access to the model at every step so you can just call model.save()</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "755578": "I get an error when using keras callback model checkpoint. The error is \"unimplemented error\". I searched about it and it seems that means it does not work with TPU yet. Is there any solutions for this or another way for model checkpointing.",
    "755618": "The TPU can only write to GCS and Kaggle does not offer a writable GCS bucket for your TPUs.\nThere is model saving code in the [TPU starter notebook](https://www.kaggle.com/mgornergoogle/five-flowers-with-keras-and-xception-on-tpu) in the [TPU docs](https://www.kaggle.com/docs/tpu). Not exactly the same thing as a checkpoint but close. Look for cells \"Save the mode;\" and \"Reload the model\"",
    "755659": "I checked the kernel you mentioned. This means that if I want to use the model checkpoint callback, I would need to re implement it using the technique in your notebook.",
    "755721": "sir i need  lung cancer CT dataset. How can i get it?",
    "756628": "yes, or not use a callback at all and just save the model at the end of the training",
    "757455": "Hey @ibrahimsherify and @mgornergoogle I'm using Keras `ModelCheckpoint` on [my code here](https://www.kaggle.com/dimitreoliveira/flower-classification-with-tpus-eda-and-baseline/notebook) and it seems to be working fine.",
    "757474": "Thank for the notebook. So it looks like ModelCheckpoint will work with a TPU if the model_dir is local and the checkpoint format is .h5. Thank you for the find. There is definitely room for improvement on our end here.",
    "757498": "You're welcome @mgornergoogle , that's the beauty of open-sourced code, the community integration!",
    "757681": "I tried it and it worked. Thanks for your help.",
    "758038": "You're welcome @ibrahimsherify",
    "759408": "Thanks! I hope `ModelCheckpoint` can also be used in a custom training loop also. I will try it.",
    "759410": "It should work but in a custom training loop, you have access to the model at every step so you can just call model.save()"
  },
  "source": "meta"
}