How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="CyrusCheungkf/git-commit-3B")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("CyrusCheungkf/git-commit-3B")
model = AutoModelForCausalLM.from_pretrained("CyrusCheungkf/git-commit-3B")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

Model Card for Model ID

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)
Downloads last month
82
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for CyrusCheungkf/git-commit-3B

Base model

Qwen/Qwen2.5-3B
Quantized
(98)
this model
Quantizations
1 model

Dataset used to train CyrusCheungkf/git-commit-3B