Skip to content

100+ Fine-tuning Tutorial Notebooks on Google Colab, Kaggle and more.

License

Notifications You must be signed in to change notification settings

unslothai/notebooks

Repository files navigation

📒 Fine-tuning Notebooks

Below are our notebooks for Google Colab categorized by model. You can view our Kaggle notebooks here.
Use our guided notebooks to prep data, train, evaluate, and save your model. View our main GitHub repo here.

Main Notebooks

Model Type Notebook Link
Gemma3N (4B) Multimodal Open in Colab
Qwen3 (14B) Conversational Open In Colab
Qwen3-Base (4B) GRPO Open In Colab
Gemma 3 (4B) Conversational Open In Colab
Llama 3.2 (3B) Conversational Open In Colab
Phi-4 (14B) Conversational Open In Colab
Llama 3.2 Vision (11B) Vision Open In Colab
Llama 3.1 (8B) Alpaca Open In Colab
Mistral v0.3 (7B) Conversational Open In Colab
DeepSeek-R1-0528-Qwen3 (8B) GRPO Open In Colab
Llama 3.2 (3B) by Meta Synthetic Data Open In Colab
Sesame-CSM (1B) TTS Open In Colab

GRPO & Reinforcement Learning Notebooks

Model Type Notebook Link
(A100) gpt oss (20B) GRPO Open In Colab
gpt oss (20B) GRPO Open In Colab
gpt oss (20B) GRPO Open In Colab
Phi 4 (14B) GRPO Open In Colab
Meta Synthetic Data Llama3.1 (8B) GRPO Open In Colab
Llama3.1 (8B) GRPO Open In Colab
Qwen3 (4B) GRPO Open In Colab
Meta Synthetic Data Llama3 2 (3B) GRPO Open In Colab
Gemma3 (1B) GRPO Open In Colab
Qwen2.5 (3B) GRPO Open In Colab
LFM2.5 (1.2B) GRPO Open In Colab
DeepSeek R1 0528 Qwen3 (8B) GRPO Open In Colab
Mistral v0.3 (7B) GRPO Open In Colab

Text-to-Speech (TTS) Notebooks

Model Type Notebook Link
Orpheus (3B) TTS Open In Colab
Llasa TTS (3B) TTS Open In Colab
Sesame CSM (1B) TTS Open In Colab
Oute TTS (1B) TTS Open In Colab
Llasa TTS (1B) TTS Open In Colab
Spark TTS (0.5B) TTS Open In Colab

Vision (Multimodal) Notebooks

Model Type Notebook Link
Pixtral (12B) Vision Open In Colab
ERNIE 4 5 VL 28B A3B PT Vision Open In Colab
Llama3.2 (11B) Vision Open In Colab
Qwen3 VL (8B) Vision Open In Colab
Qwen3 VL (8B) Vision GRPO Open In Colab
Ministral3 VL (3B) Vision Open In Colab
Gemma3N (4B) Vision Open In Colab
Gemma3 (4B) Vision Open In Colab
Gemma3 (4B) Vision GRPO Open In Colab
Qwen2.5 VL (7B) Vision Open In Colab
Qwen2.5 VL (7B) Vision GRPO Open In Colab
LFM2.5 VL (1.6B) Vision Open In Colab
Qwen2 VL (7B) Vision Open In Colab

Embedding Notebooks

Model Type Notebook Link
EmbeddingGemma (300M) Open In Colab
All MiniLM L6 v2 Open In Colab
Qwen3 Embedding (4B) Open In Colab
Qwen3 Embedding (0 6B) Open In Colab
BGE M3 Open In Colab
ModernBert Open In Colab
ModernBERT (Large) Classification Open In Colab

Speech-to-Text (STT) Notebooks

Model Type Notebook Link
Whisper (Large) Fine Tuning Open In Colab

OCR Notebooks

Model Type Notebook Link
Deepseek OCR (3B) Fine Tuning Open In Colab
Deepseek OCR (3B) Evaluation Open In Colab
Deepseek OCR (3B) Eval Open In Colab
Deepseek OCR 2 (3B) Open In Colab
Paddle OCR (1B) Vision Open In Colab

BERT Notebooks

Model Type Notebook Link
ModernBert Open In Colab
ModernBERT (Large) Classification Open In Colab

Deepseek Notebooks

Model Type Notebook Link
Deepseek OCR (3B) Fine Tuning Open In Colab
Deepseek OCR (3B) Evaluation Open In Colab
Deepseek OCR (3B) Eval Open In Colab
Deepseek OCR 2 (3B) Open In Colab

ERNIE Notebooks

