A minimal fine-tuning repo for LFM2, fully built on Open Source.
⚠️ Important
- Hardware: We tested this tool on H100 80GB GPU. Multi-GPU parallelization has been tested up to 8 such GPUs.
- Operating system: This tool currently supports Linux machines with the x86_64 architecture.
- Python: Make sure you are running Python >= 3.12.
- Access token: Make sure you are logged in on Hugging Face to access models and datasets.
For feature requests or if you have a different setup, reach out to support@liquid.ai and tell us about your specific configuration.
curl -LsSf https://astral.sh/uv/install.sh | shgit clone <repository-url>
cd leap_finetuneuv syncGo to config.py and follow the instructions there.
- Use
DatasetLoaderto load datasets from HuggingFace Hub or local files (you can also add custom data loading logic here as long as it's TRL compatible) - Pick a default
TrainingConfigand optionally override some of the config parameters. Pick aPeftConfig. - Create a
JobConfigwith your desired settings (model, dataset, etc.)
Run locally:
uv run leap-finetuneIt uses Ray Train + Accelerate for distributed training.
Unless you overwrote output_dir, results will be stored in outputs/training_type/job_name/
The default configurations are located in:
- SFT Training:
src/leap_finetune/configs/sft_configs.py - DPO Training:
src/leap_finetune/configs/dpo_configs.py - PEFT/LoRA:
src/leap_finetune/configs/peft_configs.py
To add a new training configuration add it to the respective file and then reference it in src/leap_finetune/configs/__init__.py in the TrainingConfig and/or PeftConfig enum.
- Hook
pre-committo git:uv run pre-commit install - Open a PR with your changes
Pre-commit will now run automatically on commits, or run manually:
uv run pre-commit run --all-files