Team Ai
Modelpublic

CyrusCheungkf/git-commit-3B

sourceHugging Faceupdated 1y agoView on Hugging Face
3likes81downloads
README.md55 linesDownload Raw Back to root
1---2library_name: transformers3tags:4- git5datasets:6- Maxscha/commitbench7language:8- en9base_model:10- Qwen/Qwen2.5-Coder-3B-Instruct11pipeline_tag: text-generation12---13 14# Model Card for Model ID15 16Fine tuned Qwen2.5 3B model for writing git commit message. Used dataset Maxscha/commitbench17 18 19## Model Details20 21- **Developed by:** Cyrus Cheung22- **Model type:** Qwen2.5 3B23- **License:** qwen-research24- **Finetuned from model:** Qwen/Qwen2.5-Coder-3B-Instruct25 26## Uses27 28```python29from transformers.models.auto.modeling_auto import AutoModelForCausalLM30from transformers.models.auto.tokenization_auto import AutoTokenizer31 32model = AutoModelForCausalLM.from_pretrained("CyrusCheungkf/git-commit-3B")33tokenizer = AutoTokenizer.from_pretrained("CyrusCheungkf/git-commit-3B")34git_diff = "Output from using 'git diff'"35 36INSTRUCTION = """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.37 38Guidelines:391. Be specific about the type of change (e.g., "Rename variable X to Y", "Extract method Z from class W").402. Prefer to write it on why and how instead of what changed.413. Interpret the changes; do not transcribe the diff.424. If you cannot read the entire file, attempt to generate a message based on the available information.435. Be concise and summarize the most important changes. Keep your response in 1 sentence."""44conversation = [45  {"role": "user", "content": INSTRUCTION + "\n\nInputs:\n" + git_diff},46]47tokens = tokenizer.apply_chat_template(48  conversation, add_generation_prompt=True, return_tensors="pt", return_dict=True49)50output = model.generate(51  inputs=tokens["input_ids"],52  attention_mask=tokens["attention_mask"],53)54print(output)55```