Model Type Notebook Link
ERNIE 4 5 VL 28B A3B PT Vision Open In Colab
ERNIE 4 5 21B A3B PT Conversational Open In Colab

GLM Notebooks

Model Type Notebook Link
(A100) GLM Flash(80GB) Open In Colab

GPT-OSS Notebooks

Model Type Notebook Link
(A100) gpt oss (120B) Fine Tuning Open In Colab
gpt oss (20B) GRPO 2048 Open In Colab
gpt oss (20B) Fine Tuning Open In Colab
gpt oss (20B) Fine Tuning Open In Colab
gpt oss BNB (20B) Inference Open In Colab
(OpenEnv) gpt oss (20B) GRPO 2048 Open In Colab
(DGX Spark) gpt oss (20B) GRPO 2048 Open In Colab
gpt oss BF16 (20B) GRPO 2048 Open In Colab
(OpenEnv) gpt oss BF16 (20B) GRPO 2048 Open In Colab
gpt oss MXFP4 (20B) Inference Open In Colab

Gemma Notebooks

Model Type Notebook Link
EmbeddingGemma (300M) Open In Colab
FunctionGemma (270M) Tool Calling Open In Colab
FunctionGemma (270M) Mobile Actions Open In Colab
FunctionGemma (270M) Inference Open In Colab
FunctionGemma (270M) Conversational Open In Colab
(A100) Gemma3 (27B) Conversational Open In Colab
CodeGemma (7B) Conversational Open In Colab
Gemma3N (4B) Vision Open In Colab
Gemma3N (4B) Multimodal Open In Colab
Gemma3N (4B) Audio Open In Colab
Gemma3N (2B) Inference Open In Colab
Gemma3 (4B) Vision Open In Colab
Gemma3 (4B) Vision GRPO Open In Colab
Gemma3 (4B) Conversational Open In Colab
Gemma3 (270M) Conversational Open In Colab
Gemma3 (270M) Open In Colab
Gemma2 (9B) Alpaca Open In Colab
Gemma2 (2B) Alpaca Open In Colab

Granite Notebooks

Model Type Notebook Link
Granite4.0 (3B) Conversational Open In Colab
Granite4.0 (350M) Conversational Open In Colab

Linear Attention Notebooks

Model Type Notebook Link
Liquid LFM2 (1.2B) Conversational Open In Colab
Liquid LFM2 Conversational Open In Colab
Falcon H1 (0.5B) Alpaca Open In Colab
Falcon H1 Alpaca Open In Colab

Llama Notebooks

Model Type Notebook Link
(A100) Llama3.3 (70B) Conversational Open In Colab
Llama3.2 (1B) RAFT Open In Colab
Llama3.2 (1B) FP8 GRPO Open In Colab
Llama3.2 (1B and 3B) Conversational Open In Colab
Llama3.2 (11B) Vision Open In Colab
Llama3.1 (8B) Inference Open In Colab
Llama3.1 (8B) Alpaca Open In Colab
Llama3 (8B) Ollama Open In Colab
Llama3 (8B) ORPO Open In Colab
Llama3 (8B) Conversational Open In Colab
Llama3 (8B) Alpaca Open In Colab
TinyLlama (1.1B) Alpaca Open In Colab

Mistral Notebooks

Model Type Notebook Link
Magistral (24B) Reasoning Conversational Open In Colab
Mistral Small (22B) Alpaca Open In Colab
Pixtral (12B) Vision Open In Colab
Mistral Nemo (12B) Alpaca Open In Colab
Zephyr (7B) DPO Open In Colab
Mistral (7B) Text Completion Open In Colab
Ministral3 (3B) GRPO Sudoku Open In Colab
Ministral3 VL (3B) Vision Open In Colab
Mistral v0.3 (7B) Conversational Open In Colab
Mistral v0.3 (7B) CPT Open In Colab
Mistral v0.3 (7B) Alpaca Open In Colab

Nemotron Notebooks

Model Type Notebook Link
(A100) Nemotron Nano 3 30B A3B Open In Colab
(A100) Nemotron 3 Nano 30B A3B Open In Colab

Paddle Notebooks

Model Type Notebook Link
Paddle OCR (1B) Vision Open In Colab

Phi Notebooks

Model Type Notebook Link
Phi 4 Conversational Open In Colab
Phi 3.5 Mini Conversational Open In Colab
Phi 3 Medium Conversational Open In Colab

Qwen Notebooks

