LORA is a practical LoRA fine-tuning framework for Hugging Face transformer models.
This repository focuses on a clean training workflow (via scripts/train.py + YAML configs), plus an interactive inference tool (scripts/chat.py) for testing trained adapters.
Author: Jacek Trefon
- Train LoRA adapters on your own data (including chat-style
messagesdatasets) - Track key training metrics (loss, eval loss, perplexity)
- Load a base model + LoRA adapter and chat interactively, with optional streaming output
Python 3.8+ is required. Python 3.10+ is recommended.
pip install -r requirements.txt
pip install -e .The fastest way to validate end-to-end training (especially on Apple Silicon) is to use the provided config:
python scripts/train.py --config configs/m4_mps_quick.yamlTraining outputs are written to training.output_dir (for example ./outputs/m4_quick).
python scripts/chat.py \
--base_model Qwen/Qwen3-1.7B \
--adapter_dir outputs/m4_quick/final_model \
--device mps \
--cache_dir ./.cache/hf \
--stream \
--show_stop_reason \
--max_new_tokens 2048Helpful chat commands:
/reset/sample(requires--dataset_jsonl)/exit
This repo supports instruction/chat fine-tuning using a JSONL dataset where each record contains messages.
Example record:
{"id":"example-001","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"},{"role":"assistant","content":"Hi!"}]}See:
datasets/instruction_samples/software_dev_messages.jsonldocs/DATASETS.md
Configs live in configs/.
configs/m4_mps_quick.yamlis a minimal validation configconfigs/rtx4090_cuda_*.yamlare examples for CUDA training
See docs/TRAINING.md.
docs/GETTING_STARTED.mddocs/DATASETS.mddocs/TRAINING.mddocs/INFERENCE.md
See CONTRIBUTING.md.
Licensed under Apache-2.0. See LICENSE.
If you use this project, please cite it using CITATION.cff.