How to Fine-tune LLMs in VS Code with Unsloth & Colab GPUs
Guide to fine-tuning models directly in Visual Studio Code via Unsloth and Google Colab.
Last updated
Was this helpful?
Guide to fine-tuning models directly in Visual Studio Code via Unsloth and Google Colab.
You can now fine-tune LLMs directly from Visual Studio Code (VSCode), locally or by using Google Colab's extension. In this guide, you’ll learn how to use the open-source training repo: Unsloth, to connect any fine-tuning notebook in VS Code to a Colab runtime, so you can train on your local or free Colab GPU. You can also view our video tutorial here.
To begin we will need to have:
Installed VS Code. Git (for cloning the notebook repo) should be installed by default.
A Google account (to authenticate with Colab)
Recommended: Jupyter extension (most VS Code setups already have it)
Clone the Unsloth notebooks repository:
git clone https://github.com/unslothai/notebooks
cd notebooks/nb

Click Run All in the notebook toolbar (or run cells top-to-bottom)
Watch the setup cells install dependencies and then start the Unsloth workflow
You can view our dedicated fine-tuning or reinforcement learning guides for more info on exactly how to get started with Unsloth.
What’s happening: If the notebook stays open while the Colab server disconnects, VS Code can get stuck in a bad kernel/runtime state after reconnecting. Related GitHub issue.
Fix: Close the notebook tab completely and open the notebook again.
Possible causes and fixes:
Colab free tier capacity: GPUs may be temporarily unavailable → try again later.
Not actually connected to a Colab runtime: re-check Select Kernel → Colab and ensure a Colab server is active.
Account/region restrictions or limits reached: you may need to wait or use a different Google account / plan.
Colab runtimes are ephemeral. When a server restarts, you usually need to re-run the setup/install cells (often the first few cells in the notebook).
Last updated
Was this helpful?
Was this helpful?