Model Type Notebook Link
(A100) Qwen3 (32B) Reasoning Conversational Open In Colab
TinyQwen3 MoE Open In Colab
Qwen3 (8B) FP8 GRPO Open In Colab
Qwen3 (4B) Thinking Open In Colab
Qwen3 (4B) QAT Open In Colab
Qwen3 (4B) Conversational Open In Colab
Qwen3 (14B) Reasoning Conversational Open In Colab
Qwen3 (14B) Alpaca Open In Colab
Qwen3 (14B) Open In Colab
Qwen3 (0.6B) Reasoning Conversational Open In Colab
Qwen3 (0 6B) Open In Colab
Qwen3 VL (8B) Vision Open In Colab
Qwen3 VL (8B) Vision GRPO Open In Colab
Qwen3 MoE Open In Colab
Qwen3 Embedding (4B) Open In Colab
Qwen3 Embedding (0 6B) Open In Colab
Qwen2.5 (7B) Alpaca Open In Colab
Qwen2.5 VL (7B) Vision Open In Colab
Qwen2.5 VL (7B) Vision GRPO Open In Colab
Qwen2.5 Coder (14B) Conversational Open In Colab
Qwen2.5 Coder (1.5B) Tool Calling Open In Colab
Qwen2 (7B) Alpaca Open In Colab
Qwen2 VL (7B) Vision Open In Colab

Specific use-case Notebooks

Usecase Model Notebook Link
Text Classification Llama 3.1 (8B) Open In Colab
Tool Calling Qwen2.5-Coder (1.5B) Open In Colab
Multiple Datasets Open In Colab
KTO Qwen2.5-Instruct (1.5B) Open In Colab
Inference Chat UI LLaMa 3.2 Vision Open In Colab
Conversational LLaMa 3.2 (1B and 3B) Open In Colab
ChatML Mistral (7B) Open In Colab
Text Completion Mistral (7B) Open In Colab

Other Notebooks

Model Type Notebook Link
LFM2.5 (1.2B) Text Completion Open In Colab
LFM2.5 (1.2B) Conversational Open In Colab
LFM2.5 (1.2B) Open In Colab
LFM2.5 VL (1.6B) Vision Open In Colab
Unsloth Studio Open In Colab
Synthetic Data Hackathon Synthetic Data Open In Colab
NeMo Gym Sudoku Open In Colab
NeMo Gym Multi Environment Open In Colab
CodeForces cot Finetune for Reasoning on CodeForces Reasoning Open In Colab

📒 Kaggle Notebooks

Click for all our Kaggle notebooks categorized by model:

GRPO & Reinforcement Learning Notebooks

Model Type Notebook Link
(A100) gpt oss (20B) GRPO Open in Kaggle
gpt oss (20B) GRPO Open in Kaggle
gpt oss (20B) GRPO Open in Kaggle
Phi 4 (14B) GRPO Open in Kaggle
Meta Synthetic Data Llama3.1 (8B) GRPO Open in Kaggle
Llama3.1 (8B) GRPO Open in Kaggle
Qwen3 (4B) GRPO Open in Kaggle
Meta Synthetic Data Llama3 2 (3B) GRPO Open in Kaggle
Gemma3 (1B) GRPO Open in Kaggle
Qwen2.5 (3B) GRPO Open in Kaggle
DeepSeek R1 0528 Qwen3 (8B) GRPO Open in Kaggle
Mistral v0.3 (7B) GRPO Open in Kaggle

Text-to-Speech (TTS) Notebooks

Model Type Notebook Link
Orpheus (3B) TTS Open in Kaggle
Llasa TTS (3B) TTS Open in Kaggle
Sesame CSM (1B) TTS Open in Kaggle
Oute TTS (1B) TTS Open in Kaggle
Llasa TTS (1B) TTS Open in Kaggle
Spark TTS (0.5B) TTS Open in Kaggle

Vision (Multimodal) Notebooks

Model Type Notebook Link
Pixtral (12B) Vision Open in Kaggle
ERNIE 4 5 VL 28B A3B PT Vision Open in Kaggle
Llama3.2 (11B) Vision Open in Kaggle
Qwen3 VL (8B) Vision Open in Kaggle
Qwen3 VL (8B) Vision GRPO Open in Kaggle
Ministral3 VL (3B) Vision Open in Kaggle
Gemma3N (4B) Vision Open in Kaggle
Gemma3 (4B) Vision Open in Kaggle
Gemma3 (4B) Vision GRPO Open in Kaggle
Qwen2.5 VL (7B) Vision Open in Kaggle
Qwen2.5 VL (7B) Vision GRPO Open in Kaggle
Qwen2 VL (7B) Vision Open in Kaggle

Embedding Notebooks

