--- language: - en license: mit library_name: peft base_model: Qwen/Qwen2.5-Coder-3B-Instruct tags: - conventional-commits - qwen2.5-coder - text-generation - code-llm - fine-tuned - lora - qlora --- # Qwen Commit LoRA - Conventional Commit Message Generator Generates conventional commit messages from git diffs using a fine-tuned Qwen2.5-Coder-3B model with QLoRA adapters. ## Model Details - **Base Model**: [Qwen/Qwen2.5-Coder-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct) - **Fine-tuning Method**: QLoRA (4-bit quantized, rank=8, alpha=16) - **Training Data**: 210 real conventional commits from open-source repositories - **Target Modules**: q_proj, k_proj, v_proj, o_proj ## Usage ```python from peft import PeftModel from transformers import AutoModelForCausalLM, AutoTokenizer # Load base model base_model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen2.5-Coder-3B-Instruct", load_in_4bit=True, device_map="auto" ) tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-3B-Instruct") # Load LoRA adapters model = PeftModel.from_pretrained(base_model, "Pavloffm/qwen-commit-lora") # Generate commit message diff = """diff --git a/src/main.py b/src/main.py index 1234567..abcdefg 100644 --- a/src/main.py +++ b/src/main.py @@ -1,3 +1,5 @@ +def new_feature(): + pass """ messages = [{"role": "user", "content": f"Generate a conventional commit message for this diff:\n{diff}"}] inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device) outputs = model.generate(inputs, max_new_tokens=100) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## Training - 2 epochs - Learning rate: 1.5e-4 - LoRA rank: 8, alpha: 16 - 210 training examples ## License MIT License