Mamoun Hussam Yousef commited on
Add the necessary model files
Browse files- .gitattributes +1 -0
- README.md +328 -0
- adapter_config.json +43 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +54 -0
- merges.txt +0 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +207 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,331 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-Coder-0.5B
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:Qwen/Qwen2.5-Coder-0.5B
|
| 7 |
+
- lora
|
| 8 |
+
- transformers
|
| 9 |
+
- qlora
|
| 10 |
+
- commit-message-generation
|
| 11 |
+
- code-summarization
|
| 12 |
license: apache-2.0
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# QLoRA Adapter for Commit Message Generation
|
| 18 |
+
|
| 19 |
+
Fine-tuned LoRA adapter for **Qwen2.5-Coder-0.5B** that generates clear, concise Git commit messages from code diffs.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
|
| 23 |
+
### Model Description
|
| 24 |
+
|
| 25 |
+
This model is a **QLoRA (4-bit quantized LoRA)** adapter trained on the Qwen2.5-Coder-0.5B base model to automatically generate commit messages from Git diffs. The adapter learns to summarize code changes into human-readable descriptions, understanding programming patterns and translating technical modifications into natural language.
|
| 26 |
+
|
| 27 |
+
**Key characteristics:**
|
| 28 |
+
- Uses the **PT (Pretrained/Base)** version of Qwen2.5-Coder for cleaner, more controllable outputs
|
| 29 |
+
- Trained with 4-bit NF4 quantization for efficient fine-tuning on consumer hardware
|
| 30 |
+
- Only LoRA adapters are included (~few MB); requires base model for inference
|
| 31 |
+
- Optimized for diff-to-message generation, not chat or instruction following
|
| 32 |
+
|
| 33 |
+
- **Developed by:** Mamoun Yosef
|
| 34 |
+
- **Model type:** Causal Language Model (Decoder-only Transformer) with LoRA adapters
|
| 35 |
+
- **Language(s):** English
|
| 36 |
+
- **License:** Apache 2.0
|
| 37 |
+
- **Finetuned from model:** Qwen/Qwen2.5-Coder-0.5B
|
| 38 |
+
|
| 39 |
+
### Model Sources
|
| 40 |
+
|
| 41 |
+
- **Repository:** [[commit-message-llm]](https://github.com/mamounyosef/commit-message-llm)
|
| 42 |
+
- **Base Model:** [Qwen/Qwen2.5-Coder-0.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B)
|
| 43 |
+
|
| 44 |
+
## Uses
|
| 45 |
+
|
| 46 |
+
### Direct Use
|
| 47 |
+
|
| 48 |
+
This adapter is designed for **automated commit message generation** from Git diffs. It can be used to:
|
| 49 |
+
|
| 50 |
+
- Generate commit messages for staged changes in Git repositories
|
| 51 |
+
- Suggest descriptive summaries for code modifications
|
| 52 |
+
- Automate documentation of code changes in CI/CD pipelines
|
| 53 |
+
- Assist developers in writing clear, consistent commit messages
|
| 54 |
+
|
| 55 |
+
**Example input (Git diff):**
|
| 56 |
+
```diff
|
| 57 |
+
diff --git a/src/utils.py b/src/utils.py
|
| 58 |
+
index abc123..def456 100644
|
| 59 |
+
--- a/src/utils.py
|
| 60 |
+
+++ b/src/utils.py
|
| 61 |
+
@@ -10,6 +10,9 @@ def process_data(data):
|
| 62 |
+
return result
|
| 63 |
+
|
| 64 |
+
+def validate_input(data):
|
| 65 |
+
+ return data is not None and len(data) > 0
|
| 66 |
+
+
|
| 67 |
+
def save_output(output, filename):
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
**Example output:**
|
| 71 |
+
```
|
| 72 |
+
Add input validation function
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### Downstream Use
|
| 76 |
+
|
| 77 |
+
Can be integrated into:
|
| 78 |
+
- Git hooks (pre-commit, commit-msg)
|
| 79 |
+
- IDE extensions for code editors
|
| 80 |
+
- Code review tools
|
| 81 |
+
- Developer productivity applications
|
| 82 |
+
|
| 83 |
+
### Out-of-Scope Use
|
| 84 |
+
|
| 85 |
+
**Not suitable for:**
|
| 86 |
+
- General text generation or chat
|
| 87 |
+
- Generating code from descriptions (reverse direction)
|
| 88 |
+
- Diffs from non-programming languages
|
| 89 |
+
- Extremely large diffs (>8000 characters)
|
| 90 |
+
- Commit messages requiring deep domain knowledge beyond code structure
|
| 91 |
+
|
| 92 |
+
## Bias, Risks, and Limitations
|
| 93 |
+
|
| 94 |
+
**Limitations:**
|
| 95 |
+
- Trained only on English commit messages
|
| 96 |
+
- May struggle with very complex multi-file changes
|
| 97 |
+
- Limited to diff length of 50-8000 characters
|
| 98 |
+
- Performance depends on code quality and diff clarity
|
| 99 |
+
- May generate generic messages for trivial changes
|
| 100 |
+
- Does not understand business context or domain-specific terminology
|
| 101 |
+
|
| 102 |
+
**Risks:**
|
| 103 |
+
- Generated messages may not capture full intent of changes
|
| 104 |
+
- Should be reviewed by developers before committing
|
| 105 |
+
- May miss important security or breaking change implications
|
| 106 |
+
|
| 107 |
+
### Recommendations
|
| 108 |
+
|
| 109 |
+
- Always review generated commit messages before use
|
| 110 |
+
- Use as a suggestion tool, not fully automated solution
|
| 111 |
+
- Combine with manual editing for complex changes
|
| 112 |
+
- Test on your codebase to evaluate quality
|
| 113 |
+
|
| 114 |
+
## How to Get Started with the Model
|
| 115 |
+
```python
|
| 116 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 117 |
+
from peft import PeftModel
|
| 118 |
+
import torch
|
| 119 |
+
|
| 120 |
+
# Load base model in 4-bit
|
| 121 |
+
from transformers import BitsAndBytesConfig
|
| 122 |
+
|
| 123 |
+
quant_config = BitsAndBytesConfig(
|
| 124 |
+
load_in_4bit=True,
|
| 125 |
+
bnb_4bit_quant_type="nf4",
|
| 126 |
+
bnb_4bit_use_double_quant=True,
|
| 127 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 131 |
+
"Qwen/Qwen2.5-Coder-0.5B",
|
| 132 |
+
quantization_config=quant_config,
|
| 133 |
+
device_map="auto",
|
| 134 |
+
torch_dtype=torch.bfloat16,
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
# Load LoRA adapter
|
| 138 |
+
model = PeftModel.from_pretrained(base_model, "path/to/checkpoint-6000")
|
| 139 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-0.5B")
|
| 140 |
+
|
| 141 |
+
# Generate commit message
|
| 142 |
+
diff = """diff --git a/file.py b/file.py
|
| 143 |
+
--- a/file.py
|
| 144 |
+
+++ b/file.py
|
| 145 |
+
@@ -1,3 +1,4 @@
|
| 146 |
+
+import os
|
| 147 |
+
def main():
|
| 148 |
+
print("Hello")
|
| 149 |
+
"""
|
| 150 |
+
|
| 151 |
+
prompt = diff + "\n\nCommit message:\n"
|
| 152 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 153 |
+
|
| 154 |
+
outputs = model.generate(
|
| 155 |
+
**inputs,
|
| 156 |
+
max_new_tokens=30,
|
| 157 |
+
do_sample=False,
|
| 158 |
+
num_beams=1,
|
| 159 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 160 |
+
)
|
| 161 |
+
|
| 162 |
+
message = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 163 |
+
message = message[len(prompt):].strip()
|
| 164 |
+
print(message)
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
## Training Details
|
| 168 |
+
|
| 169 |
+
### Training Data
|
| 170 |
+
|
| 171 |
+
**Dataset:** [Maxscha/commitbench](https://huggingface.co/datasets/Maxscha/commitbench)
|
| 172 |
+
|
| 173 |
+
**Preprocessing:**
|
| 174 |
+
- Removed trivial messages (fix, update, wip, etc.)
|
| 175 |
+
- Filtered out reference-only commits (fix #123)
|
| 176 |
+
- Removed placeholder tokens (<HASH>, <URL>)
|
| 177 |
+
- Kept diffs between 50-8000 characters
|
| 178 |
+
- Required messages with semantic content (≥3 words)
|
| 179 |
+
|
| 180 |
+
**Final dataset sizes:**
|
| 181 |
+
- Training: 120,000 samples
|
| 182 |
+
- Validation: 15,000 samples
|
| 183 |
+
- Test: 15,000 samples
|
| 184 |
+
|
| 185 |
+
### Training Procedure
|
| 186 |
+
|
| 187 |
+
**Format:**
|
| 188 |
+
```
|
| 189 |
+
{diff content}
|
| 190 |
+
|
| 191 |
+
Commit message:
|
| 192 |
+
{target message}<eos>
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
Prompt tokens (diff + separator) are masked with label `-100` so loss is computed only on the commit message generation.
|
| 196 |
+
|
| 197 |
+
#### Preprocessing
|
| 198 |
+
|
| 199 |
+
1. Normalize newlines (CRLF → LF)
|
| 200 |
+
2. Tokenize diff + separator + message
|
| 201 |
+
3. Mask prompt labels to `-100`
|
| 202 |
+
4. Truncate to max_length=512 tokens
|
| 203 |
+
5. Append EOS token to target
|
| 204 |
+
|
| 205 |
+
#### Training Hyperparameters
|
| 206 |
+
|
| 207 |
+
**QLoRA Configuration:**
|
| 208 |
+
- Quantization: 4-bit NF4
|
| 209 |
+
- Compute dtype: bfloat16
|
| 210 |
+
- LoRA rank (r): 16
|
| 211 |
+
- LoRA alpha: 32
|
| 212 |
+
- LoRA dropout: 0.05
|
| 213 |
+
- Target modules: q_proj, k_proj, v_proj, o_proj
|
| 214 |
+
|
| 215 |
+
**Training Parameters:**
|
| 216 |
+
- Max sequence length: 512 tokens
|
| 217 |
+
- Per-device train batch size: 6
|
| 218 |
+
- Per-device eval batch size: 6
|
| 219 |
+
- Gradient accumulation steps: 8
|
| 220 |
+
- **Effective batch size: 48**
|
| 221 |
+
- Learning rate: 1.8e-4
|
| 222 |
+
- LR scheduler: Cosine with 4% warmup
|
| 223 |
+
- Total training steps: 6000
|
| 224 |
+
- Epochs: ~2
|
| 225 |
+
- Optimizer: paged_adamw_8bit
|
| 226 |
+
- Gradient clipping: 1.0
|
| 227 |
+
- **Training regime:** bf16 mixed precision
|
| 228 |
+
|
| 229 |
+
**Memory Optimizations:**
|
| 230 |
+
- Gradient checkpointing enabled
|
| 231 |
+
- SDPA (Scaled Dot-Product Attention) for efficient attention
|
| 232 |
+
- 8-bit paged optimizer
|
| 233 |
+
- Group by length for efficient batching
|
| 234 |
+
|
| 235 |
+
#### Speeds, Sizes, Times
|
| 236 |
+
|
| 237 |
+
- **Hardware:** NVIDIA RTX 4060 (8GB VRAM)
|
| 238 |
+
- **Total training time:** ~13 hours
|
| 239 |
+
- **Checkpoint size:** ~few MB (LoRA adapters only)
|
| 240 |
+
- **Peak VRAM usage:** <8GB
|
| 241 |
+
- **Training throughput:** ~2500 samples/hour
|
| 242 |
+
|
| 243 |
+
## Evaluation
|
| 244 |
+
|
| 245 |
+
### Testing Data, Factors & Metrics
|
| 246 |
+
|
| 247 |
+
#### Testing Data
|
| 248 |
+
|
| 249 |
+
**Test split from Maxscha/commitbench:**
|
| 250 |
+
- 15,000 cleaned samples
|
| 251 |
+
- Same preprocessing as training data
|
| 252 |
+
- No overlap with training/validation sets
|
| 253 |
+
|
| 254 |
+
#### Metrics
|
| 255 |
+
|
| 256 |
+
- **Loss:** Cross-entropy loss on commit message tokens
|
| 257 |
+
- **Perplexity:** exp(loss), measures model confidence
|
| 258 |
+
- Lower perplexity = better prediction quality
|
| 259 |
+
- Perplexity ≈ 17 is strong for this task
|
| 260 |
+
|
| 261 |
+
### Results
|
| 262 |
+
|
| 263 |
+
| Split | Loss | Perplexity |
|
| 264 |
+
|-------|------|------------|
|
| 265 |
+
| Validation | 2.8583 | 17.43 |
|
| 266 |
+
| Test | 2.8501 | 17.29 |
|
| 267 |
+
|
| 268 |
+
**Qualitative Example:**
|
| 269 |
+
```diff
|
| 270 |
+
diff --git a/src/client/core/commands/menu.js
|
| 271 |
+
+ 'core/settings'
|
| 272 |
+
+], function (_, hr, MenubarView, box, panels, tabs, session, localfs, settings) {
|
| 273 |
+
+ }).menuSection({
|
| 274 |
+
+ 'id': "themes.settings",
|
| 275 |
+
+ 'title': "Settings",
|
| 276 |
+
+ 'action': function() {
|
| 277 |
+
+ settings.open("themes"...
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
- **Ground truth:** Add command to open themes settings in view menu
|
| 281 |
+
- **Model output:** Add theme settings to the menu
|
| 282 |
+
|
| 283 |
+
The model correctly identifies the purpose (menu settings addition) and generates a concise, accurate description.
|
| 284 |
+
|
| 285 |
+
## Environmental Impact
|
| 286 |
+
|
| 287 |
+
- **Hardware Type:** NVIDIA RTX 4060 (8GB VRAM)
|
| 288 |
+
- **Hours used:** ~13 hours
|
| 289 |
+
- **Cloud Provider:** N/A (local training)
|
| 290 |
+
- **Compute Region:** N/A
|
| 291 |
+
- **Carbon Emitted:** Minimal (single consumer GPU, short training time)
|
| 292 |
+
|
| 293 |
+
## Technical Specifications
|
| 294 |
+
|
| 295 |
+
### Model Architecture and Objective
|
| 296 |
+
|
| 297 |
+
- **Base Architecture:** Qwen2.5-Coder-0.5B (Decoder-only Transformer)
|
| 298 |
+
- **Adapter Type:** LoRA (Low-Rank Adaptation)
|
| 299 |
+
- **Objective:** Causal language modeling with masked prompts
|
| 300 |
+
- **Loss Function:** Cross-entropy on commit message tokens only
|
| 301 |
+
|
| 302 |
+
### Compute Infrastructure
|
| 303 |
+
|
| 304 |
+
#### Hardware
|
| 305 |
+
|
| 306 |
+
- GPU: NVIDIA RTX 4060
|
| 307 |
+
- VRAM: 8GB
|
| 308 |
+
- System RAM: 16GB
|
| 309 |
+
- Storage: SSD recommended for dataset loading
|
| 310 |
+
|
| 311 |
+
#### Software
|
| 312 |
+
|
| 313 |
+
- **Framework:** PyTorch, Hugging Face Transformers
|
| 314 |
+
- **PEFT Version:** 0.18.1
|
| 315 |
+
- **Key Libraries:**
|
| 316 |
+
- `transformers` (model loading, training)
|
| 317 |
+
- `peft` (LoRA adapters)
|
| 318 |
+
- `bitsandbytes` (4-bit quantization)
|
| 319 |
+
- `datasets` (data loading)
|
| 320 |
+
- `torch` (deep learning backend)
|
| 321 |
+
|
| 322 |
+
## Model Card Authors
|
| 323 |
+
|
| 324 |
+
Mamoun Yosef
|
| 325 |
+
|
| 326 |
+
### Framework versions
|
| 327 |
+
|
| 328 |
+
- PEFT 0.18.1
|
| 329 |
+
- Transformers 4.x
|
| 330 |
+
- PyTorch 2.x
|
| 331 |
+
- bitsandbytes 0.x
|
adapter_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen2.5-Coder-0.5B",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 32,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.05,
|
| 22 |
+
"megatron_config": null,
|
| 23 |
+
"megatron_core": "megatron.core",
|
| 24 |
+
"modules_to_save": null,
|
| 25 |
+
"peft_type": "LORA",
|
| 26 |
+
"peft_version": "0.18.1",
|
| 27 |
+
"qalora_group_size": 16,
|
| 28 |
+
"r": 16,
|
| 29 |
+
"rank_pattern": {},
|
| 30 |
+
"revision": null,
|
| 31 |
+
"target_modules": [
|
| 32 |
+
"v_proj",
|
| 33 |
+
"o_proj",
|
| 34 |
+
"q_proj",
|
| 35 |
+
"k_proj"
|
| 36 |
+
],
|
| 37 |
+
"target_parameters": null,
|
| 38 |
+
"task_type": "CAUSAL_LM",
|
| 39 |
+
"trainable_token_indices": null,
|
| 40 |
+
"use_dora": false,
|
| 41 |
+
"use_qalora": false,
|
| 42 |
+
"use_rslora": false
|
| 43 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b72d32996456c4229e290f5a29debfbe4fd69ca7bd1f3f5bafb9301e09fd718a
|
| 3 |
+
size 8676008
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- 'You are a helpful assistant.' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" %}
|
| 25 |
+
{{- '<|im_start|>' + message.role }}
|
| 26 |
+
{%- if message.content %}
|
| 27 |
+
{{- '\n' + message.content }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- for tool_call in message.tool_calls %}
|
| 30 |
+
{%- if tool_call.function is defined %}
|
| 31 |
+
{%- set tool_call = tool_call.function %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 34 |
+
{{- tool_call.name }}
|
| 35 |
+
{{- '", "arguments": ' }}
|
| 36 |
+
{{- tool_call.arguments | tojson }}
|
| 37 |
+
{{- '}\n</tool_call>' }}
|
| 38 |
+
{%- endfor %}
|
| 39 |
+
{{- '<|im_end|>\n' }}
|
| 40 |
+
{%- elif message.role == "tool" %}
|
| 41 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 42 |
+
{{- '<|im_start|>user' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '\n<tool_response>\n' }}
|
| 45 |
+
{{- message.content }}
|
| 46 |
+
{{- '\n</tool_response>' }}
|
| 47 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 48 |
+
{{- '<|im_end|>\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{%- if add_generation_prompt %}
|
| 53 |
+
{{- '<|im_start|>assistant\n' }}
|
| 54 |
+
{%- endif %}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|endoftext|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
|
| 3 |
+
size 11421896
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
}
|
| 181 |
+
},
|
| 182 |
+
"additional_special_tokens": [
|
| 183 |
+
"<|im_start|>",
|
| 184 |
+
"<|im_end|>",
|
| 185 |
+
"<|object_ref_start|>",
|
| 186 |
+
"<|object_ref_end|>",
|
| 187 |
+
"<|box_start|>",
|
| 188 |
+
"<|box_end|>",
|
| 189 |
+
"<|quad_start|>",
|
| 190 |
+
"<|quad_end|>",
|
| 191 |
+
"<|vision_start|>",
|
| 192 |
+
"<|vision_end|>",
|
| 193 |
+
"<|vision_pad|>",
|
| 194 |
+
"<|image_pad|>",
|
| 195 |
+
"<|video_pad|>"
|
| 196 |
+
],
|
| 197 |
+
"bos_token": null,
|
| 198 |
+
"clean_up_tokenization_spaces": false,
|
| 199 |
+
"eos_token": "<|endoftext|>",
|
| 200 |
+
"errors": "replace",
|
| 201 |
+
"extra_special_tokens": {},
|
| 202 |
+
"model_max_length": 32768,
|
| 203 |
+
"pad_token": "<|endoftext|>",
|
| 204 |
+
"split_special_tokens": false,
|
| 205 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 206 |
+
"unk_token": null
|
| 207 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|