Fine-Tune a Small Language Model as a Job (LoRA, CPU)
Expert · 45 minutes · 5 tasks, checked automatically · 100 points
In this expert-level MLOps lab you will simulate a full LoRA fine-tuning pipeline entirely on CPU inside a Kubernetes cluster. You will create a dedicated namespace and ConfigMap that carries a self-contained Python fine-tuning script using the Hugging Face PEFT/LoRA API against a tiny GPT-2 model. You will then package that script into a Kubernetes Job with appropriate resource limits, monitor its progress via logs, and finally verify the adapter weights were written to a hostPath PersistentVolume. This lab mirrors production MLOps patterns: immutable job specs, config-as-code, volume-backed artifact storage, and declarative resource governance — all without any cloud infrastructure.
What you’ll learn
- Create a Kubernetes namespace, PersistentVolume, and PersistentVolumeClaim to store LoRA adapter artifacts
- Deploy a ConfigMap containing a self-contained Python LoRA fine-tuning script and launch it as a Kubernetes Job
- Verify the Job completes successfully and that LoRA adapter files are persisted to the volume
How this lab works
- Start the lab: One click starts a real Kubernetes cluster on your computer (kind), with kubectl ready in a toolbox terminal.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads your live cluster and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Cluster: A real Kubernetes cluster on your computer (kind)
- Kubernetes: 1.34.8
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop installed and running
- A kind cluster created in the Kubernetes Playground
Topics: mlops, lora, fine-tuning, kubernetes-jobs, peft, huggingface, transformers, cpu-training, persistentvolume, configmap
Create a free account to start this lab.