Text Generation
PEFT
Safetensors
English
conventional-commits
qwen2.5-coder
code-llm
fine-tuned
lora
qlora
conversational
Instructions to use Pavloffm/qwen-commit-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Pavloffm/qwen-commit-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-3B-Instruct") model = PeftModel.from_pretrained(base_model, "Pavloffm/qwen-commit-lora") - Notebooks
- Google Colab
- Kaggle
File size: 1,788 Bytes
228b1de | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ---
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
|