{
  "id": 490749,
  "title": "notebook submission error: cannot load model weights file",
  "url": "/competitions/hms-harmful-brain-activity-classification/discussion/490749",
  "author_name": "",
  "post_date": "2024-04-03T11:04:06.515910700Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>here is error output. I put model &amp; weights file under '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5'. I can load it myself on the notebook. But by submission and scoring, it failed. Can someone give a hint what is wrong? Should the file be put somewhere else?</p>\n<p><em>FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)</em></p>",
  "messages": [
    {
      "id": "2732838",
      "postDate": "04/03/2024 11:04:06",
      "content": "<p>here is error output. I put model &amp; weights file under '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5'. I can load it myself on the notebook. But by submission and scoring, it failed. Can someone give a hint what is wrong? Should the file be put somewhere else?</p>\n<p><em>FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)</em></p>",
      "rawMarkdown": "here is error output. I put model & weights file under '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5'. I can load it myself on the notebook. But by submission and scoring, it failed. Can someone give a hint what is wrong? Should the file be put somewhere else?\n\n*FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)*",
      "votes": null
    },
    {
      "id": "2732943",
      "postDate": "04/03/2024 12:31:43",
      "content": "<p>I assume you are generating that file in the same notebook. Then I ask… Why don't use the model directly instead of save and reload the weigths?</p>\n<p>EDIT: Sorry, there is many reasons for that. When training a CV on the fly for example. I had no problems with that on my experiments. Try to save and load without predefined working path. May be the hidden environment is not as the local. I did that way on my experiments.</p>\n<p>EDIT2:</p>\n<p>Just checked and no. I loaded from \"/kaggle/working/\" without problems. May be \".h5\" is not necessary?</p>\n<p>In my case</p>\n<p>HMS_models = [<br>\n    \"/kaggle/working/HMSmodel_0\",<br>\n    \"/kaggle/working/HMSmodel_1\",<br>\n    \"/kaggle/working/HMSmodel_2\",<br>\n    \"/kaggle/working/HMSmodel_3\",<br>\n    \"/kaggle/working/HMSmodel_4\"<br>\n]</p>\n<p>In any case the message is clear. Load can't find the file by the path provided. Check that you are providing the correct one and of course file is generated and saved at the same run. If you are trying to pass local saved weights cross working folder consider that one is replaced during hidden run. I f you want to pass pretrained weights you need to save them on a dataset.</p>",
      "rawMarkdown": "I assume you are generating that file in the same notebook. Then I ask... Why don't use the model directly instead of save and reload the weigths?\n\nEDIT: Sorry, there is many reasons for that. When training a CV on the fly for example. I had no problems with that on my experiments. Try to save and load without predefined working path. May be the hidden environment is not as the local. I did that way on my experiments.\n\nEDIT2:\n\nJust checked and no. I loaded from \"/kaggle/working/\" without problems. May be \".h5\" is not necessary?\n\nIn my case\n\nHMS_models = [\n    \"/kaggle/working/HMSmodel_0\",\n    \"/kaggle/working/HMSmodel_1\",\n    \"/kaggle/working/HMSmodel_2\",\n    \"/kaggle/working/HMSmodel_3\",\n    \"/kaggle/working/HMSmodel_4\"\n]\n\nIn any case the message is clear. Load can't find the file by the path provided. Check that you are providing the correct one and of course file is generated and saved at the same run. If you are trying to pass local saved weights cross working folder consider that one is replaced during hidden run. I f you want to pass pretrained weights you need to save them on a dataset.",
      "votes": null
    },
    {
      "id": "2733376",
      "postDate": "04/03/2024 15:59:56",
      "content": "<p>Hi Angel, thank you so much for your response. I put the .h5 file as a dataset as you suggested and the submission worked. Now I am anxiously waiting to see my score… This is my first competition😀</p>",
      "rawMarkdown": "Hi Angel, thank you so much for your response. I put the .h5 file as a dataset as you suggested and the submission worked. Now I am anxiously waiting to see my score... This is my first competition😀",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2732943,
      "author_name": "sacuscreed",
      "author_url": "",
      "post_date": "04/03/2024 12:31:43",
      "content": "<p>I assume you are generating that file in the same notebook. Then I ask… Why don't use the model directly instead of save and reload the weigths?</p>\n<p>EDIT: Sorry, there is many reasons for that. When training a CV on the fly for example. I had no problems with that on my experiments. Try to save and load without predefined working path. May be the hidden environment is not as the local. I did that way on my experiments.</p>\n<p>EDIT2:</p>\n<p>Just checked and no. I loaded from \"/kaggle/working/\" without problems. May be \".h5\" is not necessary?</p>\n<p>In my case</p>\n<p>HMS_models = [<br>\n    \"/kaggle/working/HMSmodel_0\",<br>\n    \"/kaggle/working/HMSmodel_1\",<br>\n    \"/kaggle/working/HMSmodel_2\",<br>\n    \"/kaggle/working/HMSmodel_3\",<br>\n    \"/kaggle/working/HMSmodel_4\"<br>\n]</p>\n<p>In any case the message is clear. Load can't find the file by the path provided. Check that you are providing the correct one and of course file is generated and saved at the same run. If you are trying to pass local saved weights cross working folder consider that one is replaced during hidden run. I f you want to pass pretrained weights you need to save them on a dataset.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2733376,
          "author_name": "paulhush",
          "author_url": "",
          "post_date": "04/03/2024 15:59:56",
          "content": "<p>Hi Angel, thank you so much for your response. I put the .h5 file as a dataset as you suggested and the submission worked. Now I am anxiously waiting to see my score… This is my first competition😀</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2732838": "here is error output. I put model & weights file under '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5'. I can load it myself on the notebook. But by submission and scoring, it failed. Can someone give a hint what is wrong? Should the file be put somewhere else?\n\n*FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = '/kaggle/working/saved_models/denseParell_val0p05_Acc62.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)*",
    "2732943": "I assume you are generating that file in the same notebook. Then I ask... Why don't use the model directly instead of save and reload the weigths?\n\nEDIT: Sorry, there is many reasons for that. When training a CV on the fly for example. I had no problems with that on my experiments. Try to save and load without predefined working path. May be the hidden environment is not as the local. I did that way on my experiments.\n\nEDIT2:\n\nJust checked and no. I loaded from \"/kaggle/working/\" without problems. May be \".h5\" is not necessary?\n\nIn my case\n\nHMS_models = [\n    \"/kaggle/working/HMSmodel_0\",\n    \"/kaggle/working/HMSmodel_1\",\n    \"/kaggle/working/HMSmodel_2\",\n    \"/kaggle/working/HMSmodel_3\",\n    \"/kaggle/working/HMSmodel_4\"\n]\n\nIn any case the message is clear. Load can't find the file by the path provided. Check that you are providing the correct one and of course file is generated and saved at the same run. If you are trying to pass local saved weights cross working folder consider that one is replaced during hidden run. I f you want to pass pretrained weights you need to save them on a dataset.",
    "2733376": "Hi Angel, thank you so much for your response. I put the .h5 file as a dataset as you suggested and the submission worked. Now I am anxiously waiting to see my score... This is my first competition😀"
  },
  "source": "meta"
}