Instructions to use yisuiban/git-ai-commit-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use yisuiban/git-ai-commit-sft with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir git-ai-commit-sft yisuiban/git-ai-commit-sft
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
| license: apache-2.0 | |
| base_model: mlx-community/Qwen2.5-Coder-7B-Instruct-4bit | |
| tags: | |
| - mlx | |
| - lora | |
| - qwen | |
| - commit-message | |
| - conventional-commits | |
| - git | |
| - chinese | |
| # git-ai-commit-sft | |
| A LoRA adapter fine-tuned on Qwen2.5-Coder-7B-Instruct-4bit to generate **Chinese Conventional Commits** commit messages from git diffs. | |
| Built for [git-ai-commit](https://github.com/your-org/git-ai-commit), an IntelliJ plugin that uses LLMs to generate commit messages. | |
| ## Model | |
| - **Base model:** [mlx-community/Qwen2.5-Coder-7B-Instruct-4bit](https://huggingface.co/mlx-community/Qwen2.5-Coder-7B-Instruct-4bit) | |
| - **Fine-tuning:** LoRA (rank 8, 16 layers, 11.5M trainable params) | |
| - **Format:** MLX adapter (safetensors) | |
| ## Training Data | |
| 548 high-quality commit messages from two real-world repositories (one Java backend, one Go microservice), filtered to Chinese-only Conventional Commits format. Each training sample pairs a git diff (processed through the plugin's exact runtime pipeline — GitDiffFilter + PromptBuilder) with the corresponding human-written commit message. | |
| ## Evaluation | |
| | Metric | Before | After | | |
| |---|---|---| | |
| | Conventional Commits rate | 96% | **100%** | | |
| | Chinese rate | 100% | 100% | | |
| | Single-line rate | 100% | 100% | | |
| | Mean similarity to reference | 0.339 | **0.546** | | |
| | Mean output length | 51 chars | 27 chars | | |
| ## Usage | |
| ```bash | |
| # Install mlx-lm | |
| pip install mlx-lm | |
| # Download and load | |
| python -m mlx_lm.generate \ | |
| --model mlx-community/Qwen2.5-Coder-7B-Instruct-4bit \ | |
| --adapter-path yisuiban/git-ai-commit-sft \ | |
| --prompt "你是一位资深工程师,擅长根据 git diff 生成一句中文提交信息。..." | |
| ``` | |
| From Python: | |
| ```python | |
| from mlx_lm import load, generate | |
| from mlx_lm.sample_utils import make_sampler | |
| model, tokenizer = load( | |
| "mlx-community/Qwen2.5-Coder-7B-Instruct-4bit", | |
| adapter_path="yisuiban/git-ai-commit-sft" | |
| ) | |
| prompt = tokenizer.apply_chat_template( | |
| [{"role": "user", "content": "你的提示词..."}], | |
| tokenize=False, add_generation_prompt=True | |
| ) | |
| response = generate(model, tokenizer, prompt=prompt, max_tokens=64, | |
| sampler=make_sampler(temp=0.0)) | |
| ``` | |
| For Ollama deployment, see the [training repository](https://github.com/your-org/git-ai-commit-sft) for the full Modelfile and export pipeline. | |
| ## Training Details | |
| - **Hardware:** Apple M1 Max (64GB unified memory) | |
| - **Framework:** MLX LoRA (mlx-lm 0.31.3) | |
| - **Optimizer:** Adam, learning rate 1e-5 | |
| - **Batch:** 1 × gradient accumulation 8 (effective batch 8) | |
| - **Steps:** 250 (~4 epochs over 473 training samples) | |
| - **Max sequence length:** 4096 tokens | |
| - **Training time:** ~20 minutes on M1 Max |