GPU Finetuning (LoRA / QLoRA)
Steps to run a full finetune on GPU:
- Prepare an
accelerateconfig (seebackend/accelerate_config_demo.yaml). - Ensure the venv has
transformers,peft,accelerate,bitsandbytes, anddatasetsinstalled. Example:
.venv/bin/pip install -r backend/requirements-extras.txt
.venv/bin/pip install peft bitsandbytes accelerate -U
- Run the helper script in dry-run first, then without
--dry-run:
./backend/scripts/run_finetune_gpu.sh --model mistralai/Mistral-7B-Instruct-v0.1 --data data/finetune_sample.jsonl --out models/mistral_finetuned --method qlora --epochs 3 --batch 4
Notes:
- Training large models requires appropriate GPU memory and CUDA drivers.
- When ready, remove
--dry-runinrun_finetune_gpu.shor edit the command to perform the real run.