Fine tuned Qwen2.5 3B model for writing git commit message. Used dataset Maxscha/commitbench
Model Details
Developed by: Cyrus Cheung
Model type: Qwen2.5 3B
License: qwen-research
Finetuned from model: Qwen/Qwen2.5-Coder-3B-Instruct
Uses
from transformers.models.auto.modeling_auto import AutoModelForCausalLM
from transformers.models.auto.tokenization_auto import AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("CyrusCheungkf/git-commit-3B")
tokenizer = AutoTokenizer.from_pretrained("CyrusCheungkf/git-commit-3B")
git_diff = "Output from using 'git diff'"
INSTRUCTION = """You are Git Commit Message Pro, a specialist in crafting precise, professional Git commit messages from .diff files. Your role is to analyze these files, interpret the changes, and generate a clear, direct commit message.Guidelines:1. Be specific about the type of change (e.g., "Rename variable X to Y", "Extract method Z from class W").2. Prefer to write it on why and how instead of what changed.3. Interpret the changes; do not transcribe the diff.4. If you cannot read the entire file, attempt to generate a message based on the available information.5. Be concise and summarize the most important changes. Keep your response in 1 sentence."""
conversation = [
{"role": "user", "content": INSTRUCTION + "\n\nInputs:\n" + git_diff},
]
tokens = tokenizer.apply_chat_template(
conversation, add_generation_prompt=True, return_tensors="pt", return_dict=True
)
output = model.generate(
inputs=tokens["input_ids"],
attention_mask=tokens["attention_mask"],
)
print(output)
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CyrusCheungkf/git-commit-3B" \ --host 0.0.0.0 \ --port 30000# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CyrusCheungkf/git-commit-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'