初始化项目,由ModelHub XC社区提供模型

Model: Tavernari/git-commit-message
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-05 15:55:23 +08:00
commit 2faa5a328a
8 changed files with 293 additions and 0 deletions

39
.gitattributes vendored Normal file
View File

@@ -0,0 +1,39 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
unsloth.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
unsloth.F16.gguf filter=lfs diff=lfs merge=lfs -text
unsloth.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
unsloth.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text

95
Modelfile Normal file
View File

@@ -0,0 +1,95 @@
FROM content/Tavernari/git-commit-message:Q8_0
SYSTEM """You are an experienced developer with expertise in reading git diffs and crafting meaningful git commit messages. Your task is to analyze a provided git diff and create a commit message that clearly describes the changes. Since you are a 3B parameter model, this prompt will guide you step-by-step with detailed explanations and examples to ensure clarity.
### How to Reason Through a Git Diff
Into your reasoning, you must break down the diff into its components and understand the changes.
This involves identifying the affected files, examining the changes, and understanding the purpose behind them.
When you find a change definition or why, you must think better about your input, so, you must think loudly writing each step of your reasoning.
As a think you must write each think including the contraverse ones, so you can have a better understanding of the changes.
### How to Write a Commit Message
A commit message has two parts: a **title** and a **body**. Heres how to structure it:
#### Title
- Write in the **imperative mood** (e.g., "Add feature" not "Added feature").
- Start with a **capital letter**.
- Keep it **short**, under 50 characters.
- Do **not** end with a period.
- Example: "Fix user login bug"
#### Empty Line
- There **must** be one blank line between the title and body. This is a git standard.
#### Body
- Explain **what** was changed and **why**, not *how* it was done.
- Keep lines under **72 characters** for readability.
- Example:
This commit fixes a bug where users couldnt log in due to
a missing validation check. The change ensures proper
credentials are verified before granting access.
- Finish the body answer adding the tag <!--end>
### Response Format
You must respond in this exact structure:
<reasoning>
Step-by-step reasoning about the git diff. Explain what changed,
why it likely happened, and how youll summarize it.
</reasoning>
Commit message title goes here immediately after the tag
Body content starts here after one empty line.
<!--end>
#### Example of Reasoning and Commit Message
<reasoning>
Let's break down the file:, Let's analyze the diff:, etc.
After reading the line 1, I realized that the file was added, but let me check again, because it can be a rename.
After reading the change on line 2, I realized that the file was renamed, so I must add a handling to process it.
</reasoning>
Rename the module to align with the project
Changed the name from 'old_name' to 'new_name',
and refactored the code to match the new module name.
Updated all imports and references to the module.
<!--end>
### Your Task
When given a git diff, analyze it using the reasoning steps above. Then, write a commit message following the title-body structure. Use `<reasoning>` tags to explain your thought process, followed immediately by the commit message with no extra labels or spacing beyond the required empty line.
MANDATORY: You should never start the answer as code-snippet.
### Extra Context
If the input contains context (Extra Context), it is mandatory consider it in your reasoning and commit message. This can help you tailor the message to the specific situation and provide more accurate insights.
You must always reasoning based on the user input context if exists.
"""
TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>{{ end }}<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant"""
PARAMETER stop "<|start_header_id|>"
PARAMETER stop "<|end_header_id|>"
PARAMETER stop "<|eot_id|>"
PARAMETER stop "<|eom_id|>"
PARAMETER stop "<!--end"
PARAMETER temperature 0.8
PARAMETER num_predict -1
PARAMETER mirostat 2
PARAMETER num_ctx 32000
LICENSE """
LICENSE
=======
Permission is hereby granted, free of charge, to any person or entity (hereinafter referred to as the "User") obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or use the Software for assisting with daily tasks, provided the following conditions are met:
1. The Software shall be used for non-commercial purposes only. While Users may incorporate the Software into their work processes within a company or for personal use, the Software shall not be sold, distributed, or otherwise transferred for commercial benefit or monetary compensation.
2. The Software may be integrated into commercial offerings as a component or feature but it cannot be sold as a standalone product or a primary solution. Users interested in commercializing any solution or product that incorporates the Software in such a manner must contact the licensor at victortavernari@gmail.com to obtain a separate license agreement tailored for such purposes.
3. Redistributions of the Software must retain the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.
DISCLAIMER:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This license is effective until terminated by either party. Users may terminate this license at any time by ceasing all use of the Software. The licensor reserves the right to terminate this license at any time and for any reason, including the failure to comply with any of the terms and conditions of this license.
"""

144
README.md Normal file
View File

@@ -0,0 +1,144 @@
---
datasets:
- Tavernari/git-commit-message-dt
metrics:
- accuracy
pipeline_tag: summarization
tags:
- git
- commit
- message
---
# Git Commit Message Generator (Reasoning Version)
Welcome to the **Git Commit Message Generator**—an AI-powered tool that turns your code diffs into clear, meaningful commit messages with detailed reasoning. Hosted on Hugging Face, this reasoning version not only provides a commit message but also explains the thought process behind it, making your commit history more transparent and informative.
**Note**: This is the reasoning version of the Git Commit Message Generator. For other versions (e.g., Chain of Draft or standard), check out my [Ollama repository](https://ollama.com/tavernari/git-commit-message) for more details.
**Beta Status**: This version is in beta. Your feedback is essential to refine it further!
## Output Format
The model outputs two main components wrapped in a structured format:
1. **Reasoning**: A detailed breakdown of the changes in your diff and the logic behind the commit message.
2. **Commit Message**: A concise summary of the changes, followed by a more detailed description.
**Example Output**:
```
<reasoning>
The diff shows changes in `WalletManagerView.swift`. The most significant changes are the
addition of a new `@State` variable `monthlySpentGoal` and modifications to existing functions
and state variables. The `monthlySpentGoal` is now used in various places, such as in the
`onSave` closure and in the `hasChanges` function. The purpose of these changes is to add a new
feature that allows users to set a monthly spending goal for their wallets, which can be
updated and saved with other wallet information.
The changes include:
- Adding a new `@State` variable `monthlySpentGoal`.
- Updating the `onSave` closure to include `monthlySpentGoal`.
- Using `monthlySpentGoal` in the `hasChanges` function to determine if the wallet's spending
goal has changed.
- Adding a new section `WalletGoalSpentSection` that uses `monthlySpentGoal`.
- Updating the `onSetAsMain` function to use `monthlySpentGoal`.
</reasoning>
Add monthly spending goal feature to WalletManagerView
This commit adds a new `@State` variable `monthlySpentGoal` to the `WalletManagerView` and
updates the `onSave` closure and related functions to include and use this variable. This
feature allows users to set and save a monthly spending goal for their wallets, enhancing the
wallet management functionality.
```
This format gives you both the "why" and the "what" of your commit, enhancing clarity and context.
## Using the Model
You can interact with the model in two ways:
### 1. Web Interface
- Go to the [Hugging Face Model Page](https://huggingface.co/Tavernari/git-commit-message).
- Paste your git diff into the input box.
- Click "Generate" to get the reasoning and commit message.
### 2. API Integration
- Use the Hugging Face Inference API to integrate the model into your workflows.
- Example in Python:
```python
import requests
API_URL = "https://api-inference.huggingface.co/models/Tavernari/git-commit-message"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
diff = """
diff --git a/file1.py b/file1.py
index 83db48f..bf2a9a2 100644
--- a/file1.py
+++ b/file1.py
@@ -1,3 +1,4 @@
def hello():
print("Hello, world!")
+ print("Welcome to AI commit messages!")
"""
output = query({"inputs": diff})
print(output)
```
- Replace `YOUR_HF_TOKEN` with your Hugging Face API token. The response will include both reasoning and the commit message.
## Tips for Best Results
- **Clear Diffs**: Use small, focused diffs for more accurate messages.
- **Proper Formatting**: Ensure your diff is well-formatted for the model to interpret it correctly.
- **Output Handling**: When using the API, parse the response to separate reasoning and the commit message if needed.
## Installing `git-gen-commit` (Optional)
For a command-line experience, you can install the `git-gen-commit` script, which generates commit messages from your git diff.
**Disclaimer**: The `git-gen-commit` script uses the Ollama API, not the Hugging Face model. Results may differ from this reasoning version. For more details, visit my [Ollama repository](https://ollama.com/tavernari/git-commit-message).
### Installation (macOS/Linux)
Run this command to install `git-gen-commit` globally:
```bash
sudo sh -c 'curl -L https://gist.githubusercontent.com/Tavernari/b88680e71c281cfcdd38f46bdb164fee/raw/git-gen-commit \
-o /usr/local/bin/git-gen-commit && chmod +x /usr/local/bin/git-gen-commit'
```
### Usage
Once installed, run:
```bash
git gen-commit
```
This will analyze your current git diff and generate a commit message via the Ollama API.
## Feedback and Contributions
This is a community-driven project, and your input helps it grow!
- **Feedback**: Use the community tab to give us feedback.
- **Support**: If youd like to fuel this passion project, consider a donation: [Buy me a coffee ☕️](https://donate.stripe.com/14k3d8dFqfeI96E8ww).
## Disclaimer
This tool is still evolving. Please review generated messages for accuracy before committing.
## Get in Touch
Id love to hear from you! Connect with me at:
- [LinkedIn](https://www.linkedin.com/in/victorctavernari/)
- [GitHub](https://github.com/Tavernari)
- [Twitter](https://twitter.com/vituu)
- Email: victortavernari+gitcommitmessage@gmail.com
Lets make AI-powered development even better together!

3
config.json Normal file
View File

@@ -0,0 +1,3 @@
{
"model_type": "qwen2"
}

3
unsloth.F16.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:beda2f202544a4447e6c00f02b0432ddd14b6ae0eb733eb2d614935ce2e9004b
size 6178316672

3
unsloth.Q4_K_M.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2500a116bf1f7bcdb471eef99fb3eac31743d6e37b99743b7b798b4822fcca15
size 1929902464

3
unsloth.Q5_K_M.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0649e6630550a1bdade7eac94c5402dcf93cb46efe44f2bc58b6dad8057fdba4
size 2224814464

3
unsloth.Q8_0.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:125e2d0b3ee2d26ca41907e5632f0f5867f12e790357fefc441714af3c479f2d
size 3285475712