{
  "id": 396112,
  "title": "Error in loading torch models [SOLVED]",
  "url": "/competitions/predict-student-performance-from-game-play/discussion/396112",
  "author_name": "Minh Tri Phan",
  "post_date": "2023-03-20T11:13:54.196000",
  "votes": 2,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Hi everyone, I am trying a NN model for this competition, however, when loading the model (trained on GPU) to the environment (CPU-only), I got a weird error.</p>\n<pre><code>ckp = torch.load(PATH, map_location = torch.device())\n\nAttributeError: Can_unpickle_blockpandas._libs.internals/opt/conda/lib/python3/site-packages/pandas/_libs/internals.cpython-37m-x86_64-linux-gnu.so</code></pre>\n<p>Anyway to workaround this issue, given we can't use the Internet to update pandas, is much appreciated? Thank you!</p>\n<p>Updated: I stored also the OOF file in the pytorch checkpoint, getting rid of it solves the problem.</p>",
  "messages": [
    {
      "id": 2189270,
      "postDate": "2023-03-20T11:13:54.197Z",
      "content": "<p>Hi everyone, I am trying a NN model for this competition, however, when loading the model (trained on GPU) to the environment (CPU-only), I got a weird error.</p>\n<pre><code>ckp = torch.load(PATH, map_location = torch.device())\n\nAttributeError: Can_unpickle_blockpandas._libs.internals/opt/conda/lib/python3/site-packages/pandas/_libs/internals.cpython-37m-x86_64-linux-gnu.so</code></pre>\n<p>Anyway to workaround this issue, given we can't use the Internet to update pandas, is much appreciated? Thank you!</p>\n<p>Updated: I stored also the OOF file in the pytorch checkpoint, getting rid of it solves the problem.</p>",
      "rawMarkdown": "Hi everyone, I am trying a NN model for this competition, however, when loading the model (trained on GPU) to the environment (CPU-only), I got a weird error.\n\n```python\nckp = torch.load(PATH, map_location = torch.device('cpu'))\n\nAttributeError: Can't get attribute '_unpickle_block' on <module 'pandas._libs.internals' from '/opt/conda/lib/python3.7/site-packages/pandas/_libs/internals.cpython-37m-x86_64-linux-gnu.so'>\n```\n\nAnyway to workaround this issue, given we can't use the Internet to update pandas, is much appreciated? Thank you!\n\nUpdated: I stored also the OOF file in the pytorch checkpoint, getting rid of it solves the problem.",
      "votes": 2
    },
    {
      "id": 2226902,
      "postDate": "2023-04-19T10:41:18.130Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 2226902,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-04-19T10:41:18.130000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2189270": "Hi everyone, I am trying a NN model for this competition, however, when loading the model (trained on GPU) to the environment (CPU-only), I got a weird error.\n\n```python\nckp = torch.load(PATH, map_location = torch.device('cpu'))\n\nAttributeError: Can't get attribute '_unpickle_block' on <module 'pandas._libs.internals' from '/opt/conda/lib/python3.7/site-packages/pandas/_libs/internals.cpython-37m-x86_64-linux-gnu.so'>\n```\n\nAnyway to workaround this issue, given we can't use the Internet to update pandas, is much appreciated? Thank you!\n\nUpdated: I stored also the OOF file in the pytorch checkpoint, getting rid of it solves the problem.",
    "2226902": ""
  }
}