epochs

Projects · Advanced · 3–4 hours

Fine-tune a language model with LoRA

Teach a real language model a new style by training less than 0.2% of its weights, on a laptop CPU.

What you'll build

A LoRA adapter for distilgpt2 that makes it answer like a friendly support agent, trained in a few minutes and saved as a file under 1 MB.

You'll need

Python 3 and NumPy where the code imports it. Hugging Face's distilgpt2 model, about 350 MB, downloaded automatically the first time. Install with pip install torch transformers peft. Tested with transformers 4.36 and peft 0.7.

Learn first

This project is part of Pro

The first two projects are free. Pro opens every lesson and every project.

See Pro plansFrom ₹119 a month. No auto-renewal.