Teaching Small LLMs to Write Git Commits
Collection
Dataset + LoRA adapters for fine-tuning small LLMs to write Conventional Commits from a git diff. Part of a local, offline commit-message tool. โข 7 items โข Updated
How to use Elib27/llama-3.2-1b-commit-msg-lora with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Llama-3.2-1B-Instruct")
model = PeftModel.from_pretrained(base_model, "Elib27/llama-3.2-1b-commit-msg-lora")LoRA adapter fine-tuned on top of meta-llama/Llama-3.2-1B-Instruct
to generate Conventional Commits messages from a git diff.
Part of a project to build a local, offline prepare-commit-msg git hook.
Full write-up: https://eliotbas.com/projects/commits-fine-tuning/
Training dataset: https://huggingface.co/datasets/Elib27/commits
See the article for full evaluation results (ROUGE-L, structural checks, LLM-as-judge) across all model sizes.
Base model
meta-llama/Llama-3.2-1B-Instruct
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Llama-3.2-1B-Instruct") model = PeftModel.from_pretrained(base_model, "Elib27/llama-3.2-1b-commit-msg-lora")