Pavloffm/qwen-commit-lora
17
1---2language:3 - en4license: mit5library_name: peft6base_model: Qwen/Qwen2.5-Coder-3B-Instruct7tags:8 - conventional-commits9 - qwen2.5-coder10 - text-generation11 - code-llm12 - fine-tuned13 - lora14 - qlora15---16 17# Qwen Commit LoRA - Conventional Commit Message Generator18 19Generates conventional commit messages from git diffs using a fine-tuned Qwen2.5-Coder-3B model with QLoRA adapters.20 21## Model Details22 23- **Base Model**: [Qwen/Qwen2.5-Coder-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct)24- **Fine-tuning Method**: QLoRA (4-bit quantized, rank=8, alpha=16)25- **Training Data**: 210 real conventional commits from open-source repositories26- **Target Modules**: q_proj, k_proj, v_proj, o_proj27 28## Usage29 30```python31from peft import PeftModel32from transformers import AutoModelForCausalLM, AutoTokenizer33 34# Load base model35base_model = AutoModelForCausalLM.from_pretrained(36 "Qwen/Qwen2.5-Coder-3B-Instruct",37 load_in_4bit=True,38 device_map="auto"39)40tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-3B-Instruct")41 42# Load LoRA adapters43model = PeftModel.from_pretrained(base_model, "Pavloffm/qwen-commit-lora")44 45# Generate commit message46diff = """diff --git a/src/main.py b/src/main.py47index 1234567..abcdefg 10064448--- a/src/main.py49+++ b/src/main.py50@@ -1,3 +1,5 @@51+def new_feature():52+ pass53"""54 55messages = [{"role": "user", "content": f"Generate a conventional commit message for this diff:\n{diff}"}]56inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)57outputs = model.generate(inputs, max_new_tokens=100)58print(tokenizer.decode(outputs[0], skip_special_tokens=True))59```60 61## Training62 63- 2 epochs64- Learning rate: 1.5e-465- LoRA rank: 8, alpha: 1666- 210 training examples67 68## License69 70MIT License71 