Model Type Notebook Link
EmbeddingGemma (300M) Open in Kaggle
All MiniLM L6 v2 Open in Kaggle
Qwen3 Embedding (4B) Open in Kaggle
Qwen3 Embedding (0 6B) Open in Kaggle
BGE M3 Open in Kaggle
ModernBert Open in Kaggle
ModernBERT (Large) Classification Open in Kaggle

Speech-to-Text (STT) Notebooks

Model Type Notebook Link
Whisper (Large) Fine Tuning Open in Kaggle

OCR Notebooks

Model Type Notebook Link
Deepseek OCR (3B) Fine Tuning Open in Kaggle
Deepseek OCR (3B) Evaluation Open in Kaggle
Deepseek OCR (3B) Eval Open in Kaggle
Deepseek OCR 2 (3B) Open in Kaggle
Paddle OCR (1B) Vision Open in Kaggle

BERT Notebooks

Model Type Notebook Link
ModernBert Open in Kaggle
ModernBERT (Large) Classification Open in Kaggle

Deepseek Notebooks

Model Type Notebook Link
Deepseek OCR (3B) Fine Tuning Open in Kaggle
Deepseek OCR (3B) Evaluation Open in Kaggle
Deepseek OCR (3B) Eval Open in Kaggle
Deepseek OCR 2 (3B) Open in Kaggle

ERNIE Notebooks

Model Type Notebook Link
ERNIE 4 5 VL 28B A3B PT Vision Open in Kaggle
ERNIE 4 5 21B A3B PT Conversational Open in Kaggle

GPT-OSS Notebooks

Model Type Notebook Link
(A100) gpt oss (120B) Fine Tuning Open in Kaggle
gpt oss (20B) Fine Tuning Open in Kaggle
gpt oss (20B) Fine Tuning Open in Kaggle
gpt oss BNB (20B) Inference Open in Kaggle
gpt oss MXFP4 (20B) Inference Open in Kaggle

Gemma Notebooks

Model Type Notebook Link
EmbeddingGemma (300M) Open in Kaggle
(A100) Gemma3 (27B) Conversational Open in Kaggle
CodeGemma (7B) Conversational Open in Kaggle
Gemma3N (4B) Vision Open in Kaggle
Gemma3N (4B) Multimodal Open in Kaggle
Gemma3N (4B) Audio Open in Kaggle
Gemma3N (2B) Inference Open in Kaggle
Gemma3 (4B) Vision Open in Kaggle
Gemma3 (4B) Vision GRPO Open in Kaggle
Gemma3 (4B) Conversational Open in Kaggle
Gemma3 (270M) Conversational Open in Kaggle
Gemma2 (9B) Alpaca Open in Kaggle
Gemma2 (2B) Alpaca Open in Kaggle

Granite Notebooks

Model Type Notebook Link
Granite4.0 (3B) Conversational Open in Kaggle
Granite4.0 (350M) Conversational Open in Kaggle

Linear Attention Notebooks

Model Type Notebook Link
Liquid LFM2 (1.2B) Conversational Open in Kaggle
Falcon H1 (0.5B) Alpaca Open in Kaggle

Llama Notebooks

Model Type Notebook Link
(A100) Llama3.3 (70B) Conversational Open in Kaggle
Llama3.2 (1B) RAFT Open in Kaggle
Llama3.2 (1B) FP8 GRPO Open in Kaggle
Llama3.2 (1B and 3B) Conversational Open in Kaggle
Llama3.2 (11B) Vision Open in Kaggle
Llama3.1 (8B) Inference Open in Kaggle
Llama3.1 (8B) Alpaca Open in Kaggle
Llama3 (8B) Ollama Open in Kaggle
Llama3 (8B) ORPO Open in Kaggle
Llama3 (8B) Conversational Open in Kaggle
Llama3 (8B) Alpaca Open in Kaggle
TinyLlama (1.1B) Alpaca Open in Kaggle

Mistral Notebooks

Model Type Notebook Link
Magistral (24B) Reasoning Conversational Open in Kaggle
Mistral Small (22B) Alpaca Open in Kaggle
Pixtral (12B) Vision Open in Kaggle
Mistral Nemo (12B) Alpaca Open in Kaggle
Zephyr (7B) DPO Open in Kaggle
Mistral (7B) Text Completion Open in Kaggle
Ministral3 (3B) GRPO Sudoku Open in Kaggle
Ministral3 VL (3B) Vision Open in Kaggle
Mistral v0.3 (7B) Conversational Open in Kaggle
Mistral v0.3 (7B) CPT Open in Kaggle
Mistral v0.3 (7B) Alpaca Open in Kaggle

Nemotron Notebooks

