{
  "id": 566131,
  "title": "torch-geometric and offline submissions",
  "url": "/competitions/stanford-rna-3d-folding/discussion/566131",
  "author_name": "",
  "post_date": "2025-03-03T23:43:31.495507600Z",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hi, first time trying out a competition, so I've got a nooby Kaggle question. I'm trying to use torch-geometric in a submission notebook, but I need to have internet disabled so I cant install via <code>!pip</code>. I've tried creating two separate notebooks for training and inference (is this a common Kaggle competition paradigm?) and using <code>torch.jit.save</code> to save and import the .pt model file, but I get <a href=\"https://github.com/pyg-team/pytorch_geometric/issues/8867\" target=\"_blank\">this error</a> when trying to use torch script with a GATConv layer… I've tried saving the model as a .pth/pickling, but that requires redefining the model class in the inference notebook (which therefore needs torch-geometric)?</p>\n<p>Thinking about writing/copying the GATconv layer, but wondering if there's an easier work around for utilizing torch geometric models in an offline nb?</p>",
  "messages": [
    {
      "id": "3139819",
      "postDate": "03/03/2025 23:43:31",
      "content": "<p>Hi, first time trying out a competition, so I've got a nooby Kaggle question. I'm trying to use torch-geometric in a submission notebook, but I need to have internet disabled so I cant install via <code>!pip</code>. I've tried creating two separate notebooks for training and inference (is this a common Kaggle competition paradigm?) and using <code>torch.jit.save</code> to save and import the .pt model file, but I get <a href=\"https://github.com/pyg-team/pytorch_geometric/issues/8867\" target=\"_blank\">this error</a> when trying to use torch script with a GATConv layer… I've tried saving the model as a .pth/pickling, but that requires redefining the model class in the inference notebook (which therefore needs torch-geometric)?</p>\n<p>Thinking about writing/copying the GATconv layer, but wondering if there's an easier work around for utilizing torch geometric models in an offline nb?</p>",
      "rawMarkdown": "Hi, first time trying out a competition, so I've got a nooby Kaggle question. I'm trying to use torch-geometric in a submission notebook, but I need to have internet disabled so I cant install via `!pip`. I've tried creating two separate notebooks for training and inference (is this a common Kaggle competition paradigm?) and using `torch.jit.save` to save and import the .pt model file, but I get [this error](https://github.com/pyg-team/pytorch_geometric/issues/8867) when trying to use torch script with a GATConv layer... I've tried saving the model as a .pth/pickling, but that requires redefining the model class in the inference notebook (which therefore needs torch-geometric)?\n\nThinking about writing/copying the GATconv layer, but wondering if there's an easier work around for utilizing torch geometric models in an offline nb?",
      "votes": null
    },
    {
      "id": "3139855",
      "postDate": "03/04/2025 00:35:24",
      "content": "<p>It is normal to separate training and inference. In fact, you can do training on your local computer, create a dataset that will hold a model, and do the inference from that dataset. It seems you already tried that, which is the right track.</p>\n<p>As to the internet, again create a Kaggle dataset, upload the wheels for packages of interest, and use pip to install from those local wheels. Something like this:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/competitions/llm-detect-ai-generated-text/discussion/455681\" target=\"_blank\">https://www.kaggle.com/competitions/llm-detect-ai-generated-text/discussion/455681</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hpa-single-cell-image-classification/discussion/215172\" target=\"_blank\">https://www.kaggle.com/competitions/hpa-single-cell-image-classification/discussion/215172</a></li>\n</ul>",
      "rawMarkdown": "It is normal to separate training and inference. In fact, you can do training on your local computer, create a dataset that will hold a model, and do the inference from that dataset. It seems you already tried that, which is the right track.\n\nAs to the internet, again create a Kaggle dataset, upload the wheels for packages of interest, and use pip to install from those local wheels. Something like this:\n\n- https://www.kaggle.com/competitions/llm-detect-ai-generated-text/discussion/455681\n- https://www.kaggle.com/competitions/hpa-single-cell-image-classification/discussion/215172",
      "votes": null
    },
    {
      "id": "3140131",
      "postDate": "03/04/2025 10:04:07",
      "content": "<p>You can install with pip under the dependency manager (see Install Dependencies in the menu), it's run before the notebook and it works with the internet disabled</p>",
      "rawMarkdown": "You can install with pip under the dependency manager (see Install Dependencies in the menu), it's run before the notebook and it works with the internet disabled",
      "votes": null
    },
    {
      "id": "3140303",
      "postDate": "03/04/2025 13:33:02",
      "content": "<p>Thanks! That makes sense, and ty for the links 👀</p>",
      "rawMarkdown": "Thanks! That makes sense, and ty for the links 👀",
      "votes": null
    },
    {
      "id": "3140304",
      "postDate": "03/04/2025 13:33:16",
      "content": "<p>Thanks! Will try this out</p>",
      "rawMarkdown": "Thanks! Will try this out",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3139855,
      "author_name": "tilii7",
      "author_url": "",
      "post_date": "03/04/2025 00:35:24",
      "content": "<p>It is normal to separate training and inference. In fact, you can do training on your local computer, create a dataset that will hold a model, and do the inference from that dataset. It seems you already tried that, which is the right track.</p>\n<p>As to the internet, again create a Kaggle dataset, upload the wheels for packages of interest, and use pip to install from those local wheels. Something like this:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/competitions/llm-detect-ai-generated-text/discussion/455681\" target=\"_blank\">https://www.kaggle.com/competitions/llm-detect-ai-generated-text/discussion/455681</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hpa-single-cell-image-classification/discussion/215172\" target=\"_blank\">https://www.kaggle.com/competitions/hpa-single-cell-image-classification/discussion/215172</a></li>\n</ul>",
      "votes": null,
      "replies": [
        {
          "id": 3140303,
          "author_name": "ubitquitin",
          "author_url": "",
          "post_date": "03/04/2025 13:33:02",
          "content": "<p>Thanks! That makes sense, and ty for the links 👀</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 3140131,
      "author_name": "eugenebaulin",
      "author_url": "",
      "post_date": "03/04/2025 10:04:07",
      "content": "<p>You can install with pip under the dependency manager (see Install Dependencies in the menu), it's run before the notebook and it works with the internet disabled</p>",
      "votes": null,
      "replies": [
        {
          "id": 3140304,
          "author_name": "ubitquitin",
          "author_url": "",
          "post_date": "03/04/2025 13:33:16",
          "content": "<p>Thanks! Will try this out</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3139819": "Hi, first time trying out a competition, so I've got a nooby Kaggle question. I'm trying to use torch-geometric in a submission notebook, but I need to have internet disabled so I cant install via `!pip`. I've tried creating two separate notebooks for training and inference (is this a common Kaggle competition paradigm?) and using `torch.jit.save` to save and import the .pt model file, but I get [this error](https://github.com/pyg-team/pytorch_geometric/issues/8867) when trying to use torch script with a GATConv layer... I've tried saving the model as a .pth/pickling, but that requires redefining the model class in the inference notebook (which therefore needs torch-geometric)?\n\nThinking about writing/copying the GATconv layer, but wondering if there's an easier work around for utilizing torch geometric models in an offline nb?",
    "3139855": "It is normal to separate training and inference. In fact, you can do training on your local computer, create a dataset that will hold a model, and do the inference from that dataset. It seems you already tried that, which is the right track.\n\nAs to the internet, again create a Kaggle dataset, upload the wheels for packages of interest, and use pip to install from those local wheels. Something like this:\n\n- https://www.kaggle.com/competitions/llm-detect-ai-generated-text/discussion/455681\n- https://www.kaggle.com/competitions/hpa-single-cell-image-classification/discussion/215172",
    "3140131": "You can install with pip under the dependency manager (see Install Dependencies in the menu), it's run before the notebook and it works with the internet disabled",
    "3140303": "Thanks! That makes sense, and ty for the links 👀",
    "3140304": "Thanks! Will try this out"
  },
  "source": "meta"
}