Text Generation
Transformers
Safetensors
English
qwen3_5_text
dystrio
sculpt
pruned
compressed
efficient
dense
drop-in-replacement
qwen3.5
conversational
Instructions to use dystrio/Qwen3.5-9B-Sculpt-Throughput with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dystrio/Qwen3.5-9B-Sculpt-Throughput with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dystrio/Qwen3.5-9B-Sculpt-Throughput") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dystrio/Qwen3.5-9B-Sculpt-Throughput") model = AutoModelForCausalLM.from_pretrained("dystrio/Qwen3.5-9B-Sculpt-Throughput") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use dystrio/Qwen3.5-9B-Sculpt-Throughput with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dystrio/Qwen3.5-9B-Sculpt-Throughput" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dystrio/Qwen3.5-9B-Sculpt-Throughput", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dystrio/Qwen3.5-9B-Sculpt-Throughput
- SGLang
How to use dystrio/Qwen3.5-9B-Sculpt-Throughput with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dystrio/Qwen3.5-9B-Sculpt-Throughput" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dystrio/Qwen3.5-9B-Sculpt-Throughput", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dystrio/Qwen3.5-9B-Sculpt-Throughput" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dystrio/Qwen3.5-9B-Sculpt-Throughput", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dystrio/Qwen3.5-9B-Sculpt-Throughput with Docker Model Runner:
docker model run hf.co/dystrio/Qwen3.5-9B-Sculpt-Throughput
Dystrio Sculpt Throughput tier (kf=0.88)
Browse files- .gitattributes +1 -0
- README.md +169 -0
- chat_template.jinja +154 -0
- config.json +83 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +31 -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,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model: Qwen/Qwen3.5-9B
|
| 8 |
+
tags:
|
| 9 |
+
- dystrio
|
| 10 |
+
- sculpt
|
| 11 |
+
- pruned
|
| 12 |
+
- compressed
|
| 13 |
+
- efficient
|
| 14 |
+
- dense
|
| 15 |
+
- drop-in-replacement
|
| 16 |
+
- qwen3.5
|
| 17 |
+
datasets:
|
| 18 |
+
- wikitext
|
| 19 |
+
- cais/mmlu
|
| 20 |
+
- teknium/OpenHermes-2.5
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Qwen3.5-9B-Sculpt-Throughput
|
| 24 |
+
|
| 25 |
+
> **12% FFN compression with live teacher distillation. Drop-in replacement — no custom kernels, no runtime changes.**
|
| 26 |
+
|
| 27 |
+
Dystrio Sculpt structurally compresses transformer FFN layers, producing dense models that load with standard `transformers`.
|
| 28 |
+
|
| 29 |
+
This is the **Throughput** tier of [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B).
|
| 30 |
+
|
| 31 |
+
**Use case:** Local/throughput — speed sweet spot (1.25x prefill)
|
| 32 |
+
|
| 33 |
+
## Benchmark Results (lm_eval)
|
| 34 |
+
|
| 35 |
+
| Model | MMLU | HellaSwag | ARC-C | TruthfulQA | Winogrande | GSM8K |
|
| 36 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 37 |
+
| **Qwen3.5-9B (baseline)** | 78.7 | 78.1 | 55.6 | 53.7 | 73.0 | 87.3 |
|
| 38 |
+
| **Sculpt Default** (kf=0.95) | 76.2 (↓2.5) | 75.8 (↓2.3) | 56.4 (↑0.8) | 52.6 (↓1.1) | 68.7 (↓4.3) | 81.5 (↓5.8) |
|
| 39 |
+
| **Sculpt Production** (kf=0.9) | 73.9 (↓4.8) | 75.1 (↓3.0) | 56.8 (↑1.2) | 47.3 (↓6.4) | 69.8 (↓3.2) | 74.5 (↓12.8) |
|
| 40 |
+
| **Sculpt Throughput** (kf=0.88) | 70.8 (↓7.9) | 74.0 (↓4.1) | 57.2 (↑1.6) | 52.0 (↓1.7) | 70.7 (↓2.3) | 69.6 (↓17.7) |
|
| 41 |
+
| **Sculpt Experimental** (kf=0.82) | 70.2 (↓8.5) | 70.7 (↓7.4) | 53.6 (↓2.0) | 47.6 (↓6.1) | 66.6 (↓6.4) | 54.7 (↓32.6) |
|
| 42 |
+
|
| 43 |
+
### This Model vs Baseline
|
| 44 |
+
|
| 45 |
+
| Benchmark | Throughput | Baseline | Delta |
|
| 46 |
+
|---|---:|---:|---:|
|
| 47 |
+
| arc_challenge | 57.2 | 55.6 | +1.6 |
|
| 48 |
+
| gsm8k | 69.6 | 87.3 | -17.7 |
|
| 49 |
+
| hellaswag | 74.0 | 78.1 | -4.1 |
|
| 50 |
+
| mmlu | 70.8 | 78.7 | -7.9 |
|
| 51 |
+
| mmlu_abstract_algebra | 47.0 | 66.0 | -19.0 |
|
| 52 |
+
| mmlu_anatomy | 68.9 | 77.8 | -8.9 |
|
| 53 |
+
| mmlu_astronomy | 82.9 | 92.8 | -9.9 |
|
| 54 |
+
| mmlu_business_ethics | 73.0 | 82.0 | -9.0 |
|
| 55 |
+
| mmlu_clinical_knowledge | 77.7 | 86.8 | -9.1 |
|
| 56 |
+
| mmlu_college_biology | 83.3 | 93.1 | -9.8 |
|
| 57 |
+
| mmlu_college_chemistry | 52.0 | 59.0 | -7.0 |
|
| 58 |
+
| mmlu_college_computer_science | 64.0 | 82.0 | -18.0 |
|
| 59 |
+
| mmlu_college_mathematics | 51.0 | 64.0 | -13.0 |
|
| 60 |
+
| mmlu_college_medicine | 68.2 | 81.5 | -13.3 |
|
| 61 |
+
| mmlu_college_physics | 59.8 | 64.7 | -4.9 |
|
| 62 |
+
| mmlu_computer_security | 76.0 | 83.0 | -7.0 |
|
| 63 |
+
| mmlu_conceptual_physics | 77.9 | 90.2 | -12.3 |
|
| 64 |
+
| mmlu_econometrics | 52.6 | 73.7 | -21.1 |
|
| 65 |
+
| mmlu_electrical_engineering | 64.8 | 82.1 | -17.3 |
|
| 66 |
+
| mmlu_elementary_mathematics | 61.9 | 80.7 | -18.8 |
|
| 67 |
+
| mmlu_formal_logic | 64.3 | 65.9 | -1.6 |
|
| 68 |
+
| mmlu_global_facts | 37.0 | 50.0 | -13.0 |
|
| 69 |
+
| mmlu_high_school_biology | 87.1 | 93.5 | -6.4 |
|
| 70 |
+
| mmlu_high_school_chemistry | 67.0 | 77.8 | -10.8 |
|
| 71 |
+
| mmlu_high_school_computer_science | 75.0 | 88.0 | -13.0 |
|
| 72 |
+
| mmlu_high_school_european_history | 84.8 | 87.3 | -2.5 |
|
| 73 |
+
| mmlu_high_school_geography | 82.3 | 92.4 | -10.1 |
|
| 74 |
+
| mmlu_high_school_government_and_politics | 89.1 | 96.9 | -7.8 |
|
| 75 |
+
| mmlu_high_school_macroeconomics | 75.4 | 85.9 | -10.5 |
|
| 76 |
+
| mmlu_high_school_mathematics | 44.1 | 53.3 | -9.2 |
|
| 77 |
+
| mmlu_high_school_microeconomics | 85.7 | 93.3 | -7.6 |
|
| 78 |
+
| mmlu_high_school_physics | 63.6 | 72.8 | -9.2 |
|
| 79 |
+
| mmlu_high_school_psychology | 89.7 | 93.2 | -3.5 |
|
| 80 |
+
| mmlu_high_school_statistics | 69.4 | 78.7 | -9.3 |
|
| 81 |
+
| mmlu_high_school_us_history | 81.9 | 90.2 | -8.3 |
|
| 82 |
+
| mmlu_high_school_world_history | 84.0 | 89.9 | -5.9 |
|
| 83 |
+
| mmlu_human_aging | 71.3 | 78.9 | -7.6 |
|
| 84 |
+
| mmlu_human_sexuality | 78.6 | 86.3 | -7.7 |
|
| 85 |
+
| mmlu_humanities | 65.5 | 70.5 | -5.0 |
|
| 86 |
+
| mmlu_international_law | 81.0 | 90.1 | -9.1 |
|
| 87 |
+
| mmlu_jurisprudence | 80.6 | 84.3 | -3.7 |
|
| 88 |
+
| mmlu_logical_fallacies | 74.2 | 84.7 | -10.5 |
|
| 89 |
+
| mmlu_machine_learning | 55.4 | 66.1 | -10.7 |
|
| 90 |
+
| mmlu_management | 86.4 | 86.4 | +0.0 |
|
| 91 |
+
| mmlu_marketing | 86.8 | 95.7 | -8.9 |
|
| 92 |
+
| mmlu_medical_genetics | 82.0 | 91.0 | -9.0 |
|
| 93 |
+
| mmlu_miscellaneous | 82.6 | 90.3 | -7.7 |
|
| 94 |
+
| mmlu_moral_disputes | 71.1 | 81.2 | -10.1 |
|
| 95 |
+
| mmlu_moral_scenarios | 57.4 | 53.3 | +4.1 |
|
| 96 |
+
| mmlu_nutrition | 76.1 | 86.3 | -10.2 |
|
| 97 |
+
| mmlu_other | 74.2 | 83.1 | -8.9 |
|
| 98 |
+
| mmlu_philosophy | 73.3 | 80.4 | -7.1 |
|
| 99 |
+
| mmlu_prehistory | 72.5 | 84.3 | -11.8 |
|
| 100 |
+
| mmlu_professional_accounting | 54.6 | 65.6 | -11.0 |
|
| 101 |
+
| mmlu_professional_law | 53.9 | 60.3 | -6.4 |
|
| 102 |
+
| mmlu_professional_medicine | 79.8 | 91.5 | -11.7 |
|
| 103 |
+
| mmlu_professional_psychology | 72.1 | 82.8 | -10.7 |
|
| 104 |
+
| mmlu_public_relations | 67.3 | 73.6 | -6.3 |
|
| 105 |
+
| mmlu_security_studies | 75.1 | 76.7 | -1.6 |
|
| 106 |
+
| mmlu_social_sciences | 79.5 | 87.0 | -7.5 |
|
| 107 |
+
| mmlu_sociology | 87.6 | 89.1 | -1.5 |
|
| 108 |
+
| mmlu_stem | 66.9 | 78.3 | -11.4 |
|
| 109 |
+
| mmlu_us_foreign_policy | 86.0 | 90.0 | -4.0 |
|
| 110 |
+
| mmlu_virology | 53.0 | 56.6 | -3.6 |
|
| 111 |
+
| mmlu_world_religions | 81.9 | 86.5 | -4.6 |
|
| 112 |
+
| truthfulqa_mc2 | 52.0 | 53.7 | -1.7 |
|
| 113 |
+
| winogrande | 70.7 | 73.0 | -2.3 |
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
## Quick Start
|
| 117 |
+
|
| 118 |
+
```python
|
| 119 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 120 |
+
|
| 121 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 122 |
+
"dystrio/Qwen3.5-9B-Sculpt-Throughput",
|
| 123 |
+
torch_dtype="bfloat16",
|
| 124 |
+
device_map="auto",
|
| 125 |
+
)
|
| 126 |
+
tokenizer = AutoTokenizer.from_pretrained("dystrio/Qwen3.5-9B-Sculpt-Throughput")
|
| 127 |
+
|
| 128 |
+
inputs = tokenizer("The future of AI inference is", return_tensors="pt").to(model.device)
|
| 129 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 130 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
## All Sculpt Tiers
|
| 134 |
+
|
| 135 |
+
| Tier | HuggingFace | Config | Use Case |
|
| 136 |
+
|------|-------------|--------|----------|
|
| 137 |
+
| Default | [dystrio/Qwen3.5-9B-Sculpt-Default](https://huggingface.co/dystrio/Qwen3.5-9B-Sculpt-Default) | kf=0.95 | Enterprise — maximum quality preservation |
|
| 138 |
+
| Production | [dystrio/Qwen3.5-9B-Sculpt-Production](https://huggingface.co/dystrio/Qwen3.5-9B-Sculpt-Production) | kf=0.9 | Enterprise — balanced quality and efficiency |
|
| 139 |
+
| Throughput | [dystrio/Qwen3.5-9B-Sculpt-Throughput](https://huggingface.co/dystrio/Qwen3.5-9B-Sculpt-Throughput) | kf=0.88 | Local/throughput — speed sweet spot (1.25x prefill) |
|
| 140 |
+
| Experimental | [dystrio/Qwen3.5-9B-Sculpt-Experimental](https://huggingface.co/dystrio/Qwen3.5-9B-Sculpt-Experimental) | kf=0.82 | Local — maximum compression (1.27x prefill) |
|
| 141 |
+
|
| 142 |
+
## Technical Details
|
| 143 |
+
|
| 144 |
+
- **Method:** Structural FFN pruning with Physarum-inspired block selection + live teacher distillation (alpha=0.5)
|
| 145 |
+
- **Keep fraction:** 0.88 (12% of FFN neurons removed)
|
| 146 |
+
- **Repair:** 8-stage cosine-LR fine-tuning with best-checkpoint restore
|
| 147 |
+
- **Training data:** general_v2 mixture (WikiText, OpenHermes 2.5, MMLU, HellaSwag, GSM8K, OpenOrca)
|
| 148 |
+
- **Hardware:** 1x NVIDIA H200 141GB
|
| 149 |
+
- **Output:** Standard dense transformer — loads with any HuggingFace-compatible framework
|
| 150 |
+
|
| 151 |
+
## Compatibility
|
| 152 |
+
|
| 153 |
+
- HuggingFace Transformers
|
| 154 |
+
- vLLM
|
| 155 |
+
- TGI (Text Generation Inference)
|
| 156 |
+
- llama.cpp / GGUF conversion
|
| 157 |
+
- AWQ / GPTQ quantization
|
| 158 |
+
- Any framework that loads standard safetensors
|
| 159 |
+
|
| 160 |
+
## Citation
|
| 161 |
+
|
| 162 |
+
```bibtex
|
| 163 |
+
@misc{dystrio_sculpt_2026,
|
| 164 |
+
title={Dystrio Sculpt: Structural Compilation for Transformer LLMs},
|
| 165 |
+
author={Dystrio},
|
| 166 |
+
year={2026},
|
| 167 |
+
url={https://huggingface.co/dystrio}
|
| 168 |
+
}
|
| 169 |
+
```
|
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 false %}
|
| 150 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 151 |
+
{%- else %}
|
| 152 |
+
{{- '<think>\n' }}
|
| 153 |
+
{%- endif %}
|
| 154 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3_5ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attn_output_gate": true,
|
| 8 |
+
"bos_token_id": null,
|
| 9 |
+
"dtype": "bfloat16",
|
| 10 |
+
"eos_token_id": 248044,
|
| 11 |
+
"full_attention_interval": 4,
|
| 12 |
+
"head_dim": 256,
|
| 13 |
+
"hidden_act": "silu",
|
| 14 |
+
"hidden_size": 4096,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 10880,
|
| 17 |
+
"layer_types": [
|
| 18 |
+
"linear_attention",
|
| 19 |
+
"linear_attention",
|
| 20 |
+
"linear_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"linear_attention",
|
| 23 |
+
"linear_attention",
|
| 24 |
+
"linear_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"linear_attention",
|
| 27 |
+
"linear_attention",
|
| 28 |
+
"linear_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"linear_attention",
|
| 31 |
+
"linear_attention",
|
| 32 |
+
"linear_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"linear_attention",
|
| 35 |
+
"linear_attention",
|
| 36 |
+
"linear_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"linear_attention",
|
| 39 |
+
"linear_attention",
|
| 40 |
+
"linear_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"linear_attention",
|
| 43 |
+
"linear_attention",
|
| 44 |
+
"linear_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"linear_attention",
|
| 47 |
+
"linear_attention",
|
| 48 |
+
"linear_attention",
|
| 49 |
+
"full_attention"
|
| 50 |
+
],
|
| 51 |
+
"linear_conv_kernel_dim": 4,
|
| 52 |
+
"linear_key_head_dim": 128,
|
| 53 |
+
"linear_num_key_heads": 16,
|
| 54 |
+
"linear_num_value_heads": 32,
|
| 55 |
+
"linear_value_head_dim": 128,
|
| 56 |
+
"mamba_ssm_dtype": "float32",
|
| 57 |
+
"max_position_embeddings": 262144,
|
| 58 |
+
"mlp_only_layers": [],
|
| 59 |
+
"model_type": "qwen3_5_text",
|
| 60 |
+
"mtp_num_hidden_layers": 1,
|
| 61 |
+
"mtp_use_dedicated_embeddings": false,
|
| 62 |
+
"num_attention_heads": 16,
|
| 63 |
+
"num_hidden_layers": 32,
|
| 64 |
+
"num_key_value_heads": 4,
|
| 65 |
+
"pad_token_id": null,
|
| 66 |
+
"partial_rotary_factor": 0.25,
|
| 67 |
+
"rms_norm_eps": 1e-06,
|
| 68 |
+
"rope_parameters": {
|
| 69 |
+
"mrope_interleaved": true,
|
| 70 |
+
"mrope_section": [
|
| 71 |
+
11,
|
| 72 |
+
11,
|
| 73 |
+
10
|
| 74 |
+
],
|
| 75 |
+
"partial_rotary_factor": 0.25,
|
| 76 |
+
"rope_theta": 10000000,
|
| 77 |
+
"rope_type": "default"
|
| 78 |
+
},
|
| 79 |
+
"tie_word_embeddings": false,
|
| 80 |
+
"transformers_version": "5.3.0.dev0",
|
| 81 |
+
"use_cache": true,
|
| 82 |
+
"vocab_size": 248320
|
| 83 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"eos_token_id": 248044,
|
| 4 |
+
"transformers_version": "5.3.0.dev0",
|
| 5 |
+
"use_cache": true
|
| 6 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:763dea818d79716619ed9a25d59d11fc7e969640923177651bab8374eb46400d
|
| 3 |
+
size 16800366720
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9facde94660f9c53e928aad19c7d6a16d91f5e42d6d581db8d253b4787ee5e19
|
| 3 |
+
size 19989441
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": false,
|
| 13 |
+
"model_max_length": 262144,
|
| 14 |
+
"model_specific_special_tokens": {
|
| 15 |
+
"audio_bos_token": "<|audio_start|>",
|
| 16 |
+
"audio_eos_token": "<|audio_end|>",
|
| 17 |
+
"audio_token": "<|audio_pad|>",
|
| 18 |
+
"image_token": "<|image_pad|>",
|
| 19 |
+
"video_token": "<|video_pad|>",
|
| 20 |
+
"vision_bos_token": "<|vision_start|>",
|
| 21 |
+
"vision_eos_token": "<|vision_end|>"
|
| 22 |
+
},
|
| 23 |
+
"pad_token": "<|endoftext|>",
|
| 24 |
+
"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+",
|
| 25 |
+
"split_special_tokens": false,
|
| 26 |
+
"tokenizer_class": "TokenizersBackend",
|
| 27 |
+
"unk_token": null,
|
| 28 |
+
"video_token": "<|video_pad|>",
|
| 29 |
+
"vision_bos_token": "<|vision_start|>",
|
| 30 |
+
"vision_eos_token": "<|vision_end|>"
|
| 31 |
+
}
|