Instructions to use MariChatmen/qwen-andaluh-0.8b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use MariChatmen/qwen-andaluh-0.8b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-0.8B") model = PeftModel.from_pretrained(base_model, "MariChatmen/qwen-andaluh-0.8b-lora") - Notebooks
- Google Colab
- Kaggle
Upload Qwen-Andaluh 0.8B LoRA adapter
Browse files- .gitattributes +1 -0
- README.md +74 -0
- adapter_config.json +338 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +154 -0
- tokenizer.json +3 -0
- tokenizer_config.json +32 -0
- training_args.bin +3 -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
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3.5-0.8B
|
| 4 |
+
library_name: peft
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- peft
|
| 8 |
+
- lora
|
| 9 |
+
- qlora
|
| 10 |
+
- qwen
|
| 11 |
+
- andaluh
|
| 12 |
+
- andalusian-spanish
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Qwen-Andaluh 0.8B LoRA
|
| 16 |
+
|
| 17 |
+
LoRA adapter for `Qwen/Qwen3.5-0.8B` trained as the non-persona
|
| 18 |
+
**Qwen-Andaluh** checkpoint.
|
| 19 |
+
|
| 20 |
+
The intended behaviour is simple:
|
| 21 |
+
|
| 22 |
+
```text
|
| 23 |
+
System prompt: Eres un asistente
|
| 24 |
+
Input: Spanish or Andalûh
|
| 25 |
+
Output: Andalûh EPA
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
This is an adapter release, not a merged model.
|
| 29 |
+
|
| 30 |
+
## Training Stages
|
| 31 |
+
|
| 32 |
+
- Andalûh continued pretraining / CPT.
|
| 33 |
+
- Accent SFT.
|
| 34 |
+
- Accent ORPO preference tuning.
|
| 35 |
+
|
| 36 |
+
The source data was generated from Spanish instruction rows by filtering
|
| 37 |
+
licence-compatible Spanish examples, protecting fragile spans, converting
|
| 38 |
+
assistant messages to Andalûh EPA, converting a controlled share of user
|
| 39 |
+
messages to Andalûh EPA, and restoring URLs, paths, code, package names and
|
| 40 |
+
model IDs unchanged.
|
| 41 |
+
|
| 42 |
+
## Adapter Details
|
| 43 |
+
|
| 44 |
+
- Base model: `Qwen/Qwen3.5-0.8B`
|
| 45 |
+
- Adapter type: LoRA / QLoRA
|
| 46 |
+
- Rank: 16
|
| 47 |
+
- Alpha: 32
|
| 48 |
+
- Dropout: 0.05
|
| 49 |
+
- Target modules: `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`,
|
| 50 |
+
`up_proj`, `down_proj`
|
| 51 |
+
|
| 52 |
+
## Use
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from peft import AutoPeftModelForCausalLM
|
| 56 |
+
from transformers import AutoTokenizer
|
| 57 |
+
|
| 58 |
+
model_id = "MariChatmen/qwen-andaluh-0.8b-lora"
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 60 |
+
model = AutoPeftModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Limitations
|
| 64 |
+
|
| 65 |
+
- Experimental research adapter.
|
| 66 |
+
- May leak standard Spanish.
|
| 67 |
+
- May produce imperfect Andalûh EPA.
|
| 68 |
+
- Not an official linguistic standard.
|
| 69 |
+
|
| 70 |
+
## Related
|
| 71 |
+
|
| 72 |
+
- Persona dataset: <https://huggingface.co/datasets/alobos/MariChatmen-Persona>
|
| 73 |
+
- AndaluGeeks EPA: <https://andaluh.es/epa-2/>
|
| 74 |
+
- `andaluh-py`: <https://github.com/andalugeeks/andaluh-py>
|
adapter_config.json
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen3.5-0.8B",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": true,
|
| 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 |
+
"lora_ga_config": null,
|
| 23 |
+
"megatron_config": null,
|
| 24 |
+
"megatron_core": "megatron.core",
|
| 25 |
+
"modules_to_save": null,
|
| 26 |
+
"peft_type": "LORA",
|
| 27 |
+
"peft_version": "0.19.1",
|
| 28 |
+
"qalora_group_size": 16,
|
| 29 |
+
"r": 16,
|
| 30 |
+
"rank_pattern": {},
|
| 31 |
+
"revision": null,
|
| 32 |
+
"target_modules": [
|
| 33 |
+
"down_proj",
|
| 34 |
+
"o_proj",
|
| 35 |
+
"q_proj",
|
| 36 |
+
"gate_proj",
|
| 37 |
+
"up_proj",
|
| 38 |
+
"v_proj",
|
| 39 |
+
"k_proj"
|
| 40 |
+
],
|
| 41 |
+
"target_parameters": null,
|
| 42 |
+
"task_type": "CAUSAL_LM",
|
| 43 |
+
"trainable_token_indices": [
|
| 44 |
+
248044,
|
| 45 |
+
248045,
|
| 46 |
+
248046,
|
| 47 |
+
248047,
|
| 48 |
+
248048,
|
| 49 |
+
248049,
|
| 50 |
+
248050,
|
| 51 |
+
248051,
|
| 52 |
+
248052,
|
| 53 |
+
248053,
|
| 54 |
+
248054,
|
| 55 |
+
248055,
|
| 56 |
+
248056,
|
| 57 |
+
248057,
|
| 58 |
+
248058,
|
| 59 |
+
248059,
|
| 60 |
+
248060,
|
| 61 |
+
248061,
|
| 62 |
+
248062,
|
| 63 |
+
248063,
|
| 64 |
+
248064,
|
| 65 |
+
248065,
|
| 66 |
+
248066,
|
| 67 |
+
248067,
|
| 68 |
+
248068,
|
| 69 |
+
248069,
|
| 70 |
+
248070,
|
| 71 |
+
248071,
|
| 72 |
+
248072,
|
| 73 |
+
248073,
|
| 74 |
+
248074,
|
| 75 |
+
248075,
|
| 76 |
+
248076,
|
| 77 |
+
248077,
|
| 78 |
+
248078,
|
| 79 |
+
248079,
|
| 80 |
+
248080,
|
| 81 |
+
248081,
|
| 82 |
+
248082,
|
| 83 |
+
248083,
|
| 84 |
+
248084,
|
| 85 |
+
248085,
|
| 86 |
+
248086,
|
| 87 |
+
248087,
|
| 88 |
+
248088,
|
| 89 |
+
248089,
|
| 90 |
+
248090,
|
| 91 |
+
248091,
|
| 92 |
+
248092,
|
| 93 |
+
248093,
|
| 94 |
+
248094,
|
| 95 |
+
248095,
|
| 96 |
+
248096,
|
| 97 |
+
248097,
|
| 98 |
+
248098,
|
| 99 |
+
248099,
|
| 100 |
+
248100,
|
| 101 |
+
248101,
|
| 102 |
+
248102,
|
| 103 |
+
248103,
|
| 104 |
+
248104,
|
| 105 |
+
248105,
|
| 106 |
+
248106,
|
| 107 |
+
248107,
|
| 108 |
+
248108,
|
| 109 |
+
248109,
|
| 110 |
+
248110,
|
| 111 |
+
248111,
|
| 112 |
+
248112,
|
| 113 |
+
248113,
|
| 114 |
+
248114,
|
| 115 |
+
248115,
|
| 116 |
+
248116,
|
| 117 |
+
248117,
|
| 118 |
+
248118,
|
| 119 |
+
248119,
|
| 120 |
+
248120,
|
| 121 |
+
248121,
|
| 122 |
+
248122,
|
| 123 |
+
248123,
|
| 124 |
+
248124,
|
| 125 |
+
248125,
|
| 126 |
+
248126,
|
| 127 |
+
248127,
|
| 128 |
+
248128,
|
| 129 |
+
248129,
|
| 130 |
+
248130,
|
| 131 |
+
248131,
|
| 132 |
+
248132,
|
| 133 |
+
248133,
|
| 134 |
+
248134,
|
| 135 |
+
248135,
|
| 136 |
+
248136,
|
| 137 |
+
248137,
|
| 138 |
+
248138,
|
| 139 |
+
248139,
|
| 140 |
+
248140,
|
| 141 |
+
248141,
|
| 142 |
+
248142,
|
| 143 |
+
248143,
|
| 144 |
+
248144,
|
| 145 |
+
248145,
|
| 146 |
+
248146,
|
| 147 |
+
248147,
|
| 148 |
+
248148,
|
| 149 |
+
248149,
|
| 150 |
+
248150,
|
| 151 |
+
248151,
|
| 152 |
+
248152,
|
| 153 |
+
248153,
|
| 154 |
+
248154,
|
| 155 |
+
248155,
|
| 156 |
+
248156,
|
| 157 |
+
248157,
|
| 158 |
+
248158,
|
| 159 |
+
248159,
|
| 160 |
+
248160,
|
| 161 |
+
248161,
|
| 162 |
+
248162,
|
| 163 |
+
248163,
|
| 164 |
+
248164,
|
| 165 |
+
248165,
|
| 166 |
+
248166,
|
| 167 |
+
248167,
|
| 168 |
+
248168,
|
| 169 |
+
248169,
|
| 170 |
+
248170,
|
| 171 |
+
248171,
|
| 172 |
+
248172,
|
| 173 |
+
248173,
|
| 174 |
+
248174,
|
| 175 |
+
248175,
|
| 176 |
+
248176,
|
| 177 |
+
248177,
|
| 178 |
+
248178,
|
| 179 |
+
248179,
|
| 180 |
+
248180,
|
| 181 |
+
248181,
|
| 182 |
+
248182,
|
| 183 |
+
248183,
|
| 184 |
+
248184,
|
| 185 |
+
248185,
|
| 186 |
+
248186,
|
| 187 |
+
248187,
|
| 188 |
+
248188,
|
| 189 |
+
248189,
|
| 190 |
+
248190,
|
| 191 |
+
248191,
|
| 192 |
+
248192,
|
| 193 |
+
248193,
|
| 194 |
+
248194,
|
| 195 |
+
248195,
|
| 196 |
+
248196,
|
| 197 |
+
248197,
|
| 198 |
+
248198,
|
| 199 |
+
248199,
|
| 200 |
+
248200,
|
| 201 |
+
248201,
|
| 202 |
+
248202,
|
| 203 |
+
248203,
|
| 204 |
+
248204,
|
| 205 |
+
248205,
|
| 206 |
+
248206,
|
| 207 |
+
248207,
|
| 208 |
+
248208,
|
| 209 |
+
248209,
|
| 210 |
+
248210,
|
| 211 |
+
248211,
|
| 212 |
+
248212,
|
| 213 |
+
248213,
|
| 214 |
+
248214,
|
| 215 |
+
248215,
|
| 216 |
+
248216,
|
| 217 |
+
248217,
|
| 218 |
+
248218,
|
| 219 |
+
248219,
|
| 220 |
+
248220,
|
| 221 |
+
248221,
|
| 222 |
+
248222,
|
| 223 |
+
248223,
|
| 224 |
+
248224,
|
| 225 |
+
248225,
|
| 226 |
+
248226,
|
| 227 |
+
248227,
|
| 228 |
+
248228,
|
| 229 |
+
248229,
|
| 230 |
+
248230,
|
| 231 |
+
248231,
|
| 232 |
+
248232,
|
| 233 |
+
248233,
|
| 234 |
+
248234,
|
| 235 |
+
248235,
|
| 236 |
+
248236,
|
| 237 |
+
248237,
|
| 238 |
+
248238,
|
| 239 |
+
248239,
|
| 240 |
+
248240,
|
| 241 |
+
248241,
|
| 242 |
+
248242,
|
| 243 |
+
248243,
|
| 244 |
+
248244,
|
| 245 |
+
248245,
|
| 246 |
+
248246,
|
| 247 |
+
248247,
|
| 248 |
+
248248,
|
| 249 |
+
248249,
|
| 250 |
+
248250,
|
| 251 |
+
248251,
|
| 252 |
+
248252,
|
| 253 |
+
248253,
|
| 254 |
+
248254,
|
| 255 |
+
248255,
|
| 256 |
+
248256,
|
| 257 |
+
248257,
|
| 258 |
+
248258,
|
| 259 |
+
248259,
|
| 260 |
+
248260,
|
| 261 |
+
248261,
|
| 262 |
+
248262,
|
| 263 |
+
248263,
|
| 264 |
+
248264,
|
| 265 |
+
248265,
|
| 266 |
+
248266,
|
| 267 |
+
248267,
|
| 268 |
+
248268,
|
| 269 |
+
248269,
|
| 270 |
+
248270,
|
| 271 |
+
248271,
|
| 272 |
+
248272,
|
| 273 |
+
248273,
|
| 274 |
+
248274,
|
| 275 |
+
248275,
|
| 276 |
+
248276,
|
| 277 |
+
248277,
|
| 278 |
+
248278,
|
| 279 |
+
248279,
|
| 280 |
+
248280,
|
| 281 |
+
248281,
|
| 282 |
+
248282,
|
| 283 |
+
248283,
|
| 284 |
+
248284,
|
| 285 |
+
248285,
|
| 286 |
+
248286,
|
| 287 |
+
248287,
|
| 288 |
+
248288,
|
| 289 |
+
248289,
|
| 290 |
+
248290,
|
| 291 |
+
248291,
|
| 292 |
+
248292,
|
| 293 |
+
248293,
|
| 294 |
+
248294,
|
| 295 |
+
248295,
|
| 296 |
+
248296,
|
| 297 |
+
248297,
|
| 298 |
+
248298,
|
| 299 |
+
248299,
|
| 300 |
+
248300,
|
| 301 |
+
248301,
|
| 302 |
+
248302,
|
| 303 |
+
248303,
|
| 304 |
+
248304,
|
| 305 |
+
248305,
|
| 306 |
+
248306,
|
| 307 |
+
248307,
|
| 308 |
+
248308,
|
| 309 |
+
248309,
|
| 310 |
+
248310,
|
| 311 |
+
248311,
|
| 312 |
+
248312,
|
| 313 |
+
248313,
|
| 314 |
+
248314,
|
| 315 |
+
248315,
|
| 316 |
+
248316,
|
| 317 |
+
248317,
|
| 318 |
+
248318,
|
| 319 |
+
248319,
|
| 320 |
+
248320,
|
| 321 |
+
248321,
|
| 322 |
+
248322,
|
| 323 |
+
248323,
|
| 324 |
+
248324,
|
| 325 |
+
248325,
|
| 326 |
+
248326,
|
| 327 |
+
248327,
|
| 328 |
+
248328,
|
| 329 |
+
248329,
|
| 330 |
+
248330,
|
| 331 |
+
248331,
|
| 332 |
+
248332
|
| 333 |
+
],
|
| 334 |
+
"use_bdlora": null,
|
| 335 |
+
"use_dora": false,
|
| 336 |
+
"use_qalora": false,
|
| 337 |
+
"use_rslora": false
|
| 338 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec28756d74a6ef22527b8ca2f1278865f763b915a02883e690b3fac474954a0a
|
| 3 |
+
size 1045124280
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set image_count = namespace(value=0) %}
|
| 2 |
+
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
+
{%- if content is string %}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping %}
|
| 7 |
+
{%- for item in content %}
|
| 8 |
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
| 9 |
+
{%- if is_system_content %}
|
| 10 |
+
{{- raise_exception('System message cannot contain images.') }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- if do_vision_count %}
|
| 13 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{%- if add_vision_id %}
|
| 16 |
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' }}
|
| 19 |
+
{%- elif 'video' in item or item.type == 'video' %}
|
| 20 |
+
{%- if is_system_content %}
|
| 21 |
+
{{- raise_exception('System message cannot contain videos.') }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
{%- if do_vision_count %}
|
| 24 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- if add_vision_id %}
|
| 27 |
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' }}
|
| 30 |
+
{%- elif 'text' in item %}
|
| 31 |
+
{{- item.text }}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- elif content is none or content is undefined %}
|
| 37 |
+
{{- '' }}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endmacro %}
|
| 42 |
+
{%- if not messages %}
|
| 43 |
+
{{- raise_exception('No messages provided.') }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 46 |
+
{{- '<|im_start|>system\n' }}
|
| 47 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 48 |
+
{%- for tool in tools %}
|
| 49 |
+
{{- "\n" }}
|
| 50 |
+
{{- tool | tojson }}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{{- "\n</tools>" }}
|
| 53 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 54 |
+
{%- if messages[0].role == 'system' %}
|
| 55 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 56 |
+
{%- if content %}
|
| 57 |
+
{{- '\n\n' + content }}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<|im_end|>\n' }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{%- if messages[0].role == 'system' %}
|
| 63 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 64 |
+
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 68 |
+
{%- for message in messages[::-1] %}
|
| 69 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 70 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 71 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 72 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 73 |
+
{%- set ns.multi_step_tool = false %}
|
| 74 |
+
{%- set ns.last_query_index = index %}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{%- endfor %}
|
| 78 |
+
{%- if ns.multi_step_tool %}
|
| 79 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- for message in messages %}
|
| 82 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 83 |
+
{%- if message.role == "system" %}
|
| 84 |
+
{%- if not loop.first %}
|
| 85 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- elif message.role == "user" %}
|
| 88 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 89 |
+
{%- elif message.role == "assistant" %}
|
| 90 |
+
{%- set reasoning_content = '' %}
|
| 91 |
+
{%- if message.reasoning_content is string %}
|
| 92 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 93 |
+
{%- else %}
|
| 94 |
+
{%- if '</think>' in content %}
|
| 95 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 96 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
| 99 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 100 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 101 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 102 |
+
{%- else %}
|
| 103 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 104 |
+
{%- endif %}
|
| 105 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 106 |
+
{%- for tool_call in message.tool_calls %}
|
| 107 |
+
{%- if tool_call.function is defined %}
|
| 108 |
+
{%- set tool_call = tool_call.function %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if loop.first %}
|
| 111 |
+
{%- if content|trim %}
|
| 112 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 113 |
+
{%- else %}
|
| 114 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- else %}
|
| 117 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 118 |
+
{%- endif %}
|
| 119 |
+
{%- if tool_call.arguments is defined %}
|
| 120 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 121 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 122 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 123 |
+
{{- args_value }}
|
| 124 |
+
{{- '\n</parameter>\n' }}
|
| 125 |
+
{%- endfor %}
|
| 126 |
+
{%- endif %}
|
| 127 |
+
{{- '</function>\n</tool_call>' }}
|
| 128 |
+
{%- endfor %}
|
| 129 |
+
{%- endif %}
|
| 130 |
+
{{- '<|im_end|>\n' }}
|
| 131 |
+
{%- elif message.role == "tool" %}
|
| 132 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 133 |
+
{{- '<|im_start|>user' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{{- '\n<tool_response>\n' }}
|
| 136 |
+
{{- content }}
|
| 137 |
+
{{- '\n</tool_response>' }}
|
| 138 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 139 |
+
{{- '<|im_end|>\n' }}
|
| 140 |
+
{%- elif loop.last %}
|
| 141 |
+
{{- '<|im_end|>\n' }}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{%- else %}
|
| 144 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{%- endfor %}
|
| 147 |
+
{%- if add_generation_prompt %}
|
| 148 |
+
{{- '<|im_start|>assistant\n' }}
|
| 149 |
+
{%- if enable_thinking is defined and enable_thinking is true %}
|
| 150 |
+
{{- '<think>\n' }}
|
| 151 |
+
{%- else %}
|
| 152 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 153 |
+
{%- endif %}
|
| 154 |
+
{%- endif %}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:91a720d349e3fb554eaa9c2a32c354e9540c0aa2c65b60be74bb277a105e0d20
|
| 3 |
+
size 20036715
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"audio_bos_token": "<|audio_start|>",
|
| 4 |
+
"audio_eos_token": "<|audio_end|>",
|
| 5 |
+
"audio_token": "<|audio_pad|>",
|
| 6 |
+
"backend": "tokenizers",
|
| 7 |
+
"bos_token": null,
|
| 8 |
+
"clean_up_tokenization_spaces": false,
|
| 9 |
+
"eos_token": "<|im_end|>",
|
| 10 |
+
"errors": "replace",
|
| 11 |
+
"image_token": "<|image_pad|>",
|
| 12 |
+
"is_local": true,
|
| 13 |
+
"local_files_only": false,
|
| 14 |
+
"model_max_length": 262144,
|
| 15 |
+
"model_specific_special_tokens": {
|
| 16 |
+
"audio_bos_token": "<|audio_start|>",
|
| 17 |
+
"audio_eos_token": "<|audio_end|>",
|
| 18 |
+
"audio_token": "<|audio_pad|>",
|
| 19 |
+
"image_token": "<|image_pad|>",
|
| 20 |
+
"video_token": "<|video_pad|>",
|
| 21 |
+
"vision_bos_token": "<|vision_start|>",
|
| 22 |
+
"vision_eos_token": "<|vision_end|>"
|
| 23 |
+
},
|
| 24 |
+
"pad_token": "<|endoftext|>",
|
| 25 |
+
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 26 |
+
"split_special_tokens": false,
|
| 27 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 28 |
+
"unk_token": null,
|
| 29 |
+
"video_token": "<|video_pad|>",
|
| 30 |
+
"vision_bos_token": "<|vision_start|>",
|
| 31 |
+
"vision_eos_token": "<|vision_end|>"
|
| 32 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:09365789b7a1de39ec379a236e4a7f430197c466a65248b628f762fa5772cffc
|
| 3 |
+
size 5521
|