> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/de/loslegen/install/vs-code.md).

# Wie man LLMs in VS Code mit Unsloth- & Colab-GPUs feinabstimmt

Leitfaden zur direkten Feinabstimmung von Modellen in Visual Studio Code über Unsloth und Google Colab.

Sie können LLMs jetzt direkt aus Visual Studio Code (VS Code) heraus feinabstimmen, entweder lokal oder mithilfe der Google-Colab-Erweiterung. In dieser Anleitung erfahren Sie, wie Sie das Open-Source-Trainings [repository Unsloth](https://github.com/unslothai/unsloth)verwenden, um ein beliebiges [Fine-Tuning-Notebook](https://unsloth.ai/docs/de/loslegen/unsloth-notebooks.md) in VS Code mit einer Colab-Laufzeit zu verbinden, sodass Sie auf Ihrer lokalen GPU oder einer kostenlosen Colab-GPU trainieren können. Unser Video-Tutorial finden Sie auch [hier](#video-tutorial).

{% stepper %}
{% step %}

### Tutorial zu VS Code und Colab:

Für den Einstieg benötigen Sie:

* Installiertes [VS Code](https://code.visualstudio.com/). Git (zum Klonen des Notebook-Repositorys) sollte standardmäßig installiert sein.
* Ein **Google-Konto** (zur Authentifizierung bei Colab)
* Empfohlen: **Jupyter** Erweiterung (in den meisten VS-Code-Installationen bereits vorhanden)
  {% endstep %}

{% step %}

#### Colab-Erweiterung in VS Code installieren

1. Öffnen Sie **Erweiterungen** in VS Code (`Ctrl+Shift+X` / `Cmd+Shift+X`)
2. Suchen Sie nach **„Colab“** und installieren Sie die **Google Colab** Erweiterung

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FnITq5t7dffCUGSW2EVsm%2Fcolab_img_1.optimized.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Ein Unsloth-Notebook öffnen

1. Klonen Sie das Unsloth [Notebook-Repository](https://github.com/unslothai/notebooks):

```bash
git clone https://github.com/unslothai/notebooks
cd notebooks/nb
```

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FwRL8pvgtLRpz5rcmS6vy%2FScreenshot%202026-02-18%20at%206.29.16%E2%80%AFPM.png?alt=media&amp;token=7a72c2ec-6f94-4015-8355-27e76ba9b974" alt="" width="375"><figcaption></figcaption></figure>

2. Öffnen Sie das gewünschte Notebook. Unsloth unterstützt die meisten Modelle, darunter [Embedding](https://unsloth.ai/docs/de/grundlagen/embedding-finetuning.md), [TTS](https://unsloth.ai/docs/de/grundlagen/text-to-speech-tts-fine-tuning.md). Als Beispiel verwenden wir Qwen3-4B RL: `nb/Qwen3_(4B)-GRPO.ipynb`

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FVBqwvArAyclTQjb7YL5I%2Fcolab_img_2.optimized.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Einen Kernel und Colab auswählen

Klicken Sie in der Symbolleiste des Notebooks auf **Kernel auswählen**und wählen Sie dann **Colab**

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FleGtAKSVehrlspPGvDy2%2Fcolab_img_3.png?alt=media&amp;token=ba3d8f1d-9cbb-44ed-8e52-8d0e52280607" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Einen neuen Colab-Server hinzufügen

Nachdem Sie **Colab**ausgewählt haben, sehen Sie ein Dropdown-Menü mit Serveroptionen.

1. Klicken Sie auf **+ Neuen Colab-Server hinzufügen**
2. Beim ersten Mal wird möglicherweise ein Browserfenster zur Google-Authentifizierung geöffnet
   * Melde dich an, gewähre den Zugriff und kehre dann zu VS Code zurück

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FZcDsB2i0aUStIKEeFTvF%2Fcolab_img_4.png?alt=media&amp;token=a7c3642f-db35-4215-933f-99c17ebc92a2" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Wähle eine GPU aus und benenne den Server

1. Setze **Hardwarebeschleuniger** auf **GPU**
2. Wähle einen GPU-Typ aus (zum Beispiel **T4**, falls verfügbar)
3. Gib dem Server einen Namen (wie du möchtest)

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FLuK8oheihdCNn9MAZSlk%2Fcolab_img_5.png?alt=media&amp;token=e5ed396f-afe2-4c09-b1b8-120c7301793c" alt="" width="375"><figcaption></figcaption></figure>

{% hint style="info" %}
Hinweis: Die Verfügbarkeit von GPUs hängt von deinem Colab-Tarif und der aktuellen Kapazität ab. Wenn keine GPU-Optionen angezeigt werden, findest du unten Tipps zur Fehlerbehebung.
{% endhint %}
{% endstep %}

{% step %}

#### Wähle den Python-Kernel aus

Sobald du mit dem Colab-Server verbunden bist, wähle den **Python** Kernel aus, der für diese Laufzeitumgebung angezeigt wird (normalerweise ein Python-3-Kernel).

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FBexUiXJ7LRFBXs95tX2S%2Fcolab_img_6.png?alt=media&amp;token=391e343d-d2fa-4a77-8e3f-ef244adfcb4c" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Führe das Notebook aus

* Klicke auf **Alle ausführen** in der Notebook-Symbolleiste (oder führe die Zellen von oben nach unten aus)
* Beobachte, wie die Setup-Zellen die Abhängigkeiten installieren und anschließend den Unsloth-Workflow starten
* Weitere Informationen zum Einstieg in Unsloth findest du in unseren speziellen Anleitungen zum [Fine-Tuning](https://unsloth.ai/docs/de/loslegen/fine-tuning-llms-guide.md) oder [bestärkenden Lernen](https://unsloth.ai/docs/de/loslegen/reinforcement-learning-rl-guide.md) .
  {% endstep %}
  {% endstepper %}

### Videoanleitung

{% embed url="<https://youtu.be/5NNggTrEWNQ>" %}

### Fehlerbehebung

#### Nach der Trennung der Colab-Serververbindung läuft das Notebook auf einem neuen Server nicht mehr

**Was passiert:**\
Wenn das Notebook geöffnet bleibt, während die Verbindung zum Colab-Server getrennt wird, kann VS Code nach der erneuten Verbindung in einem fehlerhaften Kernel-/Laufzeitzustand hängen bleiben. Zugehöriges [GitHub-Issue](https://github.com/googlecolab/colab-vscode/issues/200).

**Lösung:** Schließe den Notebook-Tab vollständig und öffne das Notebook erneut.

#### Du kannst keine GPU auswählen (nur CPU wird angezeigt)

Mögliche Ursachen und Lösungen:

* **Kapazität des kostenlosen Colab-Tarifs:** GPUs sind möglicherweise vorübergehend nicht verfügbar → Versuche es später erneut.
* **Keine Verbindung zu einer Colab-Laufzeitumgebung:** Überprüfe erneut **Kernel auswählen → Colab** und stelle sicher, dass ein Colab-Server aktiv ist.
* **Einschränkungen oder Limits für Konto bzw. Region erreicht:** Möglicherweise musst du warten oder ein anderes Google-Konto bzw. einen anderen Tarif verwenden.

#### Alles hat funktioniert, aber nach der erneuten Verbindung sind die Pakete „verschwunden“

Colab-Laufzeitumgebungen sind **flüchtig**. Nach einem Serverneustart musst du normalerweise die Setup-/Installationszellen erneut ausführen (oft die ersten paar Zellen im Notebook).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/de/loslegen/install/vs-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