Model Type Notebook Link
(A100) Nemotron Nano 3 30B A3B Open in Kaggle
(A100) Nemotron 3 Nano 30B A3B Open in Kaggle

Paddle Notebooks

Model Type Notebook Link
Paddle OCR (1B) Vision Open in Kaggle

Phi Notebooks

Model Type Notebook Link
Phi 4 Conversational Open in Kaggle
Phi 3.5 Mini Conversational Open in Kaggle
Phi 3 Medium Conversational Open in Kaggle

Qwen Notebooks

Model Type Notebook Link
(A100) Qwen3 (32B) Reasoning Conversational Open in Kaggle
Qwen3 (8B) FP8 GRPO Open in Kaggle
Qwen3 (4B) Thinking Open in Kaggle
Qwen3 (4B) QAT Open in Kaggle
Qwen3 (4B) Conversational Open in Kaggle
Qwen3 (14B) Reasoning Conversational Open in Kaggle
Qwen3 (14B) Alpaca Open in Kaggle
Qwen3 (14B) Open in Kaggle
Qwen3 VL (8B) Vision Open in Kaggle
Qwen3 VL (8B) Vision GRPO Open in Kaggle
Qwen3 Embedding (4B) Open in Kaggle
Qwen3 Embedding (0 6B) Open in Kaggle
Qwen2.5 (7B) Alpaca Open in Kaggle
Qwen2.5 VL (7B) Vision Open in Kaggle
Qwen2.5 VL (7B) Vision GRPO Open in Kaggle
Qwen2.5 Coder (14B) Conversational Open in Kaggle
Qwen2.5 Coder (1.5B) Tool Calling Open in Kaggle
Qwen2 (7B) Alpaca Open in Kaggle
Qwen2 VL (7B) Vision Open in Kaggle

Other Notebooks

Model Type Notebook Link
Unsloth Studio Open in Kaggle
CodeForces cot Finetune for Reasoning on CodeForces Reasoning Open in Kaggle

Known Issues / Environment Notes

  • NumPy 2.x ↔ soxr: NumPy 2.x breaks soxr, causing Unsloth import failures. Pin numpy<2 to resolve. Use pip install --force-reinstall "numpy<2" if needed. Impact: Prevents Unsloth from running.
  • soxr reinstall: pip install --force-reinstall soxr can pull NumPy 2.x back unless using --no-deps. Use pip install --force-reinstall --no-deps soxr to avoid this. Impact: May reintroduce NumPy 2.x and break Unsloth imports.
  • typing_extensions: Older typing_extensions can break torch import (TypeIs missing) until upgraded. Upgrade with pip install --upgrade typing_extensions. Impact: Prevents PyTorch from importing correctly.
  • Resolver warnings: Pinning numpy<2 can cause pip resolver warnings with SciPy/Numba; typically non-fatal. Impact: Cosmetic warnings only, does not affect functionality.
  • ROCm / triton_key: LoRA backward can crash under torch.compile if Triton lacks triton_key; workaround is to disable Inductor/compile on ROCm (handled in code now, but worth noting). Impact: May cause training crashes on AMD GPUs when using torch.compile.

✨ Contributing to Notebooks

If you'd like to contribute to our notebooks, here's a guide to get you started:

  1. Find the Template: We've provided a template notebook called Template_Notebook.ipynb in the root directory of this project. This template contains the basic structure and formatting guidelines for all notebooks in this collection.
  2. Create Your Notebook:
    • Make a copy of Template_Notebook.ipynb.
    • Rename the copied file to follow this naming convention:
      • LLM Notebooks: <Model Name>-<Type>.ipynb (e.g., Mistral_v0.3_(7B)-Alpaca.ipynb)
      • Vision Notebooks: <Model Name>-Vision.ipynb (e.g., Llava_v1.6_(7B)-Vision.ipynb)
      • Example of <Type>: Alpaca, Conversational, CPT, DPO, ORPO, Text_Completion, CSV, Inference, Unsloth_Studio
  3. Place in original_template: Once your notebook is ready, move it to the original_template directory.
  4. Update Notebooks: Run the following command in your terminal:
    python update_all_notebooks.py
    This script will automatically:
    • Copy your notebook from original_template to the notebooks directory.
    • Update the notebook's internal sections (like Installation, News) to ensure consistency.
    • Add your notebook to the appropriate list in this README.md file.
  5. Create a Pull Request: After that, just create a pull request (PR) to merge your changes, making it available for everyone!
    • We appreciate your contributions and look forward to reviewing your notebooks!

About

100+ Fine-tuning Tutorial Notebooks on Google Colab, Kaggle and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 33