{
  "id": 535679,
  "title": "Using open source libraries or pre-trained model with internet disabled.",
  "url": "/competitions/ariel-data-challenge-2024/discussion/535679",
  "author_name": "Fabio",
  "post_date": "2024-09-23T15:23:37.782000",
  "votes": 1,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Hello dear Kagglers! <br>\nI have a question on how to use/download open source libraries not coming with kaggle environment or pre-trained models?</p>\n<p>Do you have a guide on this topic? Thank you. </p>",
  "messages": [
    {
      "id": 2996530,
      "postDate": "2024-09-23T15:35:15.553Z",
      "content": "<p>You need to do the below <a href=\"https://www.kaggle.com/faibioss\" target=\"_blank\">@faibioss</a> </p>\n<h3>Model files and pre-trained model objects</h3>\n<ol>\n<li>Create your models locally</li>\n<li>Make a Kaggle dataset and upload these models in there</li>\n<li>Import the dataset and use joblib to import these pickled files to your submission kernel</li>\n<li>Infer and predict the test data</li>\n</ol>\n<h3>Libraries</h3>\n<ul>\n<li>Download the necessary library/ libraries in a kaggle kernel/ dataset with internet on. The <code>.whl files</code> and required dependencies can be downloaded one-by-one/ using a <code>requirements.txt</code> file. The below code will help you-</li>\n</ul>\n<pre><code>%%writefile requirements.txt\npolars==\nscikit-learn==\nlightgbm==\n</code></pre>\n<p><code>!pip download -r requirements.txt -d /kaggle/working</code></p>\n<ul>\n<li>In a separate kernel, import the relevant packages with the below code-<br>\n<code>!pip install -q polars==1.7.1 --force-reinstall --no-index --find-links==&lt;your .whl file folder path&gt;</code></li>\n</ul>\n<p>Hope this helps <a href=\"https://www.kaggle.com/faibioss\" target=\"_blank\">@faibioss</a> </p>",
      "rawMarkdown": "You need to do the below @faibioss \n\n### Model files and pre-trained model objects\n\n1. Create your models locally\n2. Make a Kaggle dataset and upload these models in there\n3. Import the dataset and use joblib to import these pickled files to your submission kernel\n4. Infer and predict the test data\n\n### Libraries \n\n- Download the necessary library/ libraries in a kaggle kernel/ dataset with internet on. The `.whl files` and required dependencies can be downloaded one-by-one/ using a `requirements.txt` file. The below code will help you-\n\n```python\n%%writefile requirements.txt\npolars==1.7.1\nscikit-learn==1.4.2\nlightgbm==4.5.0\n```\n\n`!pip download -r requirements.txt -d /kaggle/working`\n\n- In a separate kernel, import the relevant packages with the below code-\n`!pip install -q polars==1.7.1 --force-reinstall --no-index --find-links==<your .whl file folder path>`\n\nHope this helps @faibioss ",
      "votes": 3,
      "replies": [
        {
          "id": 2996532,
          "postDate": "2024-09-23T15:37:07.433Z",
          "content": "<p>Thank you so much. I will try as soon as possible.</p>",
          "rawMarkdown": "Thank you so much. I will try as soon as possible.",
          "votes": 1
        },
        {
          "id": 3001385,
          "postDate": "2024-09-28T19:30:30.203Z",
          "content": "<p>It turns out /kaggle/working can't be seen during submission phase. I tried other notebooks which use astropy and they work, but can't use notebook written from scratch as astropy is not found. Tried to download the lib like in your instruction, but looks like the folders are not mounted during submission run.</p>\n<p>Do you know any way to add libraries or model weights to use during submission?</p>",
          "rawMarkdown": "It turns out /kaggle/working can't be seen during submission phase. I tried other notebooks which use astropy and they work, but can't use notebook written from scratch as astropy is not found. Tried to download the lib like in your instruction, but looks like the folders are not mounted during submission run.\n\nDo you know any way to add libraries or model weights to use during submission?",
          "replies": [
            {
              "id": 3001929,
              "postDate": "2024-09-29T12:57:29.397Z",
              "content": "<p><a href=\"https://www.kaggle.com/hellmetler\" target=\"_blank\">@hellmetler</a> If you created a dataset, it should be in <code>/kaggle/input</code> instead of <code>/kaggle/working</code>?</p>",
              "rawMarkdown": "@hellmetler If you created a dataset, it should be in `/kaggle/input` instead of `/kaggle/working`?",
              "votes": 1
            },
            {
              "id": 3007460,
              "postDate": "2024-10-05T11:59:54.003Z",
              "content": "<p>You are right, thank you!</p>",
              "rawMarkdown": "You are right, thank you!"
            }
          ]
        }
      ]
    },
    {
      "id": 2996519,
      "postDate": "2024-09-23T15:23:37.783Z",
      "content": "<p>Hello dear Kagglers! <br>\nI have a question on how to use/download open source libraries not coming with kaggle environment or pre-trained models?</p>\n<p>Do you have a guide on this topic? Thank you. </p>",
      "rawMarkdown": "Hello dear Kagglers! \nI have a question on how to use/download open source libraries not coming with kaggle environment or pre-trained models?\n\nDo you have a guide on this topic? Thank you. ",
      "votes": 1
    }
  ],
  "comments": [
    {
      "id": 2996530,
      "author_name": "Ravi Ramakrishnan",
      "author_url": "",
      "post_date": "2024-09-23T15:35:15.553000",
      "content": "<p>You need to do the below <a href=\"https://www.kaggle.com/faibioss\" target=\"_blank\">@faibioss</a> </p>\n<h3>Model files and pre-trained model objects</h3>\n<ol>\n<li>Create your models locally</li>\n<li>Make a Kaggle dataset and upload these models in there</li>\n<li>Import the dataset and use joblib to import these pickled files to your submission kernel</li>\n<li>Infer and predict the test data</li>\n</ol>\n<h3>Libraries</h3>\n<ul>\n<li>Download the necessary library/ libraries in a kaggle kernel/ dataset with internet on. The <code>.whl files</code> and required dependencies can be downloaded one-by-one/ using a <code>requirements.txt</code> file. The below code will help you-</li>\n</ul>\n<pre><code>%%writefile requirements.txt\npolars==\nscikit-learn==\nlightgbm==\n</code></pre>\n<p><code>!pip download -r requirements.txt -d /kaggle/working</code></p>\n<ul>\n<li>In a separate kernel, import the relevant packages with the below code-<br>\n<code>!pip install -q polars==1.7.1 --force-reinstall --no-index --find-links==&lt;your .whl file folder path&gt;</code></li>\n</ul>\n<p>Hope this helps <a href=\"https://www.kaggle.com/faibioss\" target=\"_blank\">@faibioss</a> </p>",
      "votes": 3,
      "replies": [
        {
          "id": 2996532,
          "author_name": "Fabio",
          "author_url": "",
          "post_date": "2024-09-23T15:37:07.433000",
          "content": "<p>Thank you so much. I will try as soon as possible.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 3001385,
          "author_name": "Pavel Kuzmin",
          "author_url": "",
          "post_date": "2024-09-28T19:30:30.203000",
          "content": "<p>It turns out /kaggle/working can't be seen during submission phase. I tried other notebooks which use astropy and they work, but can't use notebook written from scratch as astropy is not found. Tried to download the lib like in your instruction, but looks like the folders are not mounted during submission run.</p>\n<p>Do you know any way to add libraries or model weights to use during submission?</p>",
          "votes": 0,
          "replies": [
            {
              "id": 3001929,
              "author_name": "ChingYinNg",
              "author_url": "",
              "post_date": "2024-09-29T12:57:29.397000",
              "content": "<p><a href=\"https://www.kaggle.com/hellmetler\" target=\"_blank\">@hellmetler</a> If you created a dataset, it should be in <code>/kaggle/input</code> instead of <code>/kaggle/working</code>?</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 3007460,
              "author_name": "Pavel Kuzmin",
              "author_url": "",
              "post_date": "2024-10-05T11:59:54.003000",
              "content": "<p>You are right, thank you!</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2996530": "You need to do the below @faibioss \n\n### Model files and pre-trained model objects\n\n1. Create your models locally\n2. Make a Kaggle dataset and upload these models in there\n3. Import the dataset and use joblib to import these pickled files to your submission kernel\n4. Infer and predict the test data\n\n### Libraries \n\n- Download the necessary library/ libraries in a kaggle kernel/ dataset with internet on. The `.whl files` and required dependencies can be downloaded one-by-one/ using a `requirements.txt` file. The below code will help you-\n\n```python\n%%writefile requirements.txt\npolars==1.7.1\nscikit-learn==1.4.2\nlightgbm==4.5.0\n```\n\n`!pip download -r requirements.txt -d /kaggle/working`\n\n- In a separate kernel, import the relevant packages with the below code-\n`!pip install -q polars==1.7.1 --force-reinstall --no-index --find-links==<your .whl file folder path>`\n\nHope this helps @faibioss ",
    "2996519": "Hello dear Kagglers! \nI have a question on how to use/download open source libraries not coming with kaggle environment or pre-trained models?\n\nDo you have a guide on this topic? Thank you. "
  }
}