Instructions to use XavierLocalAI/Hy3-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use XavierLocalAI/Hy3-4bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("XavierLocalAI/Hy3-4bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use XavierLocalAI/Hy3-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "XavierLocalAI/Hy3-4bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "XavierLocalAI/Hy3-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use XavierLocalAI/Hy3-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "XavierLocalAI/Hy3-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default XavierLocalAI/Hy3-4bit
Run Hermes
hermes
- OpenClaw new
How to use XavierLocalAI/Hy3-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "XavierLocalAI/Hy3-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "XavierLocalAI/Hy3-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use XavierLocalAI/Hy3-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "XavierLocalAI/Hy3-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "XavierLocalAI/Hy3-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XavierLocalAI/Hy3-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
Add files using upload-large-folder tool
Browse files- README.md +72 -0
- chat_template.jinja +222 -0
- config.json +0 -0
- generation_config.json +10 -0
- model-00001-of-00034.safetensors +3 -0
- model-00002-of-00034.safetensors +3 -0
- model-00003-of-00034.safetensors +3 -0
- model-00004-of-00034.safetensors +3 -0
- model-00005-of-00034.safetensors +3 -0
- model-00006-of-00034.safetensors +3 -0
- model-00007-of-00034.safetensors +3 -0
- model-00008-of-00034.safetensors +3 -0
- model-00009-of-00034.safetensors +3 -0
- model-00010-of-00034.safetensors +3 -0
- model-00011-of-00034.safetensors +3 -0
- model-00012-of-00034.safetensors +3 -0
- model-00013-of-00034.safetensors +3 -0
- model-00014-of-00034.safetensors +3 -0
- model-00015-of-00034.safetensors +3 -0
- model-00016-of-00034.safetensors +3 -0
- model-00017-of-00034.safetensors +3 -0
- model-00018-of-00034.safetensors +3 -0
- model-00019-of-00034.safetensors +3 -0
- model-00020-of-00034.safetensors +3 -0
- model-00021-of-00034.safetensors +3 -0
- model-00022-of-00034.safetensors +3 -0
- model-00023-of-00034.safetensors +3 -0
- model-00024-of-00034.safetensors +3 -0
- model-00025-of-00034.safetensors +3 -0
- model-00026-of-00034.safetensors +3 -0
- model-00027-of-00034.safetensors +3 -0
- model-00028-of-00034.safetensors +3 -0
- model-00029-of-00034.safetensors +3 -0
- model-00030-of-00034.safetensors +3 -0
- model-00031-of-00034.safetensors +3 -0
- model-00032-of-00034.safetensors +3 -0
- model-00033-of-00034.safetensors +3 -0
- model-00034-of-00034.safetensors +3 -0
- model.safetensors.index.json +0 -0
- tokenizer.json +0 -0
- tokenizer_config.json +12 -0
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: tencent/Hy3
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
tags:
|
| 6 |
+
- mlx
|
| 7 |
+
- hunyuan
|
| 8 |
+
- hy3
|
| 9 |
+
- moe
|
| 10 |
+
pipeline_tag: text-generation
|
| 11 |
+
library_name: mlx
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Hy3-4bit (MLX)
|
| 15 |
+
|
| 16 |
+
A clean 4-bit MLX quantization of [tencent/Hy3](https://huggingface.co/tencent/Hy3) (Hunyuan 3.0, Apache-2.0), converted with `mlx-lm` and verified running on Apple Silicon.
|
| 17 |
+
|
| 18 |
+
Hy3 is a 295B-parameter Mixture-of-Experts model with **21B active parameters**, 80 layers, 192 routed experts (top-8) plus one shared expert, a native MTP (multi-token-prediction) head, and 256K context.
|
| 19 |
+
|
| 20 |
+
## Why this quant is clean
|
| 21 |
+
|
| 22 |
+
Naive uniform 4-bit quantization degrades MoE models badly, because the router that picks which experts fire is precision-sensitive. This build follows a mixed-precision recipe:
|
| 23 |
+
|
| 24 |
+
- **4-bit** (group size 64, affine) for attention and expert weights
|
| 25 |
+
- **8-bit** for every MoE router gate (`*.mlp.router.gate`)
|
| 26 |
+
- MTP head preserved
|
| 27 |
+
|
| 28 |
+
That router protection is the difference between a coherent model and mush, and it matches the recipe used by the reference `mlx-community/Hy3-preview-4bit`.
|
| 29 |
+
|
| 30 |
+
## Footprint
|
| 31 |
+
|
| 32 |
+
- Weights: ~166 GB
|
| 33 |
+
- Fits: two 128GB Apple Silicon machines (or one 192GB+ Mac), does not fit a single 128GB machine at 4-bit.
|
| 34 |
+
|
| 35 |
+
## How it was made
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from mlx_lm.convert import convert
|
| 39 |
+
|
| 40 |
+
def hy3_predicate(path, module, config=None):
|
| 41 |
+
if path.endswith("mlp.router.gate"):
|
| 42 |
+
return {"group_size": 64, "bits": 8}
|
| 43 |
+
return {"group_size": 64, "bits": 4}
|
| 44 |
+
|
| 45 |
+
convert(
|
| 46 |
+
hf_path="tencent/Hy3",
|
| 47 |
+
mlx_path="Hy3-4bit",
|
| 48 |
+
quantize=True, q_bits=4, q_group_size=64, q_mode="affine",
|
| 49 |
+
quant_predicate=hy3_predicate,
|
| 50 |
+
)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
`hy_v3` architecture support comes from [mlx-lm PR #1211](https://github.com/ml-explore/mlx-lm/pull/1211).
|
| 54 |
+
|
| 55 |
+
## Benchmarks (2x M5 Max, Thunderbolt RDMA)
|
| 56 |
+
|
| 57 |
+
Measured on two M5 Max (128GB each), pipeline-parallel over Thunderbolt with Apple's `jaccl` RDMA backend (`MLX_METAL_FAST_SYNCH=1`). Single-stream decode.
|
| 58 |
+
|
| 59 |
+
| Metric | Value |
|
| 60 |
+
|---|---|
|
| 61 |
+
| Decode (generation) | **36.91 tok/s** |
|
| 62 |
+
| Prompt (prefill) | 8.6 tok/s |
|
| 63 |
+
| Peak memory / node | 84.4 GB |
|
| 64 |
+
| Backend | jaccl (RDMA), pipeline-parallel |
|
| 65 |
+
|
| 66 |
+
Notes: at 4-bit (~166GB) the model does not fit a single 128GB machine, so this is a genuine 2-node cluster run. The `ring`/TCP backend trips the macOS Metal command-buffer watchdog on the cross-node fence wait; RDMA (`jaccl`) is required for stable single-stream decode.
|
| 67 |
+
|
| 68 |
+
## Credits
|
| 69 |
+
|
| 70 |
+
- Base model: Tencent Hunyuan (`tencent/Hy3`, Apache-2.0)
|
| 71 |
+
- Architecture support: mlx-lm PR #1211
|
| 72 |
+
- Quantization + Apple Silicon cluster benchmark: bicVanYonk
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#- ----------‑‑‑ special token variables ‑‑‑---------- -#}
|
| 2 |
+
{%- set HYTK = ':opensource' %}
|
| 3 |
+
{%- set eos_token = '<|hy_eos{}|>'.format(HYTK) %}
|
| 4 |
+
{%- set bos_token = '<|hy_begin_of_sentence{}|>'.format(HYTK) %}
|
| 5 |
+
{%- set pad_token = '<|hy_pad{}|>'.format(HYTK) %}
|
| 6 |
+
{%- set user_token = '<|hy_User{}|>'.format(HYTK) %}
|
| 7 |
+
{%- set assistant_token = '<|hy_Assistant{}|>'.format(HYTK) %}
|
| 8 |
+
{%- set think_begin_token = '<think{}>'.format(HYTK) %}
|
| 9 |
+
{%- set think_end_token = '</think{}>'.format(HYTK) %}
|
| 10 |
+
{%- set toolcalls_begin_token = '<tool_calls{}>'.format(HYTK) %}
|
| 11 |
+
{%- set toolcalls_end_token = '</tool_calls{}>'.format(HYTK) %}
|
| 12 |
+
{%- set toolcall_begin_token = '<tool_call{}>'.format(HYTK) %}
|
| 13 |
+
{%- set toolcall_end_token = '</tool_call{}>'.format(HYTK) %}
|
| 14 |
+
{%- set toolsep_token = '<tool_sep{}>'.format(HYTK) %}
|
| 15 |
+
{%- set argkey_begin_token = '<arg_key{}>'.format(HYTK) %}
|
| 16 |
+
{%- set argkey_end_token = '</arg_key{}>'.format(HYTK) %}
|
| 17 |
+
{%- set argvalue_begin_token = '<arg_value{}>'.format(HYTK) %}
|
| 18 |
+
{%- set argvalue_end_token = '</arg_value{}>'.format(HYTK) %}
|
| 19 |
+
{%- set toolresponses_begin_token = '<tool_responses{}>'.format(HYTK) %}
|
| 20 |
+
{%- set toolresponses_end_token = '</tool_responses{}>'.format(HYTK) %}
|
| 21 |
+
{%- set toolresponse_begin_token = '<tool_response{}>'.format(HYTK) %}
|
| 22 |
+
{%- set toolresponse_end_token = '</tool_response{}>'.format(HYTK) %}
|
| 23 |
+
{%- set reasoning_mode_token = '<|reasoning_mode{}|>'.format(HYTK) %}
|
| 24 |
+
|
| 25 |
+
{#- ----------‑‑‑ hyperparameters variables ‑‑‑---------- -#}
|
| 26 |
+
{%- if not add_generation_prompt is defined %}
|
| 27 |
+
{%- set add_generation_prompt = false %}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- if not preserved_thinking is defined %}
|
| 30 |
+
{%- if not tools %}
|
| 31 |
+
{%- set preserved_thinking = false %}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{%- set preserved_thinking = true %}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endif %}
|
| 36 |
+
{%- if not is_training is defined %}
|
| 37 |
+
{%- set is_training = false %}
|
| 38 |
+
{%- endif %}
|
| 39 |
+
|
| 40 |
+
{%- if not reasoning_effort is defined %}
|
| 41 |
+
{%- set reasoning_effort = 'no_think' %}
|
| 42 |
+
{%- elif reasoning_effort not in ['high', 'low', 'no_think'] %}
|
| 43 |
+
{%- if reasoning_effort is none %}
|
| 44 |
+
{{- raise_exception('reasoning_effort error : None, should be no_think/low/high') }}
|
| 45 |
+
{%- else %}
|
| 46 |
+
{{- raise_exception('reasoning_effort error : ' + reasoning_effort + ', should be no_think/low/high') }}
|
| 47 |
+
{%- endif %}
|
| 48 |
+
{%- endif %}
|
| 49 |
+
|
| 50 |
+
{%- if fallback_strategy is defined and fallback_strategy == 'reasoning_toolcall_retry' %}
|
| 51 |
+
{%- set reasoning_effort = 'high' %}
|
| 52 |
+
{%- set add_generation_prompt = false %}
|
| 53 |
+
{%- endif %}
|
| 54 |
+
{%- if not raw_last_assistant is defined %}
|
| 55 |
+
{%- set raw_last_assistant = false %}
|
| 56 |
+
{%- endif %}
|
| 57 |
+
|
| 58 |
+
{%- macro visible_text(content) -%}
|
| 59 |
+
{%- if content is string -%}
|
| 60 |
+
{{- content }}
|
| 61 |
+
{%- elif content is iterable and content is not mapping -%}
|
| 62 |
+
{%- for item in content -%}
|
| 63 |
+
{%- if item is mapping and item.type == 'text' -%}
|
| 64 |
+
{{- item.text }}
|
| 65 |
+
{%- elif item is string -%}
|
| 66 |
+
{{- item }}
|
| 67 |
+
{%- endif -%}
|
| 68 |
+
{%- endfor -%}
|
| 69 |
+
{%- elif content is none -%}
|
| 70 |
+
{{- '' }}
|
| 71 |
+
{%- else -%}
|
| 72 |
+
{{- content }}
|
| 73 |
+
{%- endif -%}
|
| 74 |
+
{%- endmacro -%}
|
| 75 |
+
|
| 76 |
+
{%- set ns = namespace(last_user_index=-1) %}
|
| 77 |
+
{%- set sp_ns = namespace(system_prompt='', is_first_sp=true) %}
|
| 78 |
+
{%- for message in messages %}
|
| 79 |
+
{%- if message['role'] == 'system' %}
|
| 80 |
+
{%- set sp_ns.system_prompt = sp_ns.system_prompt + visible_text(message['content']) %}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{%- if message['role'] == 'user' %}
|
| 83 |
+
{%- set ns.last_user_index = loop.index0 %}
|
| 84 |
+
{%- endif %}
|
| 85 |
+
{%- endfor %}
|
| 86 |
+
{%- if reasoning_effort is defined and reasoning_effort is string and reasoning_effort != '' and not tools %}
|
| 87 |
+
{%- set sp_ns.system_prompt = sp_ns.system_prompt + reasoning_mode_token + 'reasoning_effort:' + reasoning_effort %}
|
| 88 |
+
{%- endif %}
|
| 89 |
+
{{- bos_token }}
|
| 90 |
+
{{- sp_ns.system_prompt }}
|
| 91 |
+
{%- if tools %}
|
| 92 |
+
{%- if sp_ns.system_prompt != '' %}
|
| 93 |
+
{{- '\n\n# Tools\n\nYou may call one or more functions to assist with the user query.' }}
|
| 94 |
+
{%- else %}
|
| 95 |
+
{{- '# Tools\n\nYou may call one or more functions to assist with the user query.' }}
|
| 96 |
+
{%- endif %}
|
| 97 |
+
{{- '\n\nYou are provided with function signatures within <tools></tools> XML tags:' }}
|
| 98 |
+
{{- '\n<tools>\n' }}
|
| 99 |
+
{%- for tool in tools %}
|
| 100 |
+
{%- if loop.index0 > 0 %}
|
| 101 |
+
{{- '\n' }}
|
| 102 |
+
{%- endif %}
|
| 103 |
+
{{- tool | tojson }}
|
| 104 |
+
{%- endfor %}
|
| 105 |
+
{{- '\n</tools>\n\n' }}
|
| 106 |
+
{{- 'For function call returns, you should first print ' + toolcalls_begin_token + '\n' }}
|
| 107 |
+
{{- 'For each function call, you should return object like:\n' }}
|
| 108 |
+
{{- toolcall_begin_token + '{function-name}' + toolsep_token + '\n' }}
|
| 109 |
+
{{- argkey_begin_token + '{arg-key-1}' + argkey_end_token + '\n' }}
|
| 110 |
+
{{- argvalue_begin_token + '{arg-value-1}' + argvalue_end_token + '\n' }}
|
| 111 |
+
{{- argkey_begin_token + '{arg-key-2}' + argkey_end_token + '\n' }}
|
| 112 |
+
{{- argvalue_begin_token + '{arg-value-2}' + argvalue_end_token + '\n' }}
|
| 113 |
+
{{- '...\n' }}
|
| 114 |
+
{{- toolcall_end_token + '\n' }}
|
| 115 |
+
{%- if reasoning_effort is defined and reasoning_effort is string and reasoning_effort != '' %}
|
| 116 |
+
{{- 'At the end of function call returns, you should print ' + toolcalls_end_token + reasoning_mode_token + 'reasoning_effort:' + reasoning_effort }}
|
| 117 |
+
{%- else %}
|
| 118 |
+
{{- 'At the end of function call returns, you should print ' + toolcalls_end_token }}
|
| 119 |
+
{%- endif %}
|
| 120 |
+
{%- endif %}
|
| 121 |
+
|
| 122 |
+
{%- set prev_ns = namespace(is_tool=false, is_tool_first=true) %}
|
| 123 |
+
{%- set last_ns = namespace(last_is_assistant=false) %}
|
| 124 |
+
{%- for message in messages %}
|
| 125 |
+
{%- if message['role'] == 'user' %}
|
| 126 |
+
{%- if prev_ns.is_tool %}
|
| 127 |
+
{{- toolresponses_end_token }}
|
| 128 |
+
{%- endif %}
|
| 129 |
+
{{- user_token + visible_text(message['content']) }}
|
| 130 |
+
{%- set prev_ns.is_tool = false %}
|
| 131 |
+
{%- endif %}
|
| 132 |
+
{%- if message['role'] == 'assistant' %}
|
| 133 |
+
{%- if is_training %}
|
| 134 |
+
{%- if 'reasoning_content' in message and message['reasoning_content'] is string %}
|
| 135 |
+
{%- set rc = message['reasoning_content'] %}
|
| 136 |
+
{%- elif 'reasoning' in message and message['reasoning'] is string %}
|
| 137 |
+
{%- set rc = message['reasoning'] %}
|
| 138 |
+
{%- else %}
|
| 139 |
+
{%- set rc = none %}
|
| 140 |
+
{%- endif %}
|
| 141 |
+
{%- if rc is not none %}
|
| 142 |
+
{%- set content = think_begin_token + rc + think_end_token + visible_text(message['content']) %}
|
| 143 |
+
{%- else %}
|
| 144 |
+
{%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{%- else %}
|
| 147 |
+
{%- if ((preserved_thinking is defined and preserved_thinking) or loop.index0 > ns.last_user_index) %}
|
| 148 |
+
{%- if 'reasoning_content' in message and message['reasoning_content'] is string %}
|
| 149 |
+
{%- set rc = message['reasoning_content'] %}
|
| 150 |
+
{%- elif 'reasoning' in message and message['reasoning'] is string %}
|
| 151 |
+
{%- set rc = message['reasoning'] %}
|
| 152 |
+
{%- else %}
|
| 153 |
+
{%- set rc = none %}
|
| 154 |
+
{%- endif %}
|
| 155 |
+
{%- if rc is not none %}
|
| 156 |
+
{%- set content = think_begin_token + rc + think_end_token + visible_text(message['content']) %}
|
| 157 |
+
{%- else %}
|
| 158 |
+
{%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
|
| 159 |
+
{%- endif %}
|
| 160 |
+
{%- else %}
|
| 161 |
+
{%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
|
| 162 |
+
{%- endif %}
|
| 163 |
+
{%- endif %}
|
| 164 |
+
{%- if prev_ns.is_tool %}
|
| 165 |
+
{{- toolresponses_end_token }}
|
| 166 |
+
{%- endif %}
|
| 167 |
+
{{- assistant_token }}
|
| 168 |
+
{%- if message['tool_calls'] is defined and message['tool_calls'] %}
|
| 169 |
+
{%- set prev_ns.is_tool_first = true %}
|
| 170 |
+
{{- content }}
|
| 171 |
+
{{- toolcalls_begin_token + '\n' }}
|
| 172 |
+
{%- for tool in message['tool_calls'] %}
|
| 173 |
+
{%- set arguments = tool['function']['arguments'] %}
|
| 174 |
+
{{- toolcall_begin_token + tool['function']['name'] + toolsep_token + '\n' }}
|
| 175 |
+
{%- for key, value in arguments.items() %}
|
| 176 |
+
{{- argkey_begin_token + key + argkey_end_token + '\n' }}
|
| 177 |
+
{%- if value is not string %}
|
| 178 |
+
{%- set value = value | tojson(ensure_ascii=False) %}
|
| 179 |
+
{%- endif %}
|
| 180 |
+
{{- argvalue_begin_token + value + argvalue_end_token + '\n' }}
|
| 181 |
+
{%- endfor %}
|
| 182 |
+
{{- toolcall_end_token + '\n' }}
|
| 183 |
+
{%- endfor %}
|
| 184 |
+
{{- toolcalls_end_token + eos_token }}
|
| 185 |
+
{%- else %}
|
| 186 |
+
{%- if loop.last and raw_last_assistant %}
|
| 187 |
+
{{- visible_text(message['content']) }}
|
| 188 |
+
{%- elif not loop.last or is_training %}
|
| 189 |
+
{{- content + eos_token }}
|
| 190 |
+
{%- else %}
|
| 191 |
+
{{- content }}
|
| 192 |
+
{%- endif %}
|
| 193 |
+
{%- endif %}
|
| 194 |
+
{%- set prev_ns.is_tool = false %}
|
| 195 |
+
{%- endif %}
|
| 196 |
+
{%- if message['role'] == 'tool' %}
|
| 197 |
+
{%- set prev_ns.is_tool = true %}
|
| 198 |
+
{%- if prev_ns.is_tool_first %}
|
| 199 |
+
{{- toolresponses_begin_token + '\n' }}
|
| 200 |
+
{%- set prev_ns.is_tool_first = false %}
|
| 201 |
+
{%- endif %}
|
| 202 |
+
{{- toolresponse_begin_token + '\n' + visible_text(message['content']) + '\n' + toolresponse_end_token + '\n' }}
|
| 203 |
+
{%- endif %}
|
| 204 |
+
{%- if loop.last and message['role'] == 'assistant' %}
|
| 205 |
+
{%- set last_ns.last_is_assistant = true %}
|
| 206 |
+
{%- endif %}
|
| 207 |
+
|
| 208 |
+
{%- endfor %}
|
| 209 |
+
{%- if prev_ns.is_tool %}
|
| 210 |
+
{{- toolresponses_end_token }}
|
| 211 |
+
{%- endif %}
|
| 212 |
+
{%- if add_generation_prompt %}
|
| 213 |
+
{%- if not last_ns.last_is_assistant %}
|
| 214 |
+
{%- if reasoning_effort is defined and reasoning_effort in ['low', 'high'] %}
|
| 215 |
+
{{- assistant_token + think_begin_token }}
|
| 216 |
+
{%- elif reasoning_effort is defined and reasoning_effort == 'no_think' %}
|
| 217 |
+
{{- assistant_token + think_begin_token + think_end_token }}
|
| 218 |
+
{%- else %}
|
| 219 |
+
{{- assistant_token }}
|
| 220 |
+
{%- endif %}
|
| 221 |
+
{%- endif %}
|
| 222 |
+
{%- endif %}
|
config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 120000,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 120025,
|
| 5 |
+
"pad_token_id": 120002,
|
| 6 |
+
"temperature": 0.9,
|
| 7 |
+
"top_k": -1,
|
| 8 |
+
"top_p": 1,
|
| 9 |
+
"transformers_version": "5.6.0"
|
| 10 |
+
}
|
model-00001-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:93db49e2c938d02ec216259d1e5f600a4256c4a2f130f19608c7c95c831456fb
|
| 3 |
+
size 5319591251
|
model-00002-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:145fbc7a1ba5ebea79e748b128e5d29284284109ff6972a7c1b0de971bbb1a40
|
| 3 |
+
size 4864224955
|
model-00003-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61e6ccaa612058a5b644ee2fb2abbcff9b3433e632ce5cf3edf2e481d4ffaba6
|
| 3 |
+
size 4918165689
|
model-00004-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d7e943443b0225d8dc6e71e5389d51523799ea9cfeabc16cb1579a1f3dc82c61
|
| 3 |
+
size 4864224960
|
model-00005-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3ec450b0cd36244d07c2c6c2a80ea93f86fc8e2b2f2c713a6e4257a8846801e5
|
| 3 |
+
size 4864225040
|
model-00006-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e84b81cf1656e20a7fad47702b9b3651b8351cfbf017e71e6a6a346d9903065a
|
| 3 |
+
size 4918165735
|
model-00007-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fcc90c961f9ab8a1f4ca46baeef434e59a3f51840f5c05f9074f4dd574b64085
|
| 3 |
+
size 4864224956
|
model-00008-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b3ad75432c855795bab48276cfadd480860aff925e97f6b95d8ebfc6a428836
|
| 3 |
+
size 4864225074
|
model-00009-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fde069599aa3aedc1d490ae559d59da4189950e7bd52ad6d9540b3dd4f2ef36
|
| 3 |
+
size 4918165767
|
model-00010-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a81b5146583c63a8cd9addf8fcf248baa7f84a53743ef9cd7d5d416ed7bbfbaa
|
| 3 |
+
size 4864224972
|
model-00011-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7eece748e979c85ea0e0849d6a3fbe61060e8cfd5c69218d92b4e65cd83a7348
|
| 3 |
+
size 4864225022
|
model-00012-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0ab04c2bc1ca49a2a3310d413a7b287b7ba64e9da5450dca9c77af476939734b
|
| 3 |
+
size 4918165825
|
model-00013-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5cafb057550d9712124e161cb6df755079eb38bad9bb05c81f7f04ae14dd3810
|
| 3 |
+
size 4864225016
|
model-00014-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14662e08e488144243219d771774b3a0a9b5fd09943fa9510cbb753f77b00aec
|
| 3 |
+
size 4864225000
|
model-00015-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:29980a555172eef8bb066dde5be42b7a5b19331531d6761e903ff21a576ef3f0
|
| 3 |
+
size 4918165779
|
model-00016-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:344cd38d328e4f656ce73ac5be19fde14658e92f67a6d009bc9a515761590c29
|
| 3 |
+
size 4864225006
|
model-00017-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7648fa638ec31408305b95a428ce56986f94caeb9fd9b0d71bad92bf0c2f8153
|
| 3 |
+
size 4864225042
|
model-00018-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80f52b4d59dcf3ea78d3f91d210e88a82fedd46166a99770a267675a8106ff83
|
| 3 |
+
size 4918165767
|
model-00019-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87da2121b0df121eac73e3dc641ec9f4ee792cda432beb7f941a03a30e89654f
|
| 3 |
+
size 4864224990
|
model-00020-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2bc38ca906c51321382251519303b6f225ffdad4a3df4b20941eb7d7b24712a2
|
| 3 |
+
size 4864225000
|
model-00021-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0f151a46feab5c88caba0fba4adb3f4091e3de96c56967f74c0284404b1b786
|
| 3 |
+
size 4918165807
|
model-00022-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c4e4a91bc04049f7dd93c993c3b65767e6f9377349ef3d7ba60befb5c60d288e
|
| 3 |
+
size 4864225044
|
model-00023-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb981af947cc9eb65175a79d2fc3faf1d4eeffc92cb569a1721c847b6e59e4de
|
| 3 |
+
size 4864225034
|
model-00024-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd76f15ba7b7a4a3a67032529eda41df174bb4efa159bb7e87663654278f2245
|
| 3 |
+
size 4918165781
|
model-00025-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c892c08214855a01223ddf3dee79c5256b9fd024a5ce9c6b4be846b5bb4da4f5
|
| 3 |
+
size 4864225022
|
model-00026-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2e5326050ab201096bbcdcea68c56e4afaeea66dabc54026e54bc7e89f48554b
|
| 3 |
+
size 4864225082
|
model-00027-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f3f104c63c94659738c71e85ca3c19acd5a95576332aa9e85d6610fa1eb66d3
|
| 3 |
+
size 4918165785
|
model-00028-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:592170abc29c663ed28d4a0e26d72591947ddce17bac96d219dc26668cf6f232
|
| 3 |
+
size 4864225046
|
model-00029-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b333f7f02143b7f012d6935a096c010a51a125e6a9171faada83cf79b2aaea9f
|
| 3 |
+
size 4864225076
|
model-00030-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:440b9d090f87a1d7906cf84a98e0de71a688eeb3c2fe4e9ad8e5742e3e02d731
|
| 3 |
+
size 4918165811
|
model-00031-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:38fd7fb3021a16b44b8de60041a5aead92dae87629a4198648cabca272c82553
|
| 3 |
+
size 4864225050
|
model-00032-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b32772653b94c0df8a0f0d4aac5773e9d8ce91368f2a5a18c0aab847d32583d
|
| 3 |
+
size 4864225032
|
model-00033-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f017251e0cc516e092c53e7a9c8beaec05c607350a8044727f8bca4ae3f570f
|
| 3 |
+
size 4918165797
|
model-00034-of-00034.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abd1527edf60cbb717d1aff415230c0983665bc76b637cbff93e98db0e437b4b
|
| 3 |
+
size 4420683411
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|hy_begin_of_sentence:opensource|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|hy_eos:opensource|>",
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 8 |
+
"pad_token": "<|hy_pad:opensource|>",
|
| 9 |
+
"token_suffix": ":opensource",
|
| 10 |
+
"tokenizer_class": "TokenizersBackend",
|
| 11 |
+
"tool_parser_type": "hy_v3_opensource"
|
| 12 |
+
}
|