{
  "id": 453097,
  "title": "Save Trained Mode and reuse it in another notebook",
  "url": "/competitions/UBC-OCEAN/discussion/453097",
  "author_name": "Onkur7",
  "post_date": "2023-11-04T20:43:28.243000",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Can someone tell me how to save a model after training and reuse it in another notebook?</p>",
  "messages": [
    {
      "id": 2513233,
      "postDate": "2023-11-05T09:59:25.617Z",
      "content": "<p>Save a version. When you name a file to save your model in, use just the file name without any path (full or relative).</p>\n<p>In the next notebook, click on Add Data and click on Your Notebooks to see your notebooks. Click on the <strong>+</strong> button on the notebook that saved your model. You should see your notebook listed under UBC-OCEAN under the <strong>Input</strong> section.</p>\n<p>To load your model, you'll need to use something like '/kaggle/input/' as the path leading to the filename that your model was saved in.</p>\n<p><a href=\"https://www.kaggle.com/code/jirkaborovec/cancer-subtype-lightning-torch-inference-tiles\" target=\"_blank\">https://www.kaggle.com/code/jirkaborovec/cancer-subtype-lightning-torch-inference-tiles</a> is a notebook that uses data from a previous notebook,  <a href=\"https://www.kaggle.com/code/jirkaborovec/cancer-subtype-tiles-w-lightning-timm-models\" target=\"_blank\">https://www.kaggle.com/code/jirkaborovec/cancer-subtype-tiles-w-lightning-timm-models</a>. If you look at the *<em>Input</em> section of the first one and compare it to *<em>Output</em>* section of the second one, you should see the same <em>image_classification_model.pt</em> file.</p>",
      "rawMarkdown": "Save a version. When you name a file to save your model in, use just the file name without any path (full or relative).\n\nIn the next notebook, click on Add Data and click on Your Notebooks to see your notebooks. Click on the **+** button on the notebook that saved your model. You should see your notebook listed under UBC-OCEAN under the **Input** section.\n\nTo load your model, you'll need to use something like '/kaggle/input/<your_notebook>' as the path leading to the filename that your model was saved in.\n\nhttps://www.kaggle.com/code/jirkaborovec/cancer-subtype-lightning-torch-inference-tiles is a notebook that uses data from a previous notebook,  https://www.kaggle.com/code/jirkaborovec/cancer-subtype-tiles-w-lightning-timm-models. If you look at the **Input* section of the first one and compare it to **Output** section of the second one, you should see the same *image_classification_model.pt* file.",
      "votes": 5,
      "replies": [
        {
          "id": 2513366,
          "postDate": "2023-11-05T12:01:30.623Z",
          "content": "<p>Thank you so much for the detailed explanation.</p>",
          "rawMarkdown": "Thank you so much for the detailed explanation."
        }
      ]
    },
    {
      "id": 2512798,
      "postDate": "2023-11-04T20:43:28.243Z",
      "content": "<p>Can someone tell me how to save a model after training and reuse it in another notebook?</p>",
      "rawMarkdown": "Can someone tell me how to save a model after training and reuse it in another notebook?",
      "votes": 2
    }
  ],
  "comments": [
    {
      "id": 2513233,
      "author_name": "Russ Tokuyama",
      "author_url": "",
      "post_date": "2023-11-05T09:59:25.617000",
      "content": "<p>Save a version. When you name a file to save your model in, use just the file name without any path (full or relative).</p>\n<p>In the next notebook, click on Add Data and click on Your Notebooks to see your notebooks. Click on the <strong>+</strong> button on the notebook that saved your model. You should see your notebook listed under UBC-OCEAN under the <strong>Input</strong> section.</p>\n<p>To load your model, you'll need to use something like '/kaggle/input/' as the path leading to the filename that your model was saved in.</p>\n<p><a href=\"https://www.kaggle.com/code/jirkaborovec/cancer-subtype-lightning-torch-inference-tiles\" target=\"_blank\">https://www.kaggle.com/code/jirkaborovec/cancer-subtype-lightning-torch-inference-tiles</a> is a notebook that uses data from a previous notebook,  <a href=\"https://www.kaggle.com/code/jirkaborovec/cancer-subtype-tiles-w-lightning-timm-models\" target=\"_blank\">https://www.kaggle.com/code/jirkaborovec/cancer-subtype-tiles-w-lightning-timm-models</a>. If you look at the *<em>Input</em> section of the first one and compare it to *<em>Output</em>* section of the second one, you should see the same <em>image_classification_model.pt</em> file.</p>",
      "votes": 5,
      "replies": [
        {
          "id": 2513366,
          "author_name": "Onkur7",
          "author_url": "",
          "post_date": "2023-11-05T12:01:30.623000",
          "content": "<p>Thank you so much for the detailed explanation.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2513233": "Save a version. When you name a file to save your model in, use just the file name without any path (full or relative).\n\nIn the next notebook, click on Add Data and click on Your Notebooks to see your notebooks. Click on the **+** button on the notebook that saved your model. You should see your notebook listed under UBC-OCEAN under the **Input** section.\n\nTo load your model, you'll need to use something like '/kaggle/input/<your_notebook>' as the path leading to the filename that your model was saved in.\n\nhttps://www.kaggle.com/code/jirkaborovec/cancer-subtype-lightning-torch-inference-tiles is a notebook that uses data from a previous notebook,  https://www.kaggle.com/code/jirkaborovec/cancer-subtype-tiles-w-lightning-timm-models. If you look at the **Input* section of the first one and compare it to **Output** section of the second one, you should see the same *image_classification_model.pt* file.",
    "2512798": "Can someone tell me how to save a model after training and reuse it in another notebook?"
  }
}