{
  "id": 372190,
  "title": "Notebook stops during fit: Successful run",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/372190",
  "author_name": "Andrew Schleiss",
  "post_date": "2022-12-14T16:54:48.450000",
  "votes": 0,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hi all</p>\n<p>I hope somone can help, I cant seem to  figure out why the notebook stops during training on the 1st epoch</p>\n<p>The notebook runs for a few minutes, gets to epoch 1 and stops <br>\nThe kernel run shows as succesful but the rest of the notebook hasnt executed<br>\n<a href=\"https://postimg.cc/YLHdR4Ks\" target=\"_blank\"><img src=\"https://i.postimg.cc/Bb8RqDh4/Capture.jpg\" alt=\"Capture.jpg\"></a></p>\n<p><a href=\"https://postimg.cc/2VNs967m\" target=\"_blank\"><img src=\"https://i.postimg.cc/bNZqJSGG/Capture2.jpg\" alt=\"Capture2.jpg\"></a></p>\n<p>Any help is appreciated<br>\n<a href=\"https://www.kaggle.com/slythe/rsna-keras-resnet-modelling\" target=\"_blank\">Notebook is here</a></p>",
  "messages": [
    {
      "id": 2065562,
      "postDate": "2022-12-14T20:15:07.757Z",
      "content": "<p>Some pointer</p>\n<ul>\n<li> Check: <a href=\"https://keras.io/guides/preprocessing_layers/\" target=\"_blank\">https://keras.io/guides/preprocessing_layers/</a></li>\n</ul>\n<p><img src=\"https://user-images.githubusercontent.com/17668390/208264848-df826565-fcb6-425b-94d5-3cf07af66d72.png\" alt=\"image\"></p>\n<ul>\n<li>Rescaling, Resing can be added.</li>\n<li>If you use <code>.repeat()</code>, you might need to provde <code>step_per_epoch</code>.</li>\n<li>Removing <code>.cache()</code> and recheck.</li>\n</ul>\n<pre><code> strategy.scope():\n    ResNet = ResNet50(\n                  include_top=,\n                  input_shape=(RESIZE,RESIZE,),\n                  pooling = \n     )\n    ResNet.trainable = \n\n    model = Sequential(\n        [\n            layers.InputLayer(input_shape=(RESIZE,RESIZE,)),\n            ResNet,   \n            layers.Dense() \n        ]\n    )\n</code></pre>\n<p>Also note, you set no activation to last layer, so you'll get logit (not prob score); adjust your metrics accordingly.</p>",
      "rawMarkdown": "Some pointer\n\n- ~~Don't use augmentaiotn layer inside the model build while using TPU.~~ Check: https://keras.io/guides/preprocessing_layers/\n\n![image](https://user-images.githubusercontent.com/17668390/208264848-df826565-fcb6-425b-94d5-3cf07af66d72.png)\n\n\n\n- Rescaling, Resing can be added.\n- If you use `.repeat()`, you might need to provde `step_per_epoch`.\n- Removing `.cache()` and recheck.\n\n\n```python\nwith strategy.scope():\n    ResNet = ResNet50(\n                  include_top=False,\n                  input_shape=(RESIZE,RESIZE,3),\n                  pooling = 'avg'\n     )\n    ResNet.trainable = False\n    \n    model = Sequential(\n        [\n            layers.InputLayer(input_shape=(RESIZE,RESIZE,3)),\n            ResNet,   \n            layers.Dense(1) \n        ]\n    )\n```\n\nAlso note, you set no activation to last layer, so you'll get logit (not prob score); adjust your metrics accordingly.\n    \n",
      "replies": [
        {
          "id": 2065575,
          "postDate": "2022-12-14T20:45:06.373Z",
          "content": "<p>Thank you <a href=\"https://www.kaggle.com/ipythonx\" target=\"_blank\">@ipythonx</a>  the point on repeat() was the issue. ill also have a look at the other points.<br>\nMuch appreciated</p>",
          "rawMarkdown": "Thank you @ipythonx  the point on repeat() was the issue. ill also have a look at the other points.\nMuch appreciated"
        }
      ]
    },
    {
      "id": 2065442,
      "postDate": "2022-12-14T16:54:48.450Z",
      "content": "<p>Hi all</p>\n<p>I hope somone can help, I cant seem to  figure out why the notebook stops during training on the 1st epoch</p>\n<p>The notebook runs for a few minutes, gets to epoch 1 and stops <br>\nThe kernel run shows as succesful but the rest of the notebook hasnt executed<br>\n<a href=\"https://postimg.cc/YLHdR4Ks\" target=\"_blank\"><img src=\"https://i.postimg.cc/Bb8RqDh4/Capture.jpg\" alt=\"Capture.jpg\"></a></p>\n<p><a href=\"https://postimg.cc/2VNs967m\" target=\"_blank\"><img src=\"https://i.postimg.cc/bNZqJSGG/Capture2.jpg\" alt=\"Capture2.jpg\"></a></p>\n<p>Any help is appreciated<br>\n<a href=\"https://www.kaggle.com/slythe/rsna-keras-resnet-modelling\" target=\"_blank\">Notebook is here</a></p>",
      "rawMarkdown": "Hi all\n\nI hope somone can help, I cant seem to  figure out why the notebook stops during training on the 1st epoch\n\nThe notebook runs for a few minutes, gets to epoch 1 and stops \nThe kernel run shows as succesful but the rest of the notebook hasnt executed\n[![Capture.jpg](https://i.postimg.cc/Bb8RqDh4/Capture.jpg)](https://postimg.cc/YLHdR4Ks)\n\n[![Capture2.jpg](https://i.postimg.cc/bNZqJSGG/Capture2.jpg)](https://postimg.cc/2VNs967m)\n\nAny help is appreciated\n[Notebook is here](https://www.kaggle.com/slythe/rsna-keras-resnet-modelling)"
    }
  ],
  "comments": [
    {
      "id": 2065562,
      "author_name": "Innat",
      "author_url": "",
      "post_date": "2022-12-14T20:15:07.757000",
      "content": "<p>Some pointer</p>\n<ul>\n<li> Check: <a href=\"https://keras.io/guides/preprocessing_layers/\" target=\"_blank\">https://keras.io/guides/preprocessing_layers/</a></li>\n</ul>\n<p><img src=\"https://user-images.githubusercontent.com/17668390/208264848-df826565-fcb6-425b-94d5-3cf07af66d72.png\" alt=\"image\"></p>\n<ul>\n<li>Rescaling, Resing can be added.</li>\n<li>If you use <code>.repeat()</code>, you might need to provde <code>step_per_epoch</code>.</li>\n<li>Removing <code>.cache()</code> and recheck.</li>\n</ul>\n<pre><code> strategy.scope():\n    ResNet = ResNet50(\n                  include_top=,\n                  input_shape=(RESIZE,RESIZE,),\n                  pooling = \n     )\n    ResNet.trainable = \n\n    model = Sequential(\n        [\n            layers.InputLayer(input_shape=(RESIZE,RESIZE,)),\n            ResNet,   \n            layers.Dense() \n        ]\n    )\n</code></pre>\n<p>Also note, you set no activation to last layer, so you'll get logit (not prob score); adjust your metrics accordingly.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2065575,
          "author_name": "Andrew Schleiss",
          "author_url": "",
          "post_date": "2022-12-14T20:45:06.373000",
          "content": "<p>Thank you <a href=\"https://www.kaggle.com/ipythonx\" target=\"_blank\">@ipythonx</a>  the point on repeat() was the issue. ill also have a look at the other points.<br>\nMuch appreciated</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2065562": "Some pointer\n\n- ~~Don't use augmentaiotn layer inside the model build while using TPU.~~ Check: https://keras.io/guides/preprocessing_layers/\n\n![image](https://user-images.githubusercontent.com/17668390/208264848-df826565-fcb6-425b-94d5-3cf07af66d72.png)\n\n\n\n- Rescaling, Resing can be added.\n- If you use `.repeat()`, you might need to provde `step_per_epoch`.\n- Removing `.cache()` and recheck.\n\n\n```python\nwith strategy.scope():\n    ResNet = ResNet50(\n                  include_top=False,\n                  input_shape=(RESIZE,RESIZE,3),\n                  pooling = 'avg'\n     )\n    ResNet.trainable = False\n    \n    model = Sequential(\n        [\n            layers.InputLayer(input_shape=(RESIZE,RESIZE,3)),\n            ResNet,   \n            layers.Dense(1) \n        ]\n    )\n```\n\nAlso note, you set no activation to last layer, so you'll get logit (not prob score); adjust your metrics accordingly.\n    \n",
    "2065442": "Hi all\n\nI hope somone can help, I cant seem to  figure out why the notebook stops during training on the 1st epoch\n\nThe notebook runs for a few minutes, gets to epoch 1 and stops \nThe kernel run shows as succesful but the rest of the notebook hasnt executed\n[![Capture.jpg](https://i.postimg.cc/Bb8RqDh4/Capture.jpg)](https://postimg.cc/YLHdR4Ks)\n\n[![Capture2.jpg](https://i.postimg.cc/bNZqJSGG/Capture2.jpg)](https://postimg.cc/2VNs967m)\n\nAny help is appreciated\n[Notebook is here](https://www.kaggle.com/slythe/rsna-keras-resnet-modelling)"
  }
}