{
  "id": 559814,
  "title": "Unhandled Error in Notebook During Code Rerun – Debugging Tips Needed",
  "url": "/competitions/czii-cryo-et-object-identification/discussion/559814",
  "author_name": "",
  "post_date": "2025-01-27T21:37:51.207138600Z",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>\"While rerunning my notebook, I encountered the following error:<br>\nYour notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset. See more debugging tips.</p>\n<p>I'm unsure how to resolve this issue, especially since the hidden dataset may differ from the public one. Could anyone guide me on:</p>\n<p>Common causes for this type of error when working with potentially different dataset sizes or structures?<br>\nBest practices for debugging in this scenario?<br>\nAny specific checks or adjustments to make my code more robust for the hidden dataset?<br>\nAny help is appreciated!\"</p>",
  "messages": [
    {
      "id": "3108632",
      "postDate": "01/27/2025 21:37:51",
      "content": "<p>\"While rerunning my notebook, I encountered the following error:<br>\nYour notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset. See more debugging tips.</p>\n<p>I'm unsure how to resolve this issue, especially since the hidden dataset may differ from the public one. Could anyone guide me on:</p>\n<p>Common causes for this type of error when working with potentially different dataset sizes or structures?<br>\nBest practices for debugging in this scenario?<br>\nAny specific checks or adjustments to make my code more robust for the hidden dataset?<br>\nAny help is appreciated!\"</p>",
      "rawMarkdown": "\"While rerunning my notebook, I encountered the following error:\nYour notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset. See more debugging tips.\n\nI'm unsure how to resolve this issue, especially since the hidden dataset may differ from the public one. Could anyone guide me on:\n\nCommon causes for this type of error when working with potentially different dataset sizes or structures?\nBest practices for debugging in this scenario?\nAny specific checks or adjustments to make my code more robust for the hidden dataset?\nAny help is appreciated!\"",
      "votes": null
    },
    {
      "id": "3108636",
      "postDate": "01/27/2025 21:44:07",
      "content": "<p>If your script works offline: adapt it to run through 500 test sets instead of 3 (by just repeating the 3 sets several times), and see if it still works. That usually finds the issue for me.</p>",
      "rawMarkdown": "If your script works offline: adapt it to run through 500 test sets instead of 3 (by just repeating the 3 sets several times), and see if it still works. That usually finds the issue for me.",
      "votes": null
    },
    {
      "id": "3108638",
      "postDate": "01/27/2025 22:04:55",
      "content": "<p>It is hard to tell without seeing your code, however, are there any steps in your inference notebook that are hardcoded such as experiment names or where an index could go out of bounds due to the higher number of files?  For example, if you are expecting 3 results (for the 3 validation experiments), and allocate a data structure for a fixed number of files, but then get a lot more it could cause this.  </p>\n<p>I know this isn't very helpful and I am happy to take a look at your notebook if you'd like but my first thought goes to the questions \"What changes between the submission run and our run\" which is the number of files and then \"What could the number of files have to do with my notebook throwing an error that is not related to memory (it would say out of memory error if this was the case)\" which leads me to believe something may be hardcoded for a static number of experiments.</p>\n<p>For debugging, my recommendation is to add try/catch blocks in your notebook at different spots and create multiple submissions until you figure out what caused it.  For example, making one submissions for \"putting try catch around imports\" and another for \"putting try catch around dataset creation\" and when you get a submission that does not fail you will know which area is causing the problem.</p>\n<p>Other than that my last recommendation is compare your submission notebook to one of the public ones and find differences that could be causing an error.</p>",
      "rawMarkdown": "It is hard to tell without seeing your code, however, are there any steps in your inference notebook that are hardcoded such as experiment names or where an index could go out of bounds due to the higher number of files?  For example, if you are expecting 3 results (for the 3 validation experiments), and allocate a data structure for a fixed number of files, but then get a lot more it could cause this.  \n\nI know this isn't very helpful and I am happy to take a look at your notebook if you'd like but my first thought goes to the questions \"What changes between the submission run and our run\" which is the number of files and then \"What could the number of files have to do with my notebook throwing an error that is not related to memory (it would say out of memory error if this was the case)\" which leads me to believe something may be hardcoded for a static number of experiments.\n\nFor debugging, my recommendation is to add try/catch blocks in your notebook at different spots and create multiple submissions until you figure out what caused it.  For example, making one submissions for \"putting try catch around imports\" and another for \"putting try catch around dataset creation\" and when you get a submission that does not fail you will know which area is causing the problem.\n\nOther than that my last recommendation is compare your submission notebook to one of the public ones and find differences that could be causing an error.",
      "votes": null
    },
    {
      "id": "3108640",
      "postDate": "01/27/2025 22:06:36",
      "content": "<p>Absolutely this!  Can also help by creating a fake experiment name on each rerun (instead of TS_5_4 do TS_50_40) just to make sure you don't have a dictionary key issue or something like that.</p>",
      "rawMarkdown": "Absolutely this!  Can also help by creating a fake experiment name on each rerun (instead of TS_5_4 do TS_50_40) just to make sure you don't have a dictionary key issue or something like that.",
      "votes": null
    },
    {
      "id": "3108711",
      "postDate": "01/28/2025 01:41:59",
      "content": "<p>Try/Catch block definitely.  You might also check this post to see if it applies:</p>\n<p><a href=\"https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252\" target=\"_blank\">https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252</a></p>\n<p>Also you might print out the names of all the files you <strong>think</strong> you're opening to make sure your not accidentally looking in the training directory instead of the test directory.  I blew up a bunch of submissions on that one.</p>\n<p>Running out of memory is likely another common problem.  Running the same file 100 times will make that one clear.</p>",
      "rawMarkdown": "Try/Catch block definitely.  You might also check this post to see if it applies:\n\n[https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252](https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252)\n\nAlso you might print out the names of all the files you **think** you're opening to make sure your not accidentally looking in the training directory instead of the test directory.  I blew up a bunch of submissions on that one.\n\nRunning out of memory is likely another common problem.  Running the same file 100 times will make that one clear.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3108636,
      "author_name": "jeroencottaar",
      "author_url": "",
      "post_date": "01/27/2025 21:44:07",
      "content": "<p>If your script works offline: adapt it to run through 500 test sets instead of 3 (by just repeating the 3 sets several times), and see if it still works. That usually finds the issue for me.</p>",
      "votes": null,
      "replies": [
        {
          "id": 3108640,
          "author_name": "connorjd",
          "author_url": "",
          "post_date": "01/27/2025 22:06:36",
          "content": "<p>Absolutely this!  Can also help by creating a fake experiment name on each rerun (instead of TS_5_4 do TS_50_40) just to make sure you don't have a dictionary key issue or something like that.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 3108638,
      "author_name": "connorjd",
      "author_url": "",
      "post_date": "01/27/2025 22:04:55",
      "content": "<p>It is hard to tell without seeing your code, however, are there any steps in your inference notebook that are hardcoded such as experiment names or where an index could go out of bounds due to the higher number of files?  For example, if you are expecting 3 results (for the 3 validation experiments), and allocate a data structure for a fixed number of files, but then get a lot more it could cause this.  </p>\n<p>I know this isn't very helpful and I am happy to take a look at your notebook if you'd like but my first thought goes to the questions \"What changes between the submission run and our run\" which is the number of files and then \"What could the number of files have to do with my notebook throwing an error that is not related to memory (it would say out of memory error if this was the case)\" which leads me to believe something may be hardcoded for a static number of experiments.</p>\n<p>For debugging, my recommendation is to add try/catch blocks in your notebook at different spots and create multiple submissions until you figure out what caused it.  For example, making one submissions for \"putting try catch around imports\" and another for \"putting try catch around dataset creation\" and when you get a submission that does not fail you will know which area is causing the problem.</p>\n<p>Other than that my last recommendation is compare your submission notebook to one of the public ones and find differences that could be causing an error.</p>",
      "votes": null,
      "replies": [
        {
          "id": 3108711,
          "author_name": "davidlist",
          "author_url": "",
          "post_date": "01/28/2025 01:41:59",
          "content": "<p>Try/Catch block definitely.  You might also check this post to see if it applies:</p>\n<p><a href=\"https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252\" target=\"_blank\">https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252</a></p>\n<p>Also you might print out the names of all the files you <strong>think</strong> you're opening to make sure your not accidentally looking in the training directory instead of the test directory.  I blew up a bunch of submissions on that one.</p>\n<p>Running out of memory is likely another common problem.  Running the same file 100 times will make that one clear.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3108632": "\"While rerunning my notebook, I encountered the following error:\nYour notebook hit an unhandled error while rerunning your code. Note that the hidden dataset can be larger/smaller/different than the public dataset. See more debugging tips.\n\nI'm unsure how to resolve this issue, especially since the hidden dataset may differ from the public one. Could anyone guide me on:\n\nCommon causes for this type of error when working with potentially different dataset sizes or structures?\nBest practices for debugging in this scenario?\nAny specific checks or adjustments to make my code more robust for the hidden dataset?\nAny help is appreciated!\"",
    "3108636": "If your script works offline: adapt it to run through 500 test sets instead of 3 (by just repeating the 3 sets several times), and see if it still works. That usually finds the issue for me.",
    "3108638": "It is hard to tell without seeing your code, however, are there any steps in your inference notebook that are hardcoded such as experiment names or where an index could go out of bounds due to the higher number of files?  For example, if you are expecting 3 results (for the 3 validation experiments), and allocate a data structure for a fixed number of files, but then get a lot more it could cause this.  \n\nI know this isn't very helpful and I am happy to take a look at your notebook if you'd like but my first thought goes to the questions \"What changes between the submission run and our run\" which is the number of files and then \"What could the number of files have to do with my notebook throwing an error that is not related to memory (it would say out of memory error if this was the case)\" which leads me to believe something may be hardcoded for a static number of experiments.\n\nFor debugging, my recommendation is to add try/catch blocks in your notebook at different spots and create multiple submissions until you figure out what caused it.  For example, making one submissions for \"putting try catch around imports\" and another for \"putting try catch around dataset creation\" and when you get a submission that does not fail you will know which area is causing the problem.\n\nOther than that my last recommendation is compare your submission notebook to one of the public ones and find differences that could be causing an error.",
    "3108640": "Absolutely this!  Can also help by creating a fake experiment name on each rerun (instead of TS_5_4 do TS_50_40) just to make sure you don't have a dictionary key issue or something like that.",
    "3108711": "Try/Catch block definitely.  You might also check this post to see if it applies:\n\n[https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252](https://www.kaggle.com/competitions/czii-cryo-et-object-identification/discussion/554252)\n\nAlso you might print out the names of all the files you **think** you're opening to make sure your not accidentally looking in the training directory instead of the test directory.  I blew up a bunch of submissions on that one.\n\nRunning out of memory is likely another common problem.  Running the same file 100 times will make that one clear."
  },
  "source": "meta"
}