初始化项目,由ModelHub XC社区提供模型
Model: kaufkino/MiniCPM5-1B-Fable5-Thinking-T-Wix-ru Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
*.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
|
||||||
|
gguf/minicpm5-1b-fable5-twix-ru-f16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
gguf/minicpm5-1b-fable5-twix-ru-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
77
README.md
Normal file
77
README.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking
|
||||||
|
datasets:
|
||||||
|
- t-tech/T-Wix
|
||||||
|
language:
|
||||||
|
- ru
|
||||||
|
library_name: transformers
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
tags:
|
||||||
|
- merge
|
||||||
|
- lora
|
||||||
|
- russian
|
||||||
|
- thinking
|
||||||
|
- tool-calling
|
||||||
|
- gguf
|
||||||
|
- experimental
|
||||||
|
---
|
||||||
|
|
||||||
|
# MiniCPM5-1B-Fable5-Thinking-T-Wix-ru
|
||||||
|
|
||||||
|
> ⚠️ **Экспериментальная модель.** Метрики не снимались (только ручной смоук-квиз). Не для продакшена.
|
||||||
|
|
||||||
|
Русскоязычная 1B-модель с работающим `<think>`-режимом. Получена в два этапа:
|
||||||
|
|
||||||
|
1. **Merge**: T-Wix LoRA (r=32, обучена на базовой `openbmb/MiniCPM5-1B` на ~461k русских диалогов [t-tech/T-Wix](https://huggingface.co/datasets/t-tech/T-Wix)) применена к дистилляту [GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking) через `PeftModel` + `merge_and_unload()`.
|
||||||
|
2. **Reasoning-SFT (v2, текущая версия)**: merge дообучен LoRA (r=16, LR 2e-5, 1 эпоха) на reasoning-сабсете T-Wix — 31k примеров с русскими `<think>`-трейсами; управляющие суффиксы ` /think` из данных убраны, чтобы thinking стал поведением по умолчанию.
|
||||||
|
|
||||||
|
## Наблюдаемое поведение (ручной смоук-тест, не бенчмарк)
|
||||||
|
|
||||||
|
**Что работает:**
|
||||||
|
- `<think>` включается сам на задачах, где уместен (математика, рассуждения), думает на языке вопроса (RU-вопрос → русский трейс, EN → английский), закрывает блок и даёт ответ
|
||||||
|
- Пошаговая математика с самопроверкой внутри think
|
||||||
|
- Tool calling: корректно выбирает функцию и аргументы
|
||||||
|
- Беглый русский с хорошей структурой
|
||||||
|
|
||||||
|
**Известные дефекты:**
|
||||||
|
- На длинных выкладках think может не уложиться в маленький `max_new_tokens` — ставьте ≥1000–2000
|
||||||
|
- Фактология на русском слабая (модель 1B): для фактов используйте RAG
|
||||||
|
- Перевод EN→RU нестабилен
|
||||||
|
- Рекомендуется `repetition_penalty=1.1` (без него возможны циклы)
|
||||||
|
|
||||||
|
## Структура репозитория
|
||||||
|
|
||||||
|
| Путь | Содержимое |
|
||||||
|
|---|---|
|
||||||
|
| `/` | модель после reasoning-SFT, bf16 safetensors |
|
||||||
|
| `/gguf` | GGUF: F16, Q8_0 |
|
||||||
|
| `/lora` | reasoning-LoRA (r=16) отдельно — применима к merge-версии из истории коммитов |
|
||||||
|
|
||||||
|
## Запуск
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
repo = "kaufkino/MiniCPM5-1B-Fable5-Thinking-T-Wix-ru"
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(repo, dtype="bfloat16", device_map="auto")
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(repo)
|
||||||
|
|
||||||
|
messages = [{"role": "user", "content": "Реши: 17 * 23 = ?"}]
|
||||||
|
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True,
|
||||||
|
return_tensors="pt", return_dict=True).to(model.device)
|
||||||
|
out = model.generate(**inputs, max_new_tokens=1500, temperature=0.5, top_p=0.95,
|
||||||
|
do_sample=True, repetition_penalty=1.1)
|
||||||
|
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
||||||
|
```
|
||||||
|
|
||||||
|
Chat template (включая tools-формат и `enable_thinking`) унаследован от дистиллята.
|
||||||
|
Принудительно выключить размышления: `enable_thinking=False` в `apply_chat_template`.
|
||||||
|
|
||||||
|
## Инфраструктура
|
||||||
|
|
||||||
|
Собрано на облачном GPU-сервере [Selectel](https://selectel.ru/?ref_code=d71285bdb8) *(реферальная ссылка)*.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**EN:** Russian 1B model with working think-mode: T-Wix Russian LoRA merged onto a Claude Opus/Fable5 distill, then SFT'd on the T-Wix reasoning subset (31k Russian think-traces, r=16, 1 epoch). Think auto-triggers on reasoning tasks in the question's language and closes properly; tool calling preserved. Known issues: weak Russian factual recall (use RAG), unstable EN→RU translation, use repetition_penalty=1.1 and max_new_tokens≥1000. Research artifact, no formal evals.
|
||||||
179
chat_template.jinja
Normal file
179
chat_template.jinja
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
{{- bos_token }}{%- if tools %}
|
||||||
|
{%- set tool_definitions %}
|
||||||
|
{{- "# Tools\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{- "\n" }}
|
||||||
|
{{- tool | tojson(ensure_ascii=False) }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- '\n</tools>\n\nTool usage guidelines:\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\n- When calling a function, return an XML object within <function ... </function> using:\n<function name="function-name"><param name="param-name">param-value</param></function>\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name="param-name"><![CDATA[...multi-line value...]]></param>' }}
|
||||||
|
{%- endset %}
|
||||||
|
|
||||||
|
{{- '<|im_start|>system\n' }}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{%- if '<tool_def_sep>' in messages[0].content %}
|
||||||
|
{{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}
|
||||||
|
{%- else %}
|
||||||
|
{{- messages[0].content + '\n\n' + tool_definitions }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
{{- tool_definitions.lstrip() }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- else %}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||||
|
{%- for message in messages[::-1] %}
|
||||||
|
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||||
|
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
||||||
|
{%- set ns.multi_step_tool = false %}
|
||||||
|
{%- set ns.last_query_index = index %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if message.content is string %}
|
||||||
|
{%- set content = message.content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set content = '' %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||||
|
{%- elif message.role == "assistant" %}
|
||||||
|
{%- set reasoning_content = '' %}
|
||||||
|
{%- if message.reasoning_content is string %}
|
||||||
|
{%- set reasoning_content = message.reasoning_content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- if '</think>' in content %}
|
||||||
|
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
||||||
|
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if message.tool_calls %}
|
||||||
|
{%- set content_parts = content.split('<tool_sep>') %}
|
||||||
|
{%- set processed_content = content_parts[0] %}
|
||||||
|
{%- set tool_calls_count = message.tool_calls|length %}
|
||||||
|
{%- set tool_sep_count = content_parts|length - 1 %}
|
||||||
|
{%- set min_count = [tool_calls_count, tool_sep_count]|min %}
|
||||||
|
|
||||||
|
{%- for i in range(1, content_parts|length) %}
|
||||||
|
{%- set tool_index = i - 1 %}
|
||||||
|
{%- if tool_index < tool_calls_count %}
|
||||||
|
{%- set tool_call = message.tool_calls[tool_index] %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set single_tool_xml %}
|
||||||
|
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
||||||
|
{%- if tool_call.arguments %}
|
||||||
|
{%- set args_dict = tool_call.arguments %}
|
||||||
|
{%- for param_name, param_value in args_dict.items() %}
|
||||||
|
{{- '<param name="' ~ param_name ~ '">' }}
|
||||||
|
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
||||||
|
{{- '<![CDATA[' + param_value + ']]>' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- param_value }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</param>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</function>' }}
|
||||||
|
{%- endset %}
|
||||||
|
{%- set processed_content = processed_content + single_tool_xml + content_parts[i] %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set processed_content = processed_content + content_parts[i] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- if tool_calls_count > tool_sep_count %}
|
||||||
|
{%- for remaining_index in range(tool_sep_count, tool_calls_count) %}
|
||||||
|
{%- set tool_call = message.tool_calls[remaining_index] %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set remaining_tool_xml %}
|
||||||
|
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
||||||
|
{%- if tool_call.arguments %}
|
||||||
|
{%- set args_dict = tool_call.arguments %}
|
||||||
|
{%- for param_name, param_value in args_dict.items() %}
|
||||||
|
{{- '<param name="' ~ param_name ~ '">' }}
|
||||||
|
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
||||||
|
{{- '<![CDATA[' + param_value + ']]>' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- param_value }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</param>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</function>' }}
|
||||||
|
{%- endset %}
|
||||||
|
{%- set processed_content = processed_content + remaining_tool_xml %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- set content = processed_content %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if loop.index0 > ns.last_query_index %}
|
||||||
|
{%- if reasoning_content %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if message.tool_calls and not has_tool_sep %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if (loop.first and content) or (not loop.first) %}
|
||||||
|
{{- '\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
||||||
|
{%- if tool_call.arguments %}
|
||||||
|
{%- set args_dict = tool_call.arguments %}
|
||||||
|
{%- for param_name, param_value in args_dict.items() %}
|
||||||
|
{{- '<param name="' ~ param_name ~ '">' }}
|
||||||
|
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
||||||
|
{{- '<![CDATA[' + param_value + ']]>' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- param_value }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</param>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</function>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- elif message.role == "tool" %}
|
||||||
|
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||||
|
{{- '<|im_start|>user' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_response>\n' }}
|
||||||
|
{%- if message.content is string %}
|
||||||
|
{{- content }}
|
||||||
|
{%- else %}
|
||||||
|
{{- message.content | tojson(ensure_ascii=False) }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n</tool_response>' }}
|
||||||
|
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|im_start|>assistant\n' }}
|
||||||
|
{%- if enable_thinking is defined %}
|
||||||
|
{%- if enable_thinking is false %}
|
||||||
|
{{- '<think>\n\n</think>\n\n' }}
|
||||||
|
{%- elif enable_thinking is true %}
|
||||||
|
{{- '<think>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
32
config.json
Normal file
32
config.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 0,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"eos_token_id": 1,
|
||||||
|
"head_dim": 128,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 1536,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 4608,
|
||||||
|
"max_position_embeddings": 131072,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 16,
|
||||||
|
"num_hidden_layers": 24,
|
||||||
|
"num_key_value_heads": 2,
|
||||||
|
"pad_token_id": 130559,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 5000000,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"unsloth_version": "2026.7.3",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 130560
|
||||||
|
}
|
||||||
15
generation_config.json
Normal file
15
generation_config.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 0,
|
||||||
|
"do_sample": true,
|
||||||
|
"eos_token_id": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
130073
|
||||||
|
],
|
||||||
|
"max_length": 131072,
|
||||||
|
"pad_token_id": 130559,
|
||||||
|
"temperature": 0.9,
|
||||||
|
"top_p": 0.95,
|
||||||
|
"transformers_version": "5.5.0"
|
||||||
|
}
|
||||||
3
gguf/minicpm5-1b-fable5-twix-ru-f16.gguf
Normal file
3
gguf/minicpm5-1b-fable5-twix-ru-f16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c1ff7e64e84e32be9cab2db55c4fdf2beaea2c49a33104b9e449810d0744a6e3
|
||||||
|
size 2166551840
|
||||||
3
gguf/minicpm5-1b-fable5-twix-ru-q8_0.gguf
Normal file
3
gguf/minicpm5-1b-fable5-twix-ru-q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:50ca3db7cc2308527e27d93c3a11119a6b18b904afbed8cf82561971c65f9ebc
|
||||||
|
size 1153529120
|
||||||
52
lora/adapter_config.json
Normal file
52
lora/adapter_config.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"alora_invocation_tokens": null,
|
||||||
|
"alpha_pattern": {},
|
||||||
|
"arrow_config": null,
|
||||||
|
"auto_mapping": {
|
||||||
|
"base_model_class": "LlamaForCausalLM",
|
||||||
|
"parent_library": "transformers.models.llama.modeling_llama",
|
||||||
|
"unsloth_fixed": true
|
||||||
|
},
|
||||||
|
"base_model_name_or_path": "/root/minicpm5-distill-twix-ru/final_merged",
|
||||||
|
"bias": "none",
|
||||||
|
"corda_config": null,
|
||||||
|
"ensure_weight_tying": false,
|
||||||
|
"eva_config": null,
|
||||||
|
"exclude_modules": null,
|
||||||
|
"fan_in_fan_out": false,
|
||||||
|
"inference_mode": true,
|
||||||
|
"init_lora_weights": true,
|
||||||
|
"layer_replication": null,
|
||||||
|
"layers_pattern": null,
|
||||||
|
"layers_to_transform": null,
|
||||||
|
"loftq_config": {},
|
||||||
|
"lora_alpha": 32,
|
||||||
|
"lora_bias": false,
|
||||||
|
"lora_dropout": 0.0,
|
||||||
|
"lora_ga_config": null,
|
||||||
|
"megatron_config": null,
|
||||||
|
"megatron_core": "megatron.core",
|
||||||
|
"modules_to_save": null,
|
||||||
|
"peft_type": "LORA",
|
||||||
|
"peft_version": "0.19.1",
|
||||||
|
"qalora_group_size": 16,
|
||||||
|
"r": 16,
|
||||||
|
"rank_pattern": {},
|
||||||
|
"revision": null,
|
||||||
|
"target_modules": [
|
||||||
|
"gate_proj",
|
||||||
|
"k_proj",
|
||||||
|
"v_proj",
|
||||||
|
"down_proj",
|
||||||
|
"up_proj",
|
||||||
|
"q_proj",
|
||||||
|
"o_proj"
|
||||||
|
],
|
||||||
|
"target_parameters": null,
|
||||||
|
"task_type": "CAUSAL_LM",
|
||||||
|
"trainable_token_indices": null,
|
||||||
|
"use_bdlora": null,
|
||||||
|
"use_dora": false,
|
||||||
|
"use_qalora": false,
|
||||||
|
"use_rslora": false
|
||||||
|
}
|
||||||
3
lora/adapter_model.safetensors
Normal file
3
lora/adapter_model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:edd3e0caba2fb4d1c398e279a3c441104c17204008bce17f1adb647fa4483010
|
||||||
|
size 44871152
|
||||||
179
lora/chat_template.jinja
Normal file
179
lora/chat_template.jinja
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
{{- bos_token }}{%- if tools %}
|
||||||
|
{%- set tool_definitions %}
|
||||||
|
{{- "# Tools\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{- "\n" }}
|
||||||
|
{{- tool | tojson(ensure_ascii=False) }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- '\n</tools>\n\nTool usage guidelines:\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\n- When calling a function, return an XML object within <function ... </function> using:\n<function name="function-name"><param name="param-name">param-value</param></function>\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name="param-name"><![CDATA[...multi-line value...]]></param>' }}
|
||||||
|
{%- endset %}
|
||||||
|
|
||||||
|
{{- '<|im_start|>system\n' }}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{%- if '<tool_def_sep>' in messages[0].content %}
|
||||||
|
{{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}
|
||||||
|
{%- else %}
|
||||||
|
{{- messages[0].content + '\n\n' + tool_definitions }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
{{- tool_definitions.lstrip() }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- else %}
|
||||||
|
{%- if messages[0].role == 'system' %}
|
||||||
|
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||||
|
{%- for message in messages[::-1] %}
|
||||||
|
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||||
|
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
||||||
|
{%- set ns.multi_step_tool = false %}
|
||||||
|
{%- set ns.last_query_index = index %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if message.content is string %}
|
||||||
|
{%- set content = message.content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set content = '' %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||||
|
{%- elif message.role == "assistant" %}
|
||||||
|
{%- set reasoning_content = '' %}
|
||||||
|
{%- if message.reasoning_content is string %}
|
||||||
|
{%- set reasoning_content = message.reasoning_content %}
|
||||||
|
{%- else %}
|
||||||
|
{%- if '</think>' in content %}
|
||||||
|
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
||||||
|
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if message.tool_calls %}
|
||||||
|
{%- set content_parts = content.split('<tool_sep>') %}
|
||||||
|
{%- set processed_content = content_parts[0] %}
|
||||||
|
{%- set tool_calls_count = message.tool_calls|length %}
|
||||||
|
{%- set tool_sep_count = content_parts|length - 1 %}
|
||||||
|
{%- set min_count = [tool_calls_count, tool_sep_count]|min %}
|
||||||
|
|
||||||
|
{%- for i in range(1, content_parts|length) %}
|
||||||
|
{%- set tool_index = i - 1 %}
|
||||||
|
{%- if tool_index < tool_calls_count %}
|
||||||
|
{%- set tool_call = message.tool_calls[tool_index] %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set single_tool_xml %}
|
||||||
|
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
||||||
|
{%- if tool_call.arguments %}
|
||||||
|
{%- set args_dict = tool_call.arguments %}
|
||||||
|
{%- for param_name, param_value in args_dict.items() %}
|
||||||
|
{{- '<param name="' ~ param_name ~ '">' }}
|
||||||
|
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
||||||
|
{{- '<![CDATA[' + param_value + ']]>' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- param_value }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</param>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</function>' }}
|
||||||
|
{%- endset %}
|
||||||
|
{%- set processed_content = processed_content + single_tool_xml + content_parts[i] %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set processed_content = processed_content + content_parts[i] %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- if tool_calls_count > tool_sep_count %}
|
||||||
|
{%- for remaining_index in range(tool_sep_count, tool_calls_count) %}
|
||||||
|
{%- set tool_call = message.tool_calls[remaining_index] %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set remaining_tool_xml %}
|
||||||
|
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
||||||
|
{%- if tool_call.arguments %}
|
||||||
|
{%- set args_dict = tool_call.arguments %}
|
||||||
|
{%- for param_name, param_value in args_dict.items() %}
|
||||||
|
{{- '<param name="' ~ param_name ~ '">' }}
|
||||||
|
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
||||||
|
{{- '<![CDATA[' + param_value + ']]>' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- param_value }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</param>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</function>' }}
|
||||||
|
{%- endset %}
|
||||||
|
{%- set processed_content = processed_content + remaining_tool_xml %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- set content = processed_content %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if loop.index0 > ns.last_query_index %}
|
||||||
|
{%- if reasoning_content %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if message.tool_calls and not has_tool_sep %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if (loop.first and content) or (not loop.first) %}
|
||||||
|
{{- '\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if tool_call.function %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
||||||
|
{%- if tool_call.arguments %}
|
||||||
|
{%- set args_dict = tool_call.arguments %}
|
||||||
|
{%- for param_name, param_value in args_dict.items() %}
|
||||||
|
{{- '<param name="' ~ param_name ~ '">' }}
|
||||||
|
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
||||||
|
{{- '<![CDATA[' + param_value + ']]>' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- param_value }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</param>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '</function>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- elif message.role == "tool" %}
|
||||||
|
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||||
|
{{- '<|im_start|>user' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_response>\n' }}
|
||||||
|
{%- if message.content is string %}
|
||||||
|
{{- content }}
|
||||||
|
{%- else %}
|
||||||
|
{{- message.content | tojson(ensure_ascii=False) }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n</tool_response>' }}
|
||||||
|
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|im_start|>assistant\n' }}
|
||||||
|
{%- if enable_thinking is defined %}
|
||||||
|
{%- if enable_thinking is false %}
|
||||||
|
{{- '<think>\n\n</think>\n\n' }}
|
||||||
|
{%- elif enable_thinking is true %}
|
||||||
|
{{- '<think>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
653947
lora/tokenizer.json
Normal file
653947
lora/tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
4100
lora/tokenizer_config.json
Normal file
4100
lora/tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e3de79c3d784024f5dfff0aefb62e76ec98a1df48d65775159c89d2bd2ce9da2
|
||||||
|
size 2161290944
|
||||||
653947
tokenizer.json
Normal file
653947
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
4101
tokenizer_config.json
Normal file
4101
tokenizer_config.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user