Skip to content

Fine-Tuning

Use this page for LoRA instruction tuning on exported LabCore HF checkpoints or compatible Hub repos. Prerequisites: HF + finetune dependencies and an accessible base model.

Command(s)

python scripts/finetune/fine_tune_instruction.py \
  --model-id outputs/hf_export \
  --dataset yahma/alpaca-cleaned \
  --dataset-split train \
  --output-dir outputs/lora_instruction \
  --config configs/presets/bpe_rope_flash/bpe_50M_rope_flash.toml \
  --max-samples 20000 \
  --epochs 1

Dependencies:

python -m pip install -e ".[torch,hf,finetune]"

Output Files / Artifacts Produced

  • outputs/lora_instruction/ (LoRA adapter + tokenizer files)

Notes

  • The script loads exported LabCore models with trust_remote_code=True.
  • BPE exports are the intended path for HF fine-tuning workflows.

Dataset Mapping

The script accepts common field aliases:

  • Instruction: instruction, question, prompt
  • Input: input, context
  • Output: output, response, answer

Common Errors

  • Missing HF dependencies: see Torch not installed.
  • OOM during fine-tuning: see Out of memory.
  • Wrong base model/tokenizer expectations: verify config and model compatibility before launching.

Note

Fine-tuning uses the HF trainer stack and writes to outputs/ rather than checkpoints/.