Instructions to use tiny-random/hy4-preview-fp8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/hy4-preview-fp8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/hy4-preview-fp8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiny-random/hy4-preview-fp8") model = AutoModelForCausalLM.from_pretrained("tiny-random/hy4-preview-fp8", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/hy4-preview-fp8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/hy4-preview-fp8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/hy4-preview-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tiny-random/hy4-preview-fp8
- SGLang
How to use tiny-random/hy4-preview-fp8 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 "tiny-random/hy4-preview-fp8" \ --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": "tiny-random/hy4-preview-fp8", "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 "tiny-random/hy4-preview-fp8" \ --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": "tiny-random/hy4-preview-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tiny-random/hy4-preview-fp8 with Docker Model Runner:
docker model run hf.co/tiny-random/hy4-preview-fp8
Upload folder using huggingface_hub
Browse files- .meta.json +13 -0
- LICENSE +210 -0
- README.md +495 -0
- chat_template.jinja +309 -0
- config.json +447 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +11 -0
.meta.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"torch": "2.14.1",
|
| 3 |
+
"transformers": "5.19.0",
|
| 4 |
+
"huggingface_hub": "1.33.0",
|
| 5 |
+
"safetensors": "0.8.0",
|
| 6 |
+
"accelerate": "1.15.0",
|
| 7 |
+
"sglang": "0.5.23.dev384+g9ab74b851",
|
| 8 |
+
"flashinfer-python": "0.7.2",
|
| 9 |
+
"kernels": "0.17.0",
|
| 10 |
+
"Python": "3.12.13",
|
| 11 |
+
"CUDA": "13.0",
|
| 12 |
+
"vllm": "0.32.0"
|
| 13 |
+
}
|
LICENSE
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Tencent is pleased to support the open source community by making Tencent Hy4 preview available.
|
| 2 |
+
|
| 3 |
+
Copyright (C) 2026 Tencent. All rights reserved.
|
| 4 |
+
|
| 5 |
+
Tencent Hy4 preview is licensed under the Apache-2.0.
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
Terms of the Apache-2.0:
|
| 9 |
+
--------------------------------------------------------------------
|
| 10 |
+
Apache License
|
| 11 |
+
Version 2.0, January 2004
|
| 12 |
+
http://www.apache.org/licenses/
|
| 13 |
+
|
| 14 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 15 |
+
|
| 16 |
+
1. Definitions.
|
| 17 |
+
|
| 18 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 19 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 20 |
+
|
| 21 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 22 |
+
the copyright owner that is granting the License.
|
| 23 |
+
|
| 24 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 25 |
+
other entities that control, are controlled by, or are under common
|
| 26 |
+
control with that entity. For the purposes of this definition,
|
| 27 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 28 |
+
direction or management of such entity, whether by contract or
|
| 29 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 30 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 31 |
+
|
| 32 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 33 |
+
exercising permissions granted by this License.
|
| 34 |
+
|
| 35 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 36 |
+
including but not limited to software source code, documentation
|
| 37 |
+
source, and configuration files.
|
| 38 |
+
|
| 39 |
+
"Object" form shall mean any form resulting from mechanical
|
| 40 |
+
transformation or translation of a Source form, including but
|
| 41 |
+
not limited to compiled object code, generated documentation,
|
| 42 |
+
and conversions to other media types.
|
| 43 |
+
|
| 44 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 45 |
+
Object form, made available under the License, as indicated by a
|
| 46 |
+
copyright notice that is included in or attached to the work
|
| 47 |
+
(an example is provided in the Appendix below).
|
| 48 |
+
|
| 49 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 50 |
+
form, that is based on (or derived from) the Work and for which the
|
| 51 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 52 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 53 |
+
of this License, Derivative Works shall not include works that remain
|
| 54 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 55 |
+
the Work and Derivative Works thereof.
|
| 56 |
+
|
| 57 |
+
"Contribution" shall mean any work of authorship, including
|
| 58 |
+
the original version of the Work and any modifications or additions
|
| 59 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 60 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 61 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 62 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 63 |
+
means any form of electronic, verbal, or written communication sent
|
| 64 |
+
to the Licensor or its representatives, including but not limited to
|
| 65 |
+
communication on electronic mailing lists, source code control systems,
|
| 66 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 67 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 68 |
+
excluding communication that is conspicuously marked or otherwise
|
| 69 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 70 |
+
|
| 71 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 72 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 73 |
+
subsequently incorporated within the Work.
|
| 74 |
+
|
| 75 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 76 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 77 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 78 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 79 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 80 |
+
Work and such Derivative Works in Source or Object form.
|
| 81 |
+
|
| 82 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 83 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 84 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 85 |
+
(except as stated in this section) patent license to make, have made,
|
| 86 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 87 |
+
where such license applies only to those patent claims licensable
|
| 88 |
+
by such Contributor that are necessarily infringed by their
|
| 89 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 90 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 91 |
+
institute patent litigation against any entity (including a
|
| 92 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 93 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 94 |
+
or contributory patent infringement, then any patent licenses
|
| 95 |
+
granted to You under this License for that Work shall terminate
|
| 96 |
+
as of the date such litigation is filed.
|
| 97 |
+
|
| 98 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 99 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 100 |
+
modifications, and in Source or Object form, provided that You
|
| 101 |
+
meet the following conditions:
|
| 102 |
+
|
| 103 |
+
(a) You must give any other recipients of the Work or
|
| 104 |
+
Derivative Works a copy of this License; and
|
| 105 |
+
|
| 106 |
+
(b) You must cause any modified files to carry prominent notices
|
| 107 |
+
stating that You changed the files; and
|
| 108 |
+
|
| 109 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 110 |
+
that You distribute, all copyright, patent, trademark, and
|
| 111 |
+
attribution notices from the Source form of the Work,
|
| 112 |
+
excluding those notices that do not pertain to any part of
|
| 113 |
+
the Derivative Works; and
|
| 114 |
+
|
| 115 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 116 |
+
distribution, then any Derivative Works that You distribute must
|
| 117 |
+
include a readable copy of the attribution notices contained
|
| 118 |
+
within such NOTICE file, excluding those notices that do not
|
| 119 |
+
pertain to any part of the Derivative Works, in at least one
|
| 120 |
+
of the following places: within a NOTICE text file distributed
|
| 121 |
+
as part of the Derivative Works; within the Source form or
|
| 122 |
+
documentation, if provided along with the Derivative Works; or,
|
| 123 |
+
within a display generated by the Derivative Works, if and
|
| 124 |
+
wherever such third-party notices normally appear. The contents
|
| 125 |
+
of the NOTICE file are for informational purposes only and
|
| 126 |
+
do not modify the License. You may add Your own attribution
|
| 127 |
+
notices within Derivative Works that You distribute, alongside
|
| 128 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 129 |
+
that such additional attribution notices cannot be construed
|
| 130 |
+
as modifying the License.
|
| 131 |
+
|
| 132 |
+
You may add Your own copyright statement to Your modifications and
|
| 133 |
+
may provide additional or different license terms and conditions
|
| 134 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 135 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 136 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 137 |
+
the conditions stated in this License.
|
| 138 |
+
|
| 139 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 140 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 141 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 142 |
+
this License, without any additional terms or conditions.
|
| 143 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 144 |
+
the terms of any separate license agreement you may have executed
|
| 145 |
+
with Licensor regarding such Contributions.
|
| 146 |
+
|
| 147 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 148 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 149 |
+
except as required for reasonable and customary use in describing the
|
| 150 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 151 |
+
|
| 152 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 153 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 154 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 155 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 156 |
+
implied, including, without limitation, any warranties or conditions
|
| 157 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 158 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 159 |
+
appropriateness of using or redistributing the Work and assume any
|
| 160 |
+
risks associated with Your exercise of permissions under this License.
|
| 161 |
+
|
| 162 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 163 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 164 |
+
unless required by applicable law (such as deliberate and grossly
|
| 165 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 166 |
+
liable to You for damages, including any direct, indirect, special,
|
| 167 |
+
incidental, or consequential damages of any character arising as a
|
| 168 |
+
result of this License or out of the use or inability to use the
|
| 169 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 170 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 171 |
+
other commercial damages or losses), even if such Contributor
|
| 172 |
+
has been advised of the possibility of such damages.
|
| 173 |
+
|
| 174 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 175 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 176 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 177 |
+
or other liability obligations and/or rights consistent with this
|
| 178 |
+
License. However, in accepting such obligations, You may act only
|
| 179 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 180 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 181 |
+
defend, and hold each Contributor harmless for any liability
|
| 182 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 183 |
+
of your accepting any such warranty or additional liability.
|
| 184 |
+
|
| 185 |
+
END OF TERMS AND CONDITIONS
|
| 186 |
+
|
| 187 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 188 |
+
|
| 189 |
+
To apply the Apache License to your work, attach the following
|
| 190 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 191 |
+
replaced with your own identifying information. (Don't include
|
| 192 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 193 |
+
comment syntax for the file format. We also recommend that a
|
| 194 |
+
file or class name and description of purpose be included on the
|
| 195 |
+
same "printed page" as the copyright notice for easier
|
| 196 |
+
identification within third-party archives.
|
| 197 |
+
|
| 198 |
+
Copyright [yyyy] [name of copyright owner]
|
| 199 |
+
|
| 200 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 201 |
+
you may not use this file except in compliance with the License.
|
| 202 |
+
You may obtain a copy of the License at
|
| 203 |
+
|
| 204 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 205 |
+
|
| 206 |
+
Unless required by applicable law or agreed to in writing, software
|
| 207 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 208 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 209 |
+
See the License for the specific language governing permissions and
|
| 210 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
base_model:
|
| 4 |
+
- tencent/Hy4-preview-FP8
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [tencent/Hy4-preview-FP8](https://huggingface.co/tencent/Hy4-preview-FP8).
|
| 8 |
+
|
| 9 |
+
Structural comparison with `tencent/Hy4-preview-FP8`:
|
| 10 |
+
|
| 11 |
+
| Feature | Source | Tiny |
|
| 12 |
+
|---|---|---|
|
| 13 |
+
| Architecture / input | HYV4; text | Same |
|
| 14 |
+
| Vocabulary / tied embeddings | 120,832 / false | Same |
|
| 15 |
+
| Backbone layers / hidden size | 78 / 6,144 | 10 / 64 |
|
| 16 |
+
| MLP layout | 1 dense layer, then MoE | Same |
|
| 17 |
+
| Routed experts / top-k / shared experts | 256 / 8 / 1 | 32 / 8 / 1 |
|
| 18 |
+
| Dense / expert intermediate size | 18,432 / 2,048 | 128 / 512 |
|
| 19 |
+
| Attention Q heads; non-RoPE / RoPE / V dimensions | 64; 192 / 64 / 256 | 8; 32 / 64 / 32 |
|
| 20 |
+
| Q / KV LoRA rank | 2,048 / 512 | 64 / 512 |
|
| 21 |
+
| Indexer heads / dimension / selected tokens | 32 / 128 / 2,048 | Same |
|
| 22 |
+
| Full indexer layers | 0, 1, 5, 9, ... | 0, 1, 5, 9; remaining layers reuse the preceding indexer |
|
| 23 |
+
| Independent Hyper-Connections | 4 streams; gated pre/post branches | Same |
|
| 24 |
+
| MLA gating / learned attention sinks / SwiGLU clamp | Elementwise / enabled / 10 | Same |
|
| 25 |
+
| MTP | 1 plain DSA/MoE decoder; shared embedding/head | Same |
|
| 26 |
+
| Checkpoint precision | MXFP8 E4M3 weights + uint8 E8M0 scales, 1x32 groups; BF16 embedding/head/gates; FP32 iHC/sinks | Same |
|
| 27 |
+
|
| 28 |
+
Tokenizer, chat template and generation assets are copied unchanged from the pinned source.
|
| 29 |
+
The registered Transformers `indexed_attention` config tag represents the source DSA layers.
|
| 30 |
+
The H20 Marlin backend requires width 64. The two untied BF16 token matrices alone
|
| 31 |
+
occupy 30,932,992 bytes, exceeding the 30 MB target; the checkpoint is 70,661,788 bytes. TP=4 Marlin also requires a 128-wide
|
| 32 |
+
expert intermediate partition, hence a 512-wide full expert intermediate size.
|
| 33 |
+
Checkpoint precision matches the source ModelOpt MXFP8 config. Marlin uses BF16
|
| 34 |
+
activations at runtime (W8A16).
|
| 35 |
+
|
| 36 |
+
Transformers and vLLM TP=4 were validated on NVIDIA H20 with English, Chinese and
|
| 37 |
+
long DSA prompts. The vLLM run enabled three-token MTP and CUDA Graph. Its separate
|
| 38 |
+
test environment used vLLM 0.32.0, Torch 2.13.0+cu130, CUDA 13.0, Transformers 5.19.0
|
| 39 |
+
and FlashInfer 0.7.0.post1; the Transformers/SGLang environment is listed below.
|
| 40 |
+
|
| 41 |
+
| File path | Size |
|
| 42 |
+
|------|------|
|
| 43 |
+
| model.safetensors | 70.7MB |
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
### Example usage:
|
| 47 |
+
|
| 48 |
+
- vLLM (✅ verified)
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
vllm serve tiny-random/hy4-preview-fp8 \
|
| 52 |
+
--tensor-parallel-size 4 \
|
| 53 |
+
--kernel-config '{"linear_backend":"marlin","moe_backend":"marlin"}' \
|
| 54 |
+
--speculative-config '{"method":"mtp","num_speculative_tokens":3}' \
|
| 55 |
+
--max-model-len 4096 \
|
| 56 |
+
--max-num-batched-tokens 512 \
|
| 57 |
+
--max-num-seqs 4 \
|
| 58 |
+
--gpu-memory-utilization 0.3 \
|
| 59 |
+
--compilation-config '{"cudagraph_capture_sizes":[1,2,4,8,16]}'
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
- SGLang (unverified)
|
| 63 |
+
|
| 64 |
+
- Unverified: SGLang's native Hy4 MXFP8 backend requires SM100+; the available H20 GPUs are SM90. Use the verified vLLM Marlin example on H20.
|
| 65 |
+
- This command targets four one-GPU nodes with NODE_RANK=0..3, a shared DIST_INIT_ADDR and an available local NCCL_PORT. TP=4, NEXTN/MTP and CUDA Graph are enabled.
|
| 66 |
+
|
| 67 |
+
```bash
|
| 68 |
+
model_id=tiny-random/hy4-preview-fp8
|
| 69 |
+
node_rank=${NODE_RANK:-0}
|
| 70 |
+
dist_init_addr=${DIST_INIT_ADDR}
|
| 71 |
+
nccl_port=${NCCL_PORT}
|
| 72 |
+
export SGLANG_DG_CACHE_DIR=/tmp/hy4-deepgemm-$node_rank
|
| 73 |
+
sglang serve \
|
| 74 |
+
--model-path $model_id \
|
| 75 |
+
--tp-size 4 \
|
| 76 |
+
--nnodes 4 \
|
| 77 |
+
--node-rank $node_rank \
|
| 78 |
+
--dist-init-addr $dist_init_addr \
|
| 79 |
+
--nccl-port $nccl_port \
|
| 80 |
+
--fp8-gemm-backend deep_gemm \
|
| 81 |
+
--moe-runner-backend deep_gemm \
|
| 82 |
+
--speculative-algorithm NEXTN \
|
| 83 |
+
--speculative-num-steps 3 \
|
| 84 |
+
--speculative-eagle-topk 1 \
|
| 85 |
+
--speculative-num-draft-tokens 4 \
|
| 86 |
+
--context-length 4096 \
|
| 87 |
+
--max-total-tokens 4096 \
|
| 88 |
+
--chunked-prefill-size 512 \
|
| 89 |
+
--mem-fraction-static 0.3 \
|
| 90 |
+
--cuda-graph-config '{"decode": {"bs": [1, 2, 4]}}' \
|
| 91 |
+
--disable-custom-all-reduce
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
- Transformers (✅ verified)
|
| 95 |
+
|
| 96 |
+
```python
|
| 97 |
+
import torch
|
| 98 |
+
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, FineGrainedFP8Config
|
| 99 |
+
|
| 100 |
+
model_id = "tiny-random/hy4-preview-fp8"
|
| 101 |
+
config = AutoConfig.from_pretrained(model_id)
|
| 102 |
+
precision = config.quantization_config["quantization"]
|
| 103 |
+
# Adapt the loader descriptor in memory; the checkpoint keeps the source ModelOpt config.
|
| 104 |
+
config.quantization_config = FineGrainedFP8Config(
|
| 105 |
+
quant_method="mxfp8", weight_block_size=(1, 32), scale_fmt="ue8m0",
|
| 106 |
+
modules_to_not_convert=[name for name in precision["exclude_modules"] if name != "model.layers.0.mlp.gate"],
|
| 107 |
+
).to_dict()
|
| 108 |
+
# Transformers 5.19.0 implements Hy4's DSA and learned sinks only with eager attention.
|
| 109 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 110 |
+
model_id, config=config, dtype=torch.bfloat16, device_map="cuda", attn_implementation="eager", experts_implementation="eager",
|
| 111 |
+
key_mapping={r"\.weight_scale$": ".weight_scale_inv", r"\.(gate_up_proj|down_proj)_scale$": r".\1_scale_inv"},
|
| 112 |
+
)
|
| 113 |
+
# Source MXFP8 stores E8M0 scale bits in uint8 containers.
|
| 114 |
+
for module in model.modules():
|
| 115 |
+
for name, param in list(module.named_parameters(recurse=False)):
|
| 116 |
+
if name.endswith("_scale_inv") and param.dtype == torch.uint8:
|
| 117 |
+
setattr(module, name, torch.nn.Parameter(param.detach().view(torch.float8_e8m0fnu), requires_grad=False))
|
| 118 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 119 |
+
inputs = tokenizer.apply_chat_template(
|
| 120 |
+
[{"role": "user", "content": "Hello"}], tokenize=True,
|
| 121 |
+
add_generation_prompt=True, return_dict=True, return_tensors="pt",
|
| 122 |
+
).to(model.device)
|
| 123 |
+
output = model.generate(**inputs, do_sample=False, max_new_tokens=10)
|
| 124 |
+
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
### Codes to create this repo (✅ verified):
|
| 128 |
+
|
| 129 |
+
<details><summary>Click to expand</summary>
|
| 130 |
+
|
| 131 |
+
```python
|
| 132 |
+
import json
|
| 133 |
+
import re
|
| 134 |
+
from copy import deepcopy
|
| 135 |
+
from pathlib import Path
|
| 136 |
+
from shutil import copyfile
|
| 137 |
+
|
| 138 |
+
import torch
|
| 139 |
+
from huggingface_hub import hf_hub_download, list_repo_files
|
| 140 |
+
from safetensors.torch import save_file
|
| 141 |
+
from transformers import AutoConfig, AutoModelForCausalLM, set_seed
|
| 142 |
+
|
| 143 |
+
source_model_id = "tencent/Hy4-preview-FP8"
|
| 144 |
+
save_folder = "/tmp/tiny-random/hy4-preview-fp8"
|
| 145 |
+
source_revision = '4215ec29de873a998e849cee902654490c7ff4d1'
|
| 146 |
+
set_seed(42)
|
| 147 |
+
folder = Path(save_folder)
|
| 148 |
+
folder.mkdir(parents=True, exist_ok=True)
|
| 149 |
+
raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
|
| 150 |
+
original_quantization = raw.pop("quantization_config")
|
| 151 |
+
raw.update(
|
| 152 |
+
hidden_size=64, num_hidden_layers=10, num_attention_heads=8,
|
| 153 |
+
intermediate_size=128, moe_intermediate_size=512, n_routed_experts=32,
|
| 154 |
+
q_lora_rank=64, qk_nope_head_dim=32, v_head_dim=32, qk_head_dim=96,
|
| 155 |
+
layer_types=["indexed_attention"] * 10,
|
| 156 |
+
)
|
| 157 |
+
raw["indexer_types"] = raw["indexer_types"][:10]
|
| 158 |
+
raw["mlp_layer_types"] = raw["mlp_layer_types"][:10]
|
| 159 |
+
(folder / "config.json").write_text(json.dumps(raw, indent=2))
|
| 160 |
+
config = AutoConfig.from_pretrained(folder)
|
| 161 |
+
# Transformers 5.19.0 implements Hy4's DSA and learned sinks only with eager attention.
|
| 162 |
+
model = AutoModelForCausalLM.from_config(config, dtype=torch.bfloat16, attn_implementation="eager")
|
| 163 |
+
backbone = model.model
|
| 164 |
+
last = backbone.layers[-1]
|
| 165 |
+
model.model.mtp_layers = torch.nn.ModuleList([torch.nn.ModuleDict({
|
| 166 |
+
"enorm": deepcopy(backbone.norm), "hnorm": deepcopy(backbone.norm),
|
| 167 |
+
"eh_proj": torch.nn.Linear(2 * config.hidden_size, config.hidden_size, bias=False, dtype=torch.bfloat16),
|
| 168 |
+
"input_layernorm": deepcopy(last.input_layernorm), "self_attn": deepcopy(last.self_attn),
|
| 169 |
+
"post_attention_layernorm": deepcopy(last.post_attention_layernorm), "mlp": deepcopy(last.mlp),
|
| 170 |
+
"final_layernorm": deepcopy(backbone.norm),
|
| 171 |
+
})])
|
| 172 |
+
model.model.mtp_layers.apply(model._init_weights)
|
| 173 |
+
|
| 174 |
+
def public_name(name):
|
| 175 |
+
for native, source in (("attn_hc", "hc_attn_layer"), ("ffn_hc", "hc_mlp_layer")):
|
| 176 |
+
name = re.sub(r"\." + native + r"\.(fn|base|scale)$", r"." + source + r".hc_pre.hc_\1", name)
|
| 177 |
+
name = name.replace(".self_attn.gate_proj", ".self_attn.linear_gate")
|
| 178 |
+
name = name.replace(".self_attn.sinks", ".self_attn.learnable_sink_param")
|
| 179 |
+
for suffix in ("fn", "base", "scale"):
|
| 180 |
+
name = name.replace(".hc_head.hc_" + suffix, ".hc_head.hc_head_" + suffix)
|
| 181 |
+
return name
|
| 182 |
+
|
| 183 |
+
state = {}
|
| 184 |
+
for name, value in model.state_dict().items():
|
| 185 |
+
name = public_name(name)
|
| 186 |
+
full_precision = name.endswith((".hc_fn", ".hc_base", ".hc_scale", ".hc_head_fn", ".hc_head_base", ".hc_head_scale"))
|
| 187 |
+
full_precision |= name.endswith((".learnable_sink_param", ".e_score_correction_bias")) and not name.startswith("model.mtp_layers.")
|
| 188 |
+
state[name] = value.detach().to(torch.float32 if full_precision else torch.bfloat16).cpu().contiguous()
|
| 189 |
+
# Keep the source exclusions, pruning module names absent from the reduced model.
|
| 190 |
+
source_names = {public_name(name): name for name, _ in model.named_modules()}
|
| 191 |
+
source_names.update({public_name(name): name for name, _ in model.named_parameters()})
|
| 192 |
+
exclusions = [name for name in original_quantization["quantization"]["exclude_modules"] if name in source_names]
|
| 193 |
+
for name in list(state):
|
| 194 |
+
excluded = any(name == prefix or name.startswith(prefix + ".") for prefix in exclusions)
|
| 195 |
+
expert = name.endswith((".experts.gate_up_proj", ".experts.down_proj"))
|
| 196 |
+
linear = name.endswith(".weight") and state[name].ndim == 2
|
| 197 |
+
if excluded or not (expert or linear):
|
| 198 |
+
continue
|
| 199 |
+
weight = state[name].float()
|
| 200 |
+
blocks = weight.reshape(*weight.shape[:-1], weight.shape[-1] // 32, 32)
|
| 201 |
+
exponent = torch.ceil(torch.log2((blocks.abs().amax(-1) / 448).clamp_min(2.0 ** -127))).clamp(-127, 127)
|
| 202 |
+
scale = torch.exp2(exponent)
|
| 203 |
+
state[name] = (blocks / scale.unsqueeze(-1)).clamp(-448, 448).reshape(weight.shape).to(torch.float8_e4m3fn).contiguous()
|
| 204 |
+
scale_name = name.removesuffix(".weight") + ".weight_scale" if linear else name + "_scale"
|
| 205 |
+
state[scale_name] = (exponent + 127).to(torch.uint8).contiguous()
|
| 206 |
+
save_file(state, folder / "model.safetensors", metadata={"format": "pt"})
|
| 207 |
+
raw["quantization_config"] = original_quantization
|
| 208 |
+
(folder / "config.json").write_text(json.dumps(raw, indent=2))
|
| 209 |
+
assets = {"tokenizer.json", "tokenizer_config.json", "chat_template.jinja", "generation_config.json", "LICENSE"}
|
| 210 |
+
for name in sorted(set(list_repo_files(source_model_id, revision=source_revision)) & assets):
|
| 211 |
+
copyfile(hf_hub_download(source_model_id, name, revision=source_revision), folder / name)
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
</details>
|
| 215 |
+
|
| 216 |
+
### Printing the model:
|
| 217 |
+
|
| 218 |
+
<details><summary>Click to expand</summary>
|
| 219 |
+
|
| 220 |
+
```text
|
| 221 |
+
HYV4ForCausalLM(
|
| 222 |
+
(model): HYV4Model(
|
| 223 |
+
(embed_tokens): Embedding(120832, 64, padding_idx=120002)
|
| 224 |
+
(layers): ModuleList(
|
| 225 |
+
(0): HYV4DecoderLayer(
|
| 226 |
+
(self_attn): HYV4Attention(
|
| 227 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 228 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 229 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 230 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 231 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 232 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 233 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 234 |
+
(indexer): HYV4Indexer(
|
| 235 |
+
(wq_b): Linear(in_features=64, out_features=4096, bias=False)
|
| 236 |
+
(wk): Linear(in_features=64, out_features=128, bias=False)
|
| 237 |
+
(k_norm): LayerNorm((128,), eps=1e-05, elementwise_affine=True, bias=True)
|
| 238 |
+
(weights_proj): Linear(in_features=64, out_features=32, bias=False)
|
| 239 |
+
)
|
| 240 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 241 |
+
)
|
| 242 |
+
(mlp): HYV4MLP(
|
| 243 |
+
(gate_proj): Linear(in_features=64, out_features=128, bias=False)
|
| 244 |
+
(up_proj): Linear(in_features=64, out_features=128, bias=False)
|
| 245 |
+
(down_proj): Linear(in_features=128, out_features=64, bias=False)
|
| 246 |
+
(act_fn): SiLUActivation()
|
| 247 |
+
)
|
| 248 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 249 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 250 |
+
(attn_hc): HYV4HyperConnection(
|
| 251 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 252 |
+
)
|
| 253 |
+
(ffn_hc): HYV4HyperConnection(
|
| 254 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 255 |
+
)
|
| 256 |
+
)
|
| 257 |
+
(1): HYV4DecoderLayer(
|
| 258 |
+
(self_attn): HYV4Attention(
|
| 259 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 260 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 261 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 262 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 263 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 264 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 265 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 266 |
+
(indexer): HYV4Indexer(
|
| 267 |
+
(wq_b): Linear(in_features=64, out_features=4096, bias=False)
|
| 268 |
+
(wk): Linear(in_features=64, out_features=128, bias=False)
|
| 269 |
+
(k_norm): LayerNorm((128,), eps=1e-05, elementwise_affine=True, bias=True)
|
| 270 |
+
(weights_proj): Linear(in_features=64, out_features=32, bias=False)
|
| 271 |
+
)
|
| 272 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 273 |
+
)
|
| 274 |
+
(mlp): HYV4MoE(
|
| 275 |
+
(experts): HYV4Experts()
|
| 276 |
+
(gate): HYV4TopkRouter()
|
| 277 |
+
(shared_experts): HYV4MLP(
|
| 278 |
+
(gate_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 279 |
+
(up_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 280 |
+
(down_proj): Linear(in_features=512, out_features=64, bias=False)
|
| 281 |
+
(act_fn): SiLUActivation()
|
| 282 |
+
)
|
| 283 |
+
)
|
| 284 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 285 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 286 |
+
(attn_hc): HYV4HyperConnection(
|
| 287 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 288 |
+
)
|
| 289 |
+
(ffn_hc): HYV4HyperConnection(
|
| 290 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 291 |
+
)
|
| 292 |
+
)
|
| 293 |
+
(2-4): 3 x HYV4DecoderLayer(
|
| 294 |
+
(self_attn): HYV4Attention(
|
| 295 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 296 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 297 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 298 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 299 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 300 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 301 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 302 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 303 |
+
)
|
| 304 |
+
(mlp): HYV4MoE(
|
| 305 |
+
(experts): HYV4Experts()
|
| 306 |
+
(gate): HYV4TopkRouter()
|
| 307 |
+
(shared_experts): HYV4MLP(
|
| 308 |
+
(gate_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 309 |
+
(up_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 310 |
+
(down_proj): Linear(in_features=512, out_features=64, bias=False)
|
| 311 |
+
(act_fn): SiLUActivation()
|
| 312 |
+
)
|
| 313 |
+
)
|
| 314 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 315 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 316 |
+
(attn_hc): HYV4HyperConnection(
|
| 317 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 318 |
+
)
|
| 319 |
+
(ffn_hc): HYV4HyperConnection(
|
| 320 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 321 |
+
)
|
| 322 |
+
)
|
| 323 |
+
(5): HYV4DecoderLayer(
|
| 324 |
+
(self_attn): HYV4Attention(
|
| 325 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 326 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 327 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 328 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 329 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 330 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 331 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 332 |
+
(indexer): HYV4Indexer(
|
| 333 |
+
(wq_b): Linear(in_features=64, out_features=4096, bias=False)
|
| 334 |
+
(wk): Linear(in_features=64, out_features=128, bias=False)
|
| 335 |
+
(k_norm): LayerNorm((128,), eps=1e-05, elementwise_affine=True, bias=True)
|
| 336 |
+
(weights_proj): Linear(in_features=64, out_features=32, bias=False)
|
| 337 |
+
)
|
| 338 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 339 |
+
)
|
| 340 |
+
(mlp): HYV4MoE(
|
| 341 |
+
(experts): HYV4Experts()
|
| 342 |
+
(gate): HYV4TopkRouter()
|
| 343 |
+
(shared_experts): HYV4MLP(
|
| 344 |
+
(gate_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 345 |
+
(up_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 346 |
+
(down_proj): Linear(in_features=512, out_features=64, bias=False)
|
| 347 |
+
(act_fn): SiLUActivation()
|
| 348 |
+
)
|
| 349 |
+
)
|
| 350 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 351 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 352 |
+
(attn_hc): HYV4HyperConnection(
|
| 353 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 354 |
+
)
|
| 355 |
+
(ffn_hc): HYV4HyperConnection(
|
| 356 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 357 |
+
)
|
| 358 |
+
)
|
| 359 |
+
(6-8): 3 x HYV4DecoderLayer(
|
| 360 |
+
(self_attn): HYV4Attention(
|
| 361 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 362 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 363 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 364 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 365 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 366 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 367 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 368 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 369 |
+
)
|
| 370 |
+
(mlp): HYV4MoE(
|
| 371 |
+
(experts): HYV4Experts()
|
| 372 |
+
(gate): HYV4TopkRouter()
|
| 373 |
+
(shared_experts): HYV4MLP(
|
| 374 |
+
(gate_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 375 |
+
(up_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 376 |
+
(down_proj): Linear(in_features=512, out_features=64, bias=False)
|
| 377 |
+
(act_fn): SiLUActivation()
|
| 378 |
+
)
|
| 379 |
+
)
|
| 380 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 381 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 382 |
+
(attn_hc): HYV4HyperConnection(
|
| 383 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 384 |
+
)
|
| 385 |
+
(ffn_hc): HYV4HyperConnection(
|
| 386 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 387 |
+
)
|
| 388 |
+
)
|
| 389 |
+
(9): HYV4DecoderLayer(
|
| 390 |
+
(self_attn): HYV4Attention(
|
| 391 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 392 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 393 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 394 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 395 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 396 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 397 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 398 |
+
(indexer): HYV4Indexer(
|
| 399 |
+
(wq_b): Linear(in_features=64, out_features=4096, bias=False)
|
| 400 |
+
(wk): Linear(in_features=64, out_features=128, bias=False)
|
| 401 |
+
(k_norm): LayerNorm((128,), eps=1e-05, elementwise_affine=True, bias=True)
|
| 402 |
+
(weights_proj): Linear(in_features=64, out_features=32, bias=False)
|
| 403 |
+
)
|
| 404 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 405 |
+
)
|
| 406 |
+
(mlp): HYV4MoE(
|
| 407 |
+
(experts): HYV4Experts()
|
| 408 |
+
(gate): HYV4TopkRouter()
|
| 409 |
+
(shared_experts): HYV4MLP(
|
| 410 |
+
(gate_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 411 |
+
(up_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 412 |
+
(down_proj): Linear(in_features=512, out_features=64, bias=False)
|
| 413 |
+
(act_fn): SiLUActivation()
|
| 414 |
+
)
|
| 415 |
+
)
|
| 416 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 417 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 418 |
+
(attn_hc): HYV4HyperConnection(
|
| 419 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 420 |
+
)
|
| 421 |
+
(ffn_hc): HYV4HyperConnection(
|
| 422 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 423 |
+
)
|
| 424 |
+
)
|
| 425 |
+
)
|
| 426 |
+
(norm): HYV4RMSNorm((64,), eps=1e-05)
|
| 427 |
+
(rotary_emb): HYV4RotaryEmbedding()
|
| 428 |
+
(hc_head): HYV4HyperHead(
|
| 429 |
+
(input_norm): HYV4UnweightedRMSNorm()
|
| 430 |
+
)
|
| 431 |
+
(mtp_layers): ModuleList(
|
| 432 |
+
(0): ModuleDict(
|
| 433 |
+
(enorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 434 |
+
(hnorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 435 |
+
(eh_proj): Linear(in_features=128, out_features=64, bias=False)
|
| 436 |
+
(input_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 437 |
+
(self_attn): HYV4Attention(
|
| 438 |
+
(q_a_proj): Linear(in_features=64, out_features=64, bias=False)
|
| 439 |
+
(q_a_layernorm): HYV4RMSNorm((64,), eps=1e-06)
|
| 440 |
+
(q_b_proj): Linear(in_features=64, out_features=768, bias=False)
|
| 441 |
+
(kv_a_proj_with_mqa): Linear(in_features=64, out_features=576, bias=False)
|
| 442 |
+
(kv_a_layernorm): HYV4RMSNorm((512,), eps=1e-06)
|
| 443 |
+
(kv_b_proj): Linear(in_features=512, out_features=512, bias=False)
|
| 444 |
+
(o_proj): Linear(in_features=256, out_features=64, bias=False)
|
| 445 |
+
(indexer): HYV4Indexer(
|
| 446 |
+
(wq_b): Linear(in_features=64, out_features=4096, bias=False)
|
| 447 |
+
(wk): Linear(in_features=64, out_features=128, bias=False)
|
| 448 |
+
(k_norm): LayerNorm((128,), eps=1e-05, elementwise_affine=True, bias=True)
|
| 449 |
+
(weights_proj): Linear(in_features=64, out_features=32, bias=False)
|
| 450 |
+
)
|
| 451 |
+
(gate_proj): Linear(in_features=64, out_features=256, bias=False)
|
| 452 |
+
)
|
| 453 |
+
(post_attention_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 454 |
+
(mlp): HYV4MoE(
|
| 455 |
+
(experts): HYV4Experts()
|
| 456 |
+
(gate): HYV4TopkRouter()
|
| 457 |
+
(shared_experts): HYV4MLP(
|
| 458 |
+
(gate_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 459 |
+
(up_proj): Linear(in_features=64, out_features=512, bias=False)
|
| 460 |
+
(down_proj): Linear(in_features=512, out_features=64, bias=False)
|
| 461 |
+
(act_fn): SiLUActivation()
|
| 462 |
+
)
|
| 463 |
+
)
|
| 464 |
+
(final_layernorm): HYV4RMSNorm((64,), eps=1e-05)
|
| 465 |
+
)
|
| 466 |
+
)
|
| 467 |
+
)
|
| 468 |
+
(lm_head): Linear(in_features=64, out_features=120832, bias=False)
|
| 469 |
+
)
|
| 470 |
+
```
|
| 471 |
+
|
| 472 |
+
</details>
|
| 473 |
+
|
| 474 |
+
### Test environment:
|
| 475 |
+
|
| 476 |
+
- transformers: 5.19.0
|
| 477 |
+
- huggingface_hub: 1.33.0
|
| 478 |
+
- safetensors: 0.8.0
|
| 479 |
+
- accelerate: 1.15.0
|
| 480 |
+
- sglang: 0.5.23.dev384+g9ab74b851
|
| 481 |
+
- kernels: 0.17.0
|
| 482 |
+
- Python: 3.12.13
|
| 483 |
+
- CUDA: 13.0
|
| 484 |
+
- torch (Transformers/SGLang): 2.14.1
|
| 485 |
+
- flashinfer-python (Transformers/SGLang): 0.7.2
|
| 486 |
+
- vllm: 0.32.0
|
| 487 |
+
- torch (vLLM): 2.13.0+cu130
|
| 488 |
+
- flashinfer-python (vLLM): 0.7.0.post1
|
| 489 |
+
- CUDA (vLLM): 13.0
|
| 490 |
+
|
| 491 |
+
### Change log:
|
| 492 |
+
|
| 493 |
+
- 2026-10-23: Initial version.
|
| 494 |
+
|
| 495 |
+
This repo is generated by GPT-6.1-Sol
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#- ----------‑‑‑ special token variables ‑‑‑---------- -#}
|
| 2 |
+
{%- set HYTK = ':opensource' %}
|
| 3 |
+
{%- set hy_start_token = '<|hy_start{}|>'.format(HYTK) %}
|
| 4 |
+
{%- set hy_middle_token = '<|hy_middle{}|>'.format(HYTK) %}
|
| 5 |
+
{%- set hy_end_token = '<|hy_end{}|>'.format(HYTK) %}
|
| 6 |
+
{%- set think_begin_token = '<think{}>'.format(HYTK) %}
|
| 7 |
+
{%- set think_end_token = '</think{}>'.format(HYTK) %}
|
| 8 |
+
{%- set toolcalls_begin_token = '<tool_calls{}>'.format(HYTK) %}
|
| 9 |
+
{%- set toolcalls_end_token = '</tool_calls{}>'.format(HYTK) %}
|
| 10 |
+
{%- set toolcall_begin_token = '<tool_call{}>'.format(HYTK) %}
|
| 11 |
+
{%- set toolcall_end_token = '</tool_call{}>'.format(HYTK) %}
|
| 12 |
+
{%- set argkey_begin_token = '<arg_key{}>'.format(HYTK) %}
|
| 13 |
+
{%- set argkey_end_token = '</arg_key{}>'.format(HYTK) %}
|
| 14 |
+
{%- set argvalue_begin_token = '<arg_value{}>'.format(HYTK) %}
|
| 15 |
+
{%- set argvalue_end_token = '</arg_value{}>'.format(HYTK) %}
|
| 16 |
+
{%- set toolresponse_begin_token = '<tool_response{}>'.format(HYTK) %}
|
| 17 |
+
{%- set toolresponse_end_token = '</tool_response{}>'.format(HYTK) %}
|
| 18 |
+
{%- set reasoning_mode_token = '<|reasoning_mode{}|>'.format(HYTK) %}
|
| 19 |
+
|
| 20 |
+
{#- ----------‑‑‑ hyperparameters variables ‑‑‑---------- -#}
|
| 21 |
+
{%- if not add_generation_prompt is defined %}
|
| 22 |
+
{%- set add_generation_prompt = false %}
|
| 23 |
+
{%- endif %}
|
| 24 |
+
{%- if not preserved_thinking is defined %}
|
| 25 |
+
{%- if not tools %}
|
| 26 |
+
{%- set preserved_thinking = false %}
|
| 27 |
+
{%- else %}
|
| 28 |
+
{%- set preserved_thinking = true %}
|
| 29 |
+
{%- endif %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
|
| 32 |
+
{%- if not reasoning_effort is defined %}
|
| 33 |
+
{%- set reasoning_effort = 'high' %}
|
| 34 |
+
{%- elif reasoning_effort not in ['high', 'no_think'] %}
|
| 35 |
+
{%- if reasoning_effort is none %}
|
| 36 |
+
{{- raise_exception('reasoning_effort error : None, should be no_think/high') }}
|
| 37 |
+
{%- else %}
|
| 38 |
+
{{- raise_exception('reasoning_effort error : ' + reasoning_effort + ', should be no_think/high') }}
|
| 39 |
+
{%- endif %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
|
| 42 |
+
{%- if fallback_strategy is defined and fallback_strategy == 'reasoning_toolcall_retry' %}
|
| 43 |
+
{%- set reasoning_effort = 'high' %}
|
| 44 |
+
{%- set add_generation_prompt = false %}
|
| 45 |
+
{%- endif %}
|
| 46 |
+
{%- if not raw_last_assistant is defined %}
|
| 47 |
+
{%- set raw_last_assistant = false %}
|
| 48 |
+
{%- endif %}
|
| 49 |
+
|
| 50 |
+
{%- macro tool_to_json(tool) -%}
|
| 51 |
+
{%- set ns_tool = namespace(first=true) -%}
|
| 52 |
+
{{- '{' -}}
|
| 53 |
+
{%- for k, v in tool.items() -%}
|
| 54 |
+
{%- if k != 'defer_loading' and k != 'strict' -%}
|
| 55 |
+
{%- if not ns_tool.first -%}{{- ', ' -}}{%- endif -%}
|
| 56 |
+
{%- set ns_tool.first = false -%}
|
| 57 |
+
{{- '"' ~ k ~ '": ' ~ (v | tojson(ensure_ascii=False)) -}}
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- endfor -%}
|
| 60 |
+
{{- '}' -}}
|
| 61 |
+
{%- endmacro -%}
|
| 62 |
+
|
| 63 |
+
{%- macro render_content(content) -%}
|
| 64 |
+
{%- if content is string -%}
|
| 65 |
+
{{- content -}}
|
| 66 |
+
{%- elif content is iterable and content is not mapping -%}
|
| 67 |
+
{%- for item in content -%}
|
| 68 |
+
{%- if item is mapping and item.type == 'text' -%}
|
| 69 |
+
{{- item.text -}}
|
| 70 |
+
{%- elif item is string -%}
|
| 71 |
+
{{- item -}}
|
| 72 |
+
{%- else -%}
|
| 73 |
+
{{- item | string -}}
|
| 74 |
+
{%- endif -%}
|
| 75 |
+
{%- endfor -%}
|
| 76 |
+
{%- elif content is none -%}
|
| 77 |
+
{{- '' -}}
|
| 78 |
+
{%- else -%}
|
| 79 |
+
{{- content | string -}}
|
| 80 |
+
{%- endif -%}
|
| 81 |
+
{%- endmacro -%}
|
| 82 |
+
|
| 83 |
+
{%- macro render_tools_prompt() -%}
|
| 84 |
+
{{- '# Tools\n\nYou may call one or more functions to assist with the user query.' -}}
|
| 85 |
+
{{- '\n\nYou are provided with function signatures within <tools></tools> XML tags:' -}}
|
| 86 |
+
{{- '\n<tools>\n' -}}
|
| 87 |
+
{%- set tool_ns = namespace(first=true) -%}
|
| 88 |
+
{%- for tool in tools -%}
|
| 89 |
+
{%- set t = tool['function'] if tool is mapping and 'function' in tool else tool -%}
|
| 90 |
+
{%- if t.defer_loading is not defined or not t.defer_loading -%}
|
| 91 |
+
{%- if not tool_ns.first -%}{{- '\n' -}}{%- endif -%}
|
| 92 |
+
{%- set tool_ns.first = false -%}
|
| 93 |
+
{{- tool_to_json(t) -}}
|
| 94 |
+
{%- endif -%}
|
| 95 |
+
{%- endfor -%}
|
| 96 |
+
{{- '\n</tools>\n\n' -}}
|
| 97 |
+
{{- 'For function call returns, you should first print ' ~ toolcalls_begin_token -}}
|
| 98 |
+
{{- '\nFor each function call, you should return object like:\n' -}}
|
| 99 |
+
{{- toolcall_begin_token ~ '{function-name}' -}}
|
| 100 |
+
{{- argkey_begin_token ~ '{arg-key-1}' ~ argkey_end_token -}}
|
| 101 |
+
{{- argvalue_begin_token ~ '{arg-value-1}' ~ argvalue_end_token -}}
|
| 102 |
+
{{- argkey_begin_token ~ '{arg-key-2}' ~ argkey_end_token -}}
|
| 103 |
+
{{- argvalue_begin_token ~ '{arg-value-2}' ~ argvalue_end_token -}}
|
| 104 |
+
{{- '...' -}}
|
| 105 |
+
{{- toolcall_end_token -}}
|
| 106 |
+
{{- '\nAt the end of function call returns, you should print ' ~ toolcalls_end_token -}}
|
| 107 |
+
{%- endmacro -%}
|
| 108 |
+
|
| 109 |
+
{%- macro render_tool_response(message) -%}
|
| 110 |
+
{%- set content = message['content'] -%}
|
| 111 |
+
{%- if content is string -%}
|
| 112 |
+
{{- toolresponse_begin_token ~ content ~ toolresponse_end_token -}}
|
| 113 |
+
{%- elif content is iterable and content is not mapping and content and content[0] is mapping and content[0].type == 'tool_reference' -%}
|
| 114 |
+
{{- toolresponse_begin_token -}}
|
| 115 |
+
{{- '<tools>\n' -}}
|
| 116 |
+
{%- for tr in content -%}
|
| 117 |
+
{%- for tool in tools -%}
|
| 118 |
+
{%- set t = tool['function'] if tool is mapping and 'function' in tool else tool -%}
|
| 119 |
+
{%- if t.name == tr.name -%}
|
| 120 |
+
{{- tool_to_json(t) ~ '\n' -}}
|
| 121 |
+
{%- endif -%}
|
| 122 |
+
{%- endfor -%}
|
| 123 |
+
{%- endfor -%}
|
| 124 |
+
{{- '</tools>' -}}
|
| 125 |
+
{{- toolresponse_end_token -}}
|
| 126 |
+
{%- elif content is iterable and content is not mapping and content and content[0] is mapping and content[0].output is defined -%}
|
| 127 |
+
{%- for tr in content -%}
|
| 128 |
+
{{- toolresponse_begin_token ~ tr.output ~ toolresponse_end_token -}}
|
| 129 |
+
{%- endfor -%}
|
| 130 |
+
{%- else -%}
|
| 131 |
+
{{- toolresponse_begin_token ~ render_content(content) ~ toolresponse_end_token -}}
|
| 132 |
+
{%- endif -%}
|
| 133 |
+
{%- endmacro -%}
|
| 134 |
+
|
| 135 |
+
{#- consecutive tool messages are clustered into a single tool message whose content is the list of the original tool messages; the result is written to merged_ns.messages (a macro cannot return a list) -#}
|
| 136 |
+
{%- set merged_ns = namespace(messages=[]) %}
|
| 137 |
+
{%- macro merge_tool_responses(messages) -%}
|
| 138 |
+
{%- set merge_ns = namespace(result=[], cluster=[]) -%}
|
| 139 |
+
{%- for message in messages -%}
|
| 140 |
+
{%- if message['role'] == 'tool' -%}
|
| 141 |
+
{%- set merge_ns.cluster = merge_ns.cluster + [message] -%}
|
| 142 |
+
{%- else -%}
|
| 143 |
+
{%- if merge_ns.cluster -%}
|
| 144 |
+
{%- set merge_ns.result = merge_ns.result + [{'role': 'tool', 'content': merge_ns.cluster}] -%}
|
| 145 |
+
{%- set merge_ns.cluster = [] -%}
|
| 146 |
+
{%- endif -%}
|
| 147 |
+
{%- set merge_ns.result = merge_ns.result + [message] -%}
|
| 148 |
+
{%- endif -%}
|
| 149 |
+
{%- endfor -%}
|
| 150 |
+
{%- if merge_ns.cluster -%}
|
| 151 |
+
{%- set merge_ns.result = merge_ns.result + [{'role': 'tool', 'content': merge_ns.cluster}] -%}
|
| 152 |
+
{%- endif -%}
|
| 153 |
+
{%- set merged_ns.messages = merge_ns.result -%}
|
| 154 |
+
{%- endmacro -%}
|
| 155 |
+
|
| 156 |
+
{#- render one tool cluster, reordered to follow the tool_call order of the preceding assistant turn; any missing / ambiguous id falls back to the original tool message order for the whole cluster -#}
|
| 157 |
+
{%- macro render_tool_responses(tool_messages, tool_call_ids) -%}
|
| 158 |
+
{%- set order_ns = namespace(ordered=[], matched=true) -%}
|
| 159 |
+
{%- if tool_call_ids and tool_call_ids | length == tool_messages | length -%}
|
| 160 |
+
{%- for tool_call_id in tool_call_ids -%}
|
| 161 |
+
{%- set hit_ns = namespace(count=0, message=none) -%}
|
| 162 |
+
{%- for tool_message in tool_messages -%}
|
| 163 |
+
{%- set message_id = tool_message['tool_call_id'] if tool_message['tool_call_id'] is defined else tool_message['id'] -%}
|
| 164 |
+
{%- if message_id is defined and message_id == tool_call_id -%}
|
| 165 |
+
{%- set hit_ns.count = hit_ns.count + 1 -%}
|
| 166 |
+
{%- set hit_ns.message = tool_message -%}
|
| 167 |
+
{%- endif -%}
|
| 168 |
+
{%- endfor -%}
|
| 169 |
+
{%- if hit_ns.count == 1 -%}
|
| 170 |
+
{%- set order_ns.ordered = order_ns.ordered + [hit_ns.message] -%}
|
| 171 |
+
{%- else -%}
|
| 172 |
+
{%- set order_ns.matched = false -%}
|
| 173 |
+
{%- endif -%}
|
| 174 |
+
{%- endfor -%}
|
| 175 |
+
{%- else -%}
|
| 176 |
+
{%- set order_ns.matched = false -%}
|
| 177 |
+
{%- endif -%}
|
| 178 |
+
{%- for tool_message in (order_ns.ordered if order_ns.matched else tool_messages) -%}
|
| 179 |
+
{{- render_tool_response(tool_message) -}}
|
| 180 |
+
{%- endfor -%}
|
| 181 |
+
{%- endmacro -%}
|
| 182 |
+
|
| 183 |
+
{%- set _ = merge_tool_responses(messages) %}
|
| 184 |
+
{%- set normed_messages = merged_ns.messages %}
|
| 185 |
+
|
| 186 |
+
{%- set ns = namespace(last_user_index=-1, has_leading_system=false) %}
|
| 187 |
+
{%- if normed_messages and normed_messages[0].role == 'system' %}
|
| 188 |
+
{%- set ns.has_leading_system = true %}
|
| 189 |
+
{%- endif %}
|
| 190 |
+
{%- for message in normed_messages %}
|
| 191 |
+
{%- if message['role'] == 'user' %}
|
| 192 |
+
{%- set ns.last_user_index = loop.index0 %}
|
| 193 |
+
{%- endif %}
|
| 194 |
+
{%- endfor %}
|
| 195 |
+
|
| 196 |
+
{#- no leading system: synthesize one for tools and/or reasoning_mode -#}
|
| 197 |
+
{%- if not ns.has_leading_system %}
|
| 198 |
+
{{- hy_start_token ~ 'system' ~ hy_middle_token -}}
|
| 199 |
+
{%- if tools %}
|
| 200 |
+
{{- render_tools_prompt() -}}
|
| 201 |
+
{%- endif %}
|
| 202 |
+
{{- reasoning_mode_token ~ 'reasoning_effort:' ~ reasoning_effort -}}
|
| 203 |
+
{{- hy_end_token -}}
|
| 204 |
+
{%- endif %}
|
| 205 |
+
|
| 206 |
+
{%- set last_ns = namespace(last_is_assistant=false) %}
|
| 207 |
+
{%- set prev_ns = namespace(tool_call_ids=[]) %}
|
| 208 |
+
{%- for message in normed_messages %}
|
| 209 |
+
{%- if message['role'] == 'system' %}
|
| 210 |
+
{{- hy_start_token ~ 'system' ~ hy_middle_token -}}
|
| 211 |
+
{#- tools / reasoning_mode only attach to the leading system (messages[0]) -#}
|
| 212 |
+
{%- if loop.first %}
|
| 213 |
+
{%- if tools %}
|
| 214 |
+
{{- render_tools_prompt() -}}
|
| 215 |
+
{%- endif %}
|
| 216 |
+
{%- set content = render_content(message['content']) -%}
|
| 217 |
+
{%- if tools and content -%}
|
| 218 |
+
{{- '\n\n' -}}
|
| 219 |
+
{%- endif -%}
|
| 220 |
+
{{- content -}}
|
| 221 |
+
{{- reasoning_mode_token ~ 'reasoning_effort:' ~ reasoning_effort -}}
|
| 222 |
+
{%- else %}
|
| 223 |
+
{{- render_content(message['content']) -}}
|
| 224 |
+
{%- endif %}
|
| 225 |
+
{{- hy_end_token -}}
|
| 226 |
+
{%- elif message['role'] == 'user' %}
|
| 227 |
+
{{- hy_start_token ~ 'user' ~ hy_middle_token -}}
|
| 228 |
+
{{- render_content(message['content']) -}}
|
| 229 |
+
{{- hy_end_token -}}
|
| 230 |
+
{%- elif message['role'] == 'assistant' %}
|
| 231 |
+
{%- set content_body = render_content(message['content']) -%}
|
| 232 |
+
{#- 'reasoning' takes precedence, fall back to 'reasoning_content' when it is empty -#}
|
| 233 |
+
{%- set reasoning_text = '' %}
|
| 234 |
+
{%- if message['reasoning'] is defined and message['reasoning'] is string and message['reasoning'] %}
|
| 235 |
+
{%- set reasoning_text = message['reasoning'] %}
|
| 236 |
+
{%- elif message['reasoning_content'] is defined and message['reasoning_content'] is string and message['reasoning_content'] %}
|
| 237 |
+
{%- set reasoning_text = message['reasoning_content'] %}
|
| 238 |
+
{%- endif %}
|
| 239 |
+
{#- no_think overrides preserved_thinking: history is always emitted with empty think tags -#}
|
| 240 |
+
{%- if reasoning_effort != 'no_think' and (preserved_thinking or loop.index0 > ns.last_user_index) and reasoning_text %}
|
| 241 |
+
{%- set content = think_begin_token ~ reasoning_text ~ think_end_token ~ content_body %}
|
| 242 |
+
{%- else %}
|
| 243 |
+
{%- set content = think_begin_token ~ think_end_token ~ content_body %}
|
| 244 |
+
{%- endif %}
|
| 245 |
+
{{- hy_start_token ~ 'assistant' ~ hy_middle_token -}}
|
| 246 |
+
{%- if message['tool_calls'] is defined and message['tool_calls'] %}
|
| 247 |
+
{#- remember the tool_call ids of this turn to order the following tool responses; an incomplete id set means "do not reorder" -#}
|
| 248 |
+
{%- set ids_ns = namespace(ids=[], complete=true) %}
|
| 249 |
+
{%- for tool in message['tool_calls'] %}
|
| 250 |
+
{%- set tool_call_id = tool['id'] if tool['id'] is defined and tool['id'] else tool['tool_call_id'] %}
|
| 251 |
+
{%- if tool_call_id is defined and tool_call_id %}
|
| 252 |
+
{%- set ids_ns.ids = ids_ns.ids + [tool_call_id] %}
|
| 253 |
+
{%- else %}
|
| 254 |
+
{%- set ids_ns.complete = false %}
|
| 255 |
+
{%- endif %}
|
| 256 |
+
{%- endfor %}
|
| 257 |
+
{%- set prev_ns.tool_call_ids = ids_ns.ids if ids_ns.complete else [] %}
|
| 258 |
+
{{- content -}}
|
| 259 |
+
{{- toolcalls_begin_token -}}
|
| 260 |
+
{%- for tool in message['tool_calls'] -%}
|
| 261 |
+
{%- set func = tool['function'] if tool is mapping and 'function' in tool else tool -%}
|
| 262 |
+
{%- set arguments = func['arguments'] -%}
|
| 263 |
+
{{- toolcall_begin_token ~ func['name'] -}}
|
| 264 |
+
{%- for key, value in arguments.items() -%}
|
| 265 |
+
{{- argkey_begin_token ~ key ~ argkey_end_token -}}
|
| 266 |
+
{%- if value is not string -%}
|
| 267 |
+
{%- set value = value | tojson(ensure_ascii=False) -%}
|
| 268 |
+
{%- endif -%}
|
| 269 |
+
{{- argvalue_begin_token ~ value ~ argvalue_end_token -}}
|
| 270 |
+
{%- endfor -%}
|
| 271 |
+
{{- toolcall_end_token -}}
|
| 272 |
+
{%- endfor -%}
|
| 273 |
+
{{- toolcalls_end_token -}}
|
| 274 |
+
{%- else %}
|
| 275 |
+
{%- if loop.last and raw_last_assistant %}
|
| 276 |
+
{{- content_body -}}
|
| 277 |
+
{%- else %}
|
| 278 |
+
{{- content -}}
|
| 279 |
+
{%- endif %}
|
| 280 |
+
{%- endif %}
|
| 281 |
+
{#- continuation / prefill: last assistant is still open, do not close with hy_end -#}
|
| 282 |
+
{%- if not (loop.last and raw_last_assistant) and not (loop.last and fallback_strategy is defined and fallback_strategy == 'reasoning_toolcall_retry') %}
|
| 283 |
+
{{- hy_end_token -}}
|
| 284 |
+
{%- endif %}
|
| 285 |
+
{%- elif message['role'] == 'tool' %}
|
| 286 |
+
{{- hy_start_token ~ 'tool' ~ hy_middle_token -}}
|
| 287 |
+
{{- render_tool_responses(message['content'], prev_ns.tool_call_ids) -}}
|
| 288 |
+
{{- hy_end_token -}}
|
| 289 |
+
{%- else %}
|
| 290 |
+
{{- hy_start_token ~ message['role'] ~ hy_middle_token -}}
|
| 291 |
+
{{- render_content(message['content']) -}}
|
| 292 |
+
{{- hy_end_token -}}
|
| 293 |
+
{%- endif %}
|
| 294 |
+
{%- if message['role'] != 'assistant' or not (message['tool_calls'] is defined and message['tool_calls']) %}
|
| 295 |
+
{%- set prev_ns.tool_call_ids = [] %}
|
| 296 |
+
{%- endif %}
|
| 297 |
+
{%- if loop.last and message['role'] == 'assistant' %}
|
| 298 |
+
{%- set last_ns.last_is_assistant = true %}
|
| 299 |
+
{%- endif %}
|
| 300 |
+
{%- endfor %}
|
| 301 |
+
{%- if add_generation_prompt %}
|
| 302 |
+
{%- if not last_ns.last_is_assistant %}
|
| 303 |
+
{%- if reasoning_effort == 'no_think' %}
|
| 304 |
+
{{- hy_start_token ~ 'assistant' ~ hy_middle_token ~ think_begin_token ~ think_end_token -}}
|
| 305 |
+
{%- else %}
|
| 306 |
+
{{- hy_start_token ~ 'assistant' ~ hy_middle_token ~ think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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HYV4ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bitwise_backward_align": false,
|
| 8 |
+
"bos_token_id": 120000,
|
| 9 |
+
"dtype": "bfloat16",
|
| 10 |
+
"enable_ihc": true,
|
| 11 |
+
"enable_lm_head_fp32": true,
|
| 12 |
+
"eos_token_id": 120025,
|
| 13 |
+
"gated_mla": true,
|
| 14 |
+
"gating_type": "elementwise",
|
| 15 |
+
"hc_eps": 1e-06,
|
| 16 |
+
"hc_magnitude": 2.0,
|
| 17 |
+
"hc_mult": 4,
|
| 18 |
+
"head_dim": 64,
|
| 19 |
+
"hidden_act": "silu",
|
| 20 |
+
"hidden_size": 64,
|
| 21 |
+
"index_head_dim": 128,
|
| 22 |
+
"index_n_heads": 32,
|
| 23 |
+
"index_topk": 2048,
|
| 24 |
+
"indexer_types": [
|
| 25 |
+
"full",
|
| 26 |
+
"full",
|
| 27 |
+
"shared",
|
| 28 |
+
"shared",
|
| 29 |
+
"shared",
|
| 30 |
+
"full",
|
| 31 |
+
"shared",
|
| 32 |
+
"shared",
|
| 33 |
+
"shared",
|
| 34 |
+
"full"
|
| 35 |
+
],
|
| 36 |
+
"initializer_range": 0.006,
|
| 37 |
+
"intermediate_size": 128,
|
| 38 |
+
"kv_lora_rank": 512,
|
| 39 |
+
"layer_types": [
|
| 40 |
+
"indexed_attention",
|
| 41 |
+
"indexed_attention",
|
| 42 |
+
"indexed_attention",
|
| 43 |
+
"indexed_attention",
|
| 44 |
+
"indexed_attention",
|
| 45 |
+
"indexed_attention",
|
| 46 |
+
"indexed_attention",
|
| 47 |
+
"indexed_attention",
|
| 48 |
+
"indexed_attention",
|
| 49 |
+
"indexed_attention"
|
| 50 |
+
],
|
| 51 |
+
"learnable_sink": true,
|
| 52 |
+
"learnable_sink_init": 0.0,
|
| 53 |
+
"max_position_embeddings": 1048576,
|
| 54 |
+
"mlp_layer_types": [
|
| 55 |
+
"dense",
|
| 56 |
+
"sparse",
|
| 57 |
+
"sparse",
|
| 58 |
+
"sparse",
|
| 59 |
+
"sparse",
|
| 60 |
+
"sparse",
|
| 61 |
+
"sparse",
|
| 62 |
+
"sparse",
|
| 63 |
+
"sparse",
|
| 64 |
+
"sparse"
|
| 65 |
+
],
|
| 66 |
+
"model_type": "hy_v4",
|
| 67 |
+
"moe_intermediate_size": 512,
|
| 68 |
+
"mtp_loss_factor": 0.1,
|
| 69 |
+
"n_group": 1,
|
| 70 |
+
"n_routed_experts": 32,
|
| 71 |
+
"n_shared_experts": 1,
|
| 72 |
+
"norm_topk_prob": true,
|
| 73 |
+
"num_attention_heads": 8,
|
| 74 |
+
"num_experts_per_tok": 8,
|
| 75 |
+
"num_hidden_layers": 10,
|
| 76 |
+
"num_key_value_heads": 8,
|
| 77 |
+
"num_nextn_predict_layers": 1,
|
| 78 |
+
"pad_token_id": 120002,
|
| 79 |
+
"q_lora_rank": 64,
|
| 80 |
+
"qk_head_dim": 96,
|
| 81 |
+
"qk_nope_head_dim": 32,
|
| 82 |
+
"qk_rope_head_dim": 64,
|
| 83 |
+
"rms_norm_eps": 1e-05,
|
| 84 |
+
"rope_parameters": {
|
| 85 |
+
"rope_theta": 10000000,
|
| 86 |
+
"rope_type": "default"
|
| 87 |
+
},
|
| 88 |
+
"routed_scaling_factor": 2.827,
|
| 89 |
+
"swiglu_limit": 10.0,
|
| 90 |
+
"tie_word_embeddings": false,
|
| 91 |
+
"topk_group": 1,
|
| 92 |
+
"transformers_version": "5.16.2",
|
| 93 |
+
"use_cache": true,
|
| 94 |
+
"use_dsa": true,
|
| 95 |
+
"use_mla": true,
|
| 96 |
+
"v_head_dim": 32,
|
| 97 |
+
"vocab_size": 120832,
|
| 98 |
+
"torch_dtype": "bfloat16",
|
| 99 |
+
"quantization_config": {
|
| 100 |
+
"quant_method": "modelopt",
|
| 101 |
+
"quantization": {
|
| 102 |
+
"quant_algo": "MXFP8",
|
| 103 |
+
"kv_cache_quant_algo": null,
|
| 104 |
+
"exclude_modules": [
|
| 105 |
+
"lm_head",
|
| 106 |
+
"model.embed_tokens",
|
| 107 |
+
"model.hc_head.hc_head_fn",
|
| 108 |
+
"model.layers.0.hc_attn_layer.hc_pre.hc_fn",
|
| 109 |
+
"model.layers.0.hc_mlp_layer.hc_pre.hc_fn",
|
| 110 |
+
"model.layers.0.self_attn.indexer.weights_proj",
|
| 111 |
+
"model.layers.0.self_attn.linear_gate",
|
| 112 |
+
"model.layers.1.hc_attn_layer.hc_pre.hc_fn",
|
| 113 |
+
"model.layers.1.hc_mlp_layer.hc_pre.hc_fn",
|
| 114 |
+
"model.layers.1.mlp.gate",
|
| 115 |
+
"model.layers.1.self_attn.indexer.weights_proj",
|
| 116 |
+
"model.layers.1.self_attn.linear_gate",
|
| 117 |
+
"model.layers.10.hc_attn_layer.hc_pre.hc_fn",
|
| 118 |
+
"model.layers.10.hc_mlp_layer.hc_pre.hc_fn",
|
| 119 |
+
"model.layers.10.mlp.gate",
|
| 120 |
+
"model.layers.10.self_attn.linear_gate",
|
| 121 |
+
"model.layers.11.hc_attn_layer.hc_pre.hc_fn",
|
| 122 |
+
"model.layers.11.hc_mlp_layer.hc_pre.hc_fn",
|
| 123 |
+
"model.layers.11.mlp.gate",
|
| 124 |
+
"model.layers.11.self_attn.linear_gate",
|
| 125 |
+
"model.layers.12.hc_attn_layer.hc_pre.hc_fn",
|
| 126 |
+
"model.layers.12.hc_mlp_layer.hc_pre.hc_fn",
|
| 127 |
+
"model.layers.12.mlp.gate",
|
| 128 |
+
"model.layers.12.self_attn.linear_gate",
|
| 129 |
+
"model.layers.13.hc_attn_layer.hc_pre.hc_fn",
|
| 130 |
+
"model.layers.13.hc_mlp_layer.hc_pre.hc_fn",
|
| 131 |
+
"model.layers.13.mlp.gate",
|
| 132 |
+
"model.layers.13.self_attn.indexer.weights_proj",
|
| 133 |
+
"model.layers.13.self_attn.linear_gate",
|
| 134 |
+
"model.layers.14.hc_attn_layer.hc_pre.hc_fn",
|
| 135 |
+
"model.layers.14.hc_mlp_layer.hc_pre.hc_fn",
|
| 136 |
+
"model.layers.14.mlp.gate",
|
| 137 |
+
"model.layers.14.self_attn.linear_gate",
|
| 138 |
+
"model.layers.15.hc_attn_layer.hc_pre.hc_fn",
|
| 139 |
+
"model.layers.15.hc_mlp_layer.hc_pre.hc_fn",
|
| 140 |
+
"model.layers.15.mlp.gate",
|
| 141 |
+
"model.layers.15.self_attn.linear_gate",
|
| 142 |
+
"model.layers.16.hc_attn_layer.hc_pre.hc_fn",
|
| 143 |
+
"model.layers.16.hc_mlp_layer.hc_pre.hc_fn",
|
| 144 |
+
"model.layers.16.mlp.gate",
|
| 145 |
+
"model.layers.16.self_attn.linear_gate",
|
| 146 |
+
"model.layers.17.hc_attn_layer.hc_pre.hc_fn",
|
| 147 |
+
"model.layers.17.hc_mlp_layer.hc_pre.hc_fn",
|
| 148 |
+
"model.layers.17.mlp.gate",
|
| 149 |
+
"model.layers.17.self_attn.indexer.weights_proj",
|
| 150 |
+
"model.layers.17.self_attn.linear_gate",
|
| 151 |
+
"model.layers.18.hc_attn_layer.hc_pre.hc_fn",
|
| 152 |
+
"model.layers.18.hc_mlp_layer.hc_pre.hc_fn",
|
| 153 |
+
"model.layers.18.mlp.gate",
|
| 154 |
+
"model.layers.18.self_attn.linear_gate",
|
| 155 |
+
"model.layers.19.hc_attn_layer.hc_pre.hc_fn",
|
| 156 |
+
"model.layers.19.hc_mlp_layer.hc_pre.hc_fn",
|
| 157 |
+
"model.layers.19.mlp.gate",
|
| 158 |
+
"model.layers.19.self_attn.linear_gate",
|
| 159 |
+
"model.layers.2.hc_attn_layer.hc_pre.hc_fn",
|
| 160 |
+
"model.layers.2.hc_mlp_layer.hc_pre.hc_fn",
|
| 161 |
+
"model.layers.2.mlp.gate",
|
| 162 |
+
"model.layers.2.self_attn.linear_gate",
|
| 163 |
+
"model.layers.20.hc_attn_layer.hc_pre.hc_fn",
|
| 164 |
+
"model.layers.20.hc_mlp_layer.hc_pre.hc_fn",
|
| 165 |
+
"model.layers.20.mlp.gate",
|
| 166 |
+
"model.layers.20.self_attn.linear_gate",
|
| 167 |
+
"model.layers.21.hc_attn_layer.hc_pre.hc_fn",
|
| 168 |
+
"model.layers.21.hc_mlp_layer.hc_pre.hc_fn",
|
| 169 |
+
"model.layers.21.mlp.gate",
|
| 170 |
+
"model.layers.21.self_attn.indexer.weights_proj",
|
| 171 |
+
"model.layers.21.self_attn.linear_gate",
|
| 172 |
+
"model.layers.22.hc_attn_layer.hc_pre.hc_fn",
|
| 173 |
+
"model.layers.22.hc_mlp_layer.hc_pre.hc_fn",
|
| 174 |
+
"model.layers.22.mlp.gate",
|
| 175 |
+
"model.layers.22.self_attn.linear_gate",
|
| 176 |
+
"model.layers.23.hc_attn_layer.hc_pre.hc_fn",
|
| 177 |
+
"model.layers.23.hc_mlp_layer.hc_pre.hc_fn",
|
| 178 |
+
"model.layers.23.mlp.gate",
|
| 179 |
+
"model.layers.23.self_attn.linear_gate",
|
| 180 |
+
"model.layers.24.hc_attn_layer.hc_pre.hc_fn",
|
| 181 |
+
"model.layers.24.hc_mlp_layer.hc_pre.hc_fn",
|
| 182 |
+
"model.layers.24.mlp.gate",
|
| 183 |
+
"model.layers.24.self_attn.linear_gate",
|
| 184 |
+
"model.layers.25.hc_attn_layer.hc_pre.hc_fn",
|
| 185 |
+
"model.layers.25.hc_mlp_layer.hc_pre.hc_fn",
|
| 186 |
+
"model.layers.25.mlp.gate",
|
| 187 |
+
"model.layers.25.self_attn.indexer.weights_proj",
|
| 188 |
+
"model.layers.25.self_attn.linear_gate",
|
| 189 |
+
"model.layers.26.hc_attn_layer.hc_pre.hc_fn",
|
| 190 |
+
"model.layers.26.hc_mlp_layer.hc_pre.hc_fn",
|
| 191 |
+
"model.layers.26.mlp.gate",
|
| 192 |
+
"model.layers.26.self_attn.linear_gate",
|
| 193 |
+
"model.layers.27.hc_attn_layer.hc_pre.hc_fn",
|
| 194 |
+
"model.layers.27.hc_mlp_layer.hc_pre.hc_fn",
|
| 195 |
+
"model.layers.27.mlp.gate",
|
| 196 |
+
"model.layers.27.self_attn.linear_gate",
|
| 197 |
+
"model.layers.28.hc_attn_layer.hc_pre.hc_fn",
|
| 198 |
+
"model.layers.28.hc_mlp_layer.hc_pre.hc_fn",
|
| 199 |
+
"model.layers.28.mlp.gate",
|
| 200 |
+
"model.layers.28.self_attn.linear_gate",
|
| 201 |
+
"model.layers.29.hc_attn_layer.hc_pre.hc_fn",
|
| 202 |
+
"model.layers.29.hc_mlp_layer.hc_pre.hc_fn",
|
| 203 |
+
"model.layers.29.mlp.gate",
|
| 204 |
+
"model.layers.29.self_attn.indexer.weights_proj",
|
| 205 |
+
"model.layers.29.self_attn.linear_gate",
|
| 206 |
+
"model.layers.3.hc_attn_layer.hc_pre.hc_fn",
|
| 207 |
+
"model.layers.3.hc_mlp_layer.hc_pre.hc_fn",
|
| 208 |
+
"model.layers.3.mlp.gate",
|
| 209 |
+
"model.layers.3.self_attn.linear_gate",
|
| 210 |
+
"model.layers.30.hc_attn_layer.hc_pre.hc_fn",
|
| 211 |
+
"model.layers.30.hc_mlp_layer.hc_pre.hc_fn",
|
| 212 |
+
"model.layers.30.mlp.gate",
|
| 213 |
+
"model.layers.30.self_attn.linear_gate",
|
| 214 |
+
"model.layers.31.hc_attn_layer.hc_pre.hc_fn",
|
| 215 |
+
"model.layers.31.hc_mlp_layer.hc_pre.hc_fn",
|
| 216 |
+
"model.layers.31.mlp.gate",
|
| 217 |
+
"model.layers.31.self_attn.linear_gate",
|
| 218 |
+
"model.layers.32.hc_attn_layer.hc_pre.hc_fn",
|
| 219 |
+
"model.layers.32.hc_mlp_layer.hc_pre.hc_fn",
|
| 220 |
+
"model.layers.32.mlp.gate",
|
| 221 |
+
"model.layers.32.self_attn.linear_gate",
|
| 222 |
+
"model.layers.33.hc_attn_layer.hc_pre.hc_fn",
|
| 223 |
+
"model.layers.33.hc_mlp_layer.hc_pre.hc_fn",
|
| 224 |
+
"model.layers.33.mlp.gate",
|
| 225 |
+
"model.layers.33.self_attn.indexer.weights_proj",
|
| 226 |
+
"model.layers.33.self_attn.linear_gate",
|
| 227 |
+
"model.layers.34.hc_attn_layer.hc_pre.hc_fn",
|
| 228 |
+
"model.layers.34.hc_mlp_layer.hc_pre.hc_fn",
|
| 229 |
+
"model.layers.34.mlp.gate",
|
| 230 |
+
"model.layers.34.self_attn.linear_gate",
|
| 231 |
+
"model.layers.35.hc_attn_layer.hc_pre.hc_fn",
|
| 232 |
+
"model.layers.35.hc_mlp_layer.hc_pre.hc_fn",
|
| 233 |
+
"model.layers.35.mlp.gate",
|
| 234 |
+
"model.layers.35.self_attn.linear_gate",
|
| 235 |
+
"model.layers.36.hc_attn_layer.hc_pre.hc_fn",
|
| 236 |
+
"model.layers.36.hc_mlp_layer.hc_pre.hc_fn",
|
| 237 |
+
"model.layers.36.mlp.gate",
|
| 238 |
+
"model.layers.36.self_attn.linear_gate",
|
| 239 |
+
"model.layers.37.hc_attn_layer.hc_pre.hc_fn",
|
| 240 |
+
"model.layers.37.hc_mlp_layer.hc_pre.hc_fn",
|
| 241 |
+
"model.layers.37.mlp.gate",
|
| 242 |
+
"model.layers.37.self_attn.indexer.weights_proj",
|
| 243 |
+
"model.layers.37.self_attn.linear_gate",
|
| 244 |
+
"model.layers.38.hc_attn_layer.hc_pre.hc_fn",
|
| 245 |
+
"model.layers.38.hc_mlp_layer.hc_pre.hc_fn",
|
| 246 |
+
"model.layers.38.mlp.gate",
|
| 247 |
+
"model.layers.38.self_attn.linear_gate",
|
| 248 |
+
"model.layers.39.hc_attn_layer.hc_pre.hc_fn",
|
| 249 |
+
"model.layers.39.hc_mlp_layer.hc_pre.hc_fn",
|
| 250 |
+
"model.layers.39.mlp.gate",
|
| 251 |
+
"model.layers.39.self_attn.linear_gate",
|
| 252 |
+
"model.layers.4.hc_attn_layer.hc_pre.hc_fn",
|
| 253 |
+
"model.layers.4.hc_mlp_layer.hc_pre.hc_fn",
|
| 254 |
+
"model.layers.4.mlp.gate",
|
| 255 |
+
"model.layers.4.self_attn.linear_gate",
|
| 256 |
+
"model.layers.40.hc_attn_layer.hc_pre.hc_fn",
|
| 257 |
+
"model.layers.40.hc_mlp_layer.hc_pre.hc_fn",
|
| 258 |
+
"model.layers.40.mlp.gate",
|
| 259 |
+
"model.layers.40.self_attn.linear_gate",
|
| 260 |
+
"model.layers.41.hc_attn_layer.hc_pre.hc_fn",
|
| 261 |
+
"model.layers.41.hc_mlp_layer.hc_pre.hc_fn",
|
| 262 |
+
"model.layers.41.mlp.gate",
|
| 263 |
+
"model.layers.41.self_attn.indexer.weights_proj",
|
| 264 |
+
"model.layers.41.self_attn.linear_gate",
|
| 265 |
+
"model.layers.42.hc_attn_layer.hc_pre.hc_fn",
|
| 266 |
+
"model.layers.42.hc_mlp_layer.hc_pre.hc_fn",
|
| 267 |
+
"model.layers.42.mlp.gate",
|
| 268 |
+
"model.layers.42.self_attn.linear_gate",
|
| 269 |
+
"model.layers.43.hc_attn_layer.hc_pre.hc_fn",
|
| 270 |
+
"model.layers.43.hc_mlp_layer.hc_pre.hc_fn",
|
| 271 |
+
"model.layers.43.mlp.gate",
|
| 272 |
+
"model.layers.43.self_attn.linear_gate",
|
| 273 |
+
"model.layers.44.hc_attn_layer.hc_pre.hc_fn",
|
| 274 |
+
"model.layers.44.hc_mlp_layer.hc_pre.hc_fn",
|
| 275 |
+
"model.layers.44.mlp.gate",
|
| 276 |
+
"model.layers.44.self_attn.linear_gate",
|
| 277 |
+
"model.layers.45.hc_attn_layer.hc_pre.hc_fn",
|
| 278 |
+
"model.layers.45.hc_mlp_layer.hc_pre.hc_fn",
|
| 279 |
+
"model.layers.45.mlp.gate",
|
| 280 |
+
"model.layers.45.self_attn.indexer.weights_proj",
|
| 281 |
+
"model.layers.45.self_attn.linear_gate",
|
| 282 |
+
"model.layers.46.hc_attn_layer.hc_pre.hc_fn",
|
| 283 |
+
"model.layers.46.hc_mlp_layer.hc_pre.hc_fn",
|
| 284 |
+
"model.layers.46.mlp.gate",
|
| 285 |
+
"model.layers.46.self_attn.linear_gate",
|
| 286 |
+
"model.layers.47.hc_attn_layer.hc_pre.hc_fn",
|
| 287 |
+
"model.layers.47.hc_mlp_layer.hc_pre.hc_fn",
|
| 288 |
+
"model.layers.47.mlp.gate",
|
| 289 |
+
"model.layers.47.self_attn.linear_gate",
|
| 290 |
+
"model.layers.48.hc_attn_layer.hc_pre.hc_fn",
|
| 291 |
+
"model.layers.48.hc_mlp_layer.hc_pre.hc_fn",
|
| 292 |
+
"model.layers.48.mlp.gate",
|
| 293 |
+
"model.layers.48.self_attn.linear_gate",
|
| 294 |
+
"model.layers.49.hc_attn_layer.hc_pre.hc_fn",
|
| 295 |
+
"model.layers.49.hc_mlp_layer.hc_pre.hc_fn",
|
| 296 |
+
"model.layers.49.mlp.gate",
|
| 297 |
+
"model.layers.49.self_attn.indexer.weights_proj",
|
| 298 |
+
"model.layers.49.self_attn.linear_gate",
|
| 299 |
+
"model.layers.5.hc_attn_layer.hc_pre.hc_fn",
|
| 300 |
+
"model.layers.5.hc_mlp_layer.hc_pre.hc_fn",
|
| 301 |
+
"model.layers.5.mlp.gate",
|
| 302 |
+
"model.layers.5.self_attn.indexer.weights_proj",
|
| 303 |
+
"model.layers.5.self_attn.linear_gate",
|
| 304 |
+
"model.layers.50.hc_attn_layer.hc_pre.hc_fn",
|
| 305 |
+
"model.layers.50.hc_mlp_layer.hc_pre.hc_fn",
|
| 306 |
+
"model.layers.50.mlp.gate",
|
| 307 |
+
"model.layers.50.self_attn.linear_gate",
|
| 308 |
+
"model.layers.51.hc_attn_layer.hc_pre.hc_fn",
|
| 309 |
+
"model.layers.51.hc_mlp_layer.hc_pre.hc_fn",
|
| 310 |
+
"model.layers.51.mlp.gate",
|
| 311 |
+
"model.layers.51.self_attn.linear_gate",
|
| 312 |
+
"model.layers.52.hc_attn_layer.hc_pre.hc_fn",
|
| 313 |
+
"model.layers.52.hc_mlp_layer.hc_pre.hc_fn",
|
| 314 |
+
"model.layers.52.mlp.gate",
|
| 315 |
+
"model.layers.52.self_attn.linear_gate",
|
| 316 |
+
"model.layers.53.hc_attn_layer.hc_pre.hc_fn",
|
| 317 |
+
"model.layers.53.hc_mlp_layer.hc_pre.hc_fn",
|
| 318 |
+
"model.layers.53.mlp.gate",
|
| 319 |
+
"model.layers.53.self_attn.indexer.weights_proj",
|
| 320 |
+
"model.layers.53.self_attn.linear_gate",
|
| 321 |
+
"model.layers.54.hc_attn_layer.hc_pre.hc_fn",
|
| 322 |
+
"model.layers.54.hc_mlp_layer.hc_pre.hc_fn",
|
| 323 |
+
"model.layers.54.mlp.gate",
|
| 324 |
+
"model.layers.54.self_attn.linear_gate",
|
| 325 |
+
"model.layers.55.hc_attn_layer.hc_pre.hc_fn",
|
| 326 |
+
"model.layers.55.hc_mlp_layer.hc_pre.hc_fn",
|
| 327 |
+
"model.layers.55.mlp.gate",
|
| 328 |
+
"model.layers.55.self_attn.linear_gate",
|
| 329 |
+
"model.layers.56.hc_attn_layer.hc_pre.hc_fn",
|
| 330 |
+
"model.layers.56.hc_mlp_layer.hc_pre.hc_fn",
|
| 331 |
+
"model.layers.56.mlp.gate",
|
| 332 |
+
"model.layers.56.self_attn.linear_gate",
|
| 333 |
+
"model.layers.57.hc_attn_layer.hc_pre.hc_fn",
|
| 334 |
+
"model.layers.57.hc_mlp_layer.hc_pre.hc_fn",
|
| 335 |
+
"model.layers.57.mlp.gate",
|
| 336 |
+
"model.layers.57.self_attn.indexer.weights_proj",
|
| 337 |
+
"model.layers.57.self_attn.linear_gate",
|
| 338 |
+
"model.layers.58.hc_attn_layer.hc_pre.hc_fn",
|
| 339 |
+
"model.layers.58.hc_mlp_layer.hc_pre.hc_fn",
|
| 340 |
+
"model.layers.58.mlp.gate",
|
| 341 |
+
"model.layers.58.self_attn.linear_gate",
|
| 342 |
+
"model.layers.59.hc_attn_layer.hc_pre.hc_fn",
|
| 343 |
+
"model.layers.59.hc_mlp_layer.hc_pre.hc_fn",
|
| 344 |
+
"model.layers.59.mlp.gate",
|
| 345 |
+
"model.layers.59.self_attn.linear_gate",
|
| 346 |
+
"model.layers.6.hc_attn_layer.hc_pre.hc_fn",
|
| 347 |
+
"model.layers.6.hc_mlp_layer.hc_pre.hc_fn",
|
| 348 |
+
"model.layers.6.mlp.gate",
|
| 349 |
+
"model.layers.6.self_attn.linear_gate",
|
| 350 |
+
"model.layers.60.hc_attn_layer.hc_pre.hc_fn",
|
| 351 |
+
"model.layers.60.hc_mlp_layer.hc_pre.hc_fn",
|
| 352 |
+
"model.layers.60.mlp.gate",
|
| 353 |
+
"model.layers.60.self_attn.linear_gate",
|
| 354 |
+
"model.layers.61.hc_attn_layer.hc_pre.hc_fn",
|
| 355 |
+
"model.layers.61.hc_mlp_layer.hc_pre.hc_fn",
|
| 356 |
+
"model.layers.61.mlp.gate",
|
| 357 |
+
"model.layers.61.self_attn.indexer.weights_proj",
|
| 358 |
+
"model.layers.61.self_attn.linear_gate",
|
| 359 |
+
"model.layers.62.hc_attn_layer.hc_pre.hc_fn",
|
| 360 |
+
"model.layers.62.hc_mlp_layer.hc_pre.hc_fn",
|
| 361 |
+
"model.layers.62.mlp.gate",
|
| 362 |
+
"model.layers.62.self_attn.linear_gate",
|
| 363 |
+
"model.layers.63.hc_attn_layer.hc_pre.hc_fn",
|
| 364 |
+
"model.layers.63.hc_mlp_layer.hc_pre.hc_fn",
|
| 365 |
+
"model.layers.63.mlp.gate",
|
| 366 |
+
"model.layers.63.self_attn.linear_gate",
|
| 367 |
+
"model.layers.64.hc_attn_layer.hc_pre.hc_fn",
|
| 368 |
+
"model.layers.64.hc_mlp_layer.hc_pre.hc_fn",
|
| 369 |
+
"model.layers.64.mlp.gate",
|
| 370 |
+
"model.layers.64.self_attn.linear_gate",
|
| 371 |
+
"model.layers.65.hc_attn_layer.hc_pre.hc_fn",
|
| 372 |
+
"model.layers.65.hc_mlp_layer.hc_pre.hc_fn",
|
| 373 |
+
"model.layers.65.mlp.gate",
|
| 374 |
+
"model.layers.65.self_attn.indexer.weights_proj",
|
| 375 |
+
"model.layers.65.self_attn.linear_gate",
|
| 376 |
+
"model.layers.66.hc_attn_layer.hc_pre.hc_fn",
|
| 377 |
+
"model.layers.66.hc_mlp_layer.hc_pre.hc_fn",
|
| 378 |
+
"model.layers.66.mlp.gate",
|
| 379 |
+
"model.layers.66.self_attn.linear_gate",
|
| 380 |
+
"model.layers.67.hc_attn_layer.hc_pre.hc_fn",
|
| 381 |
+
"model.layers.67.hc_mlp_layer.hc_pre.hc_fn",
|
| 382 |
+
"model.layers.67.mlp.gate",
|
| 383 |
+
"model.layers.67.self_attn.linear_gate",
|
| 384 |
+
"model.layers.68.hc_attn_layer.hc_pre.hc_fn",
|
| 385 |
+
"model.layers.68.hc_mlp_layer.hc_pre.hc_fn",
|
| 386 |
+
"model.layers.68.mlp.gate",
|
| 387 |
+
"model.layers.68.self_attn.linear_gate",
|
| 388 |
+
"model.layers.69.hc_attn_layer.hc_pre.hc_fn",
|
| 389 |
+
"model.layers.69.hc_mlp_layer.hc_pre.hc_fn",
|
| 390 |
+
"model.layers.69.mlp.gate",
|
| 391 |
+
"model.layers.69.self_attn.indexer.weights_proj",
|
| 392 |
+
"model.layers.69.self_attn.linear_gate",
|
| 393 |
+
"model.layers.7.hc_attn_layer.hc_pre.hc_fn",
|
| 394 |
+
"model.layers.7.hc_mlp_layer.hc_pre.hc_fn",
|
| 395 |
+
"model.layers.7.mlp.gate",
|
| 396 |
+
"model.layers.7.self_attn.linear_gate",
|
| 397 |
+
"model.layers.70.hc_attn_layer.hc_pre.hc_fn",
|
| 398 |
+
"model.layers.70.hc_mlp_layer.hc_pre.hc_fn",
|
| 399 |
+
"model.layers.70.mlp.gate",
|
| 400 |
+
"model.layers.70.self_attn.linear_gate",
|
| 401 |
+
"model.layers.71.hc_attn_layer.hc_pre.hc_fn",
|
| 402 |
+
"model.layers.71.hc_mlp_layer.hc_pre.hc_fn",
|
| 403 |
+
"model.layers.71.mlp.gate",
|
| 404 |
+
"model.layers.71.self_attn.linear_gate",
|
| 405 |
+
"model.layers.72.hc_attn_layer.hc_pre.hc_fn",
|
| 406 |
+
"model.layers.72.hc_mlp_layer.hc_pre.hc_fn",
|
| 407 |
+
"model.layers.72.mlp.gate",
|
| 408 |
+
"model.layers.72.self_attn.linear_gate",
|
| 409 |
+
"model.layers.73.hc_attn_layer.hc_pre.hc_fn",
|
| 410 |
+
"model.layers.73.hc_mlp_layer.hc_pre.hc_fn",
|
| 411 |
+
"model.layers.73.mlp.gate",
|
| 412 |
+
"model.layers.73.self_attn.indexer.weights_proj",
|
| 413 |
+
"model.layers.73.self_attn.linear_gate",
|
| 414 |
+
"model.layers.74.hc_attn_layer.hc_pre.hc_fn",
|
| 415 |
+
"model.layers.74.hc_mlp_layer.hc_pre.hc_fn",
|
| 416 |
+
"model.layers.74.mlp.gate",
|
| 417 |
+
"model.layers.74.self_attn.linear_gate",
|
| 418 |
+
"model.layers.75.hc_attn_layer.hc_pre.hc_fn",
|
| 419 |
+
"model.layers.75.hc_mlp_layer.hc_pre.hc_fn",
|
| 420 |
+
"model.layers.75.mlp.gate",
|
| 421 |
+
"model.layers.75.self_attn.linear_gate",
|
| 422 |
+
"model.layers.76.hc_attn_layer.hc_pre.hc_fn",
|
| 423 |
+
"model.layers.76.hc_mlp_layer.hc_pre.hc_fn",
|
| 424 |
+
"model.layers.76.mlp.gate",
|
| 425 |
+
"model.layers.76.self_attn.linear_gate",
|
| 426 |
+
"model.layers.77.hc_attn_layer.hc_pre.hc_fn",
|
| 427 |
+
"model.layers.77.hc_mlp_layer.hc_pre.hc_fn",
|
| 428 |
+
"model.layers.77.mlp.gate",
|
| 429 |
+
"model.layers.77.self_attn.indexer.weights_proj",
|
| 430 |
+
"model.layers.77.self_attn.linear_gate",
|
| 431 |
+
"model.layers.8.hc_attn_layer.hc_pre.hc_fn",
|
| 432 |
+
"model.layers.8.hc_mlp_layer.hc_pre.hc_fn",
|
| 433 |
+
"model.layers.8.mlp.gate",
|
| 434 |
+
"model.layers.8.self_attn.linear_gate",
|
| 435 |
+
"model.layers.9.hc_attn_layer.hc_pre.hc_fn",
|
| 436 |
+
"model.layers.9.hc_mlp_layer.hc_pre.hc_fn",
|
| 437 |
+
"model.layers.9.mlp.gate",
|
| 438 |
+
"model.layers.9.self_attn.indexer.weights_proj",
|
| 439 |
+
"model.layers.9.self_attn.linear_gate",
|
| 440 |
+
"model.mtp_layers.0.eh_proj",
|
| 441 |
+
"model.mtp_layers.0.mlp.gate",
|
| 442 |
+
"model.mtp_layers.0.self_attn.indexer.weights_proj",
|
| 443 |
+
"model.mtp_layers.0.self_attn.linear_gate"
|
| 444 |
+
]
|
| 445 |
+
}
|
| 446 |
+
}
|
| 447 |
+
}
|
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.16.2"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26a646882339c5396be310c4a7274d4ad952009bb8ec8798420eec2376fd5001
|
| 3 |
+
size 70661788
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|hy_start:opensource|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|hy_end:opensource|>",
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"local_files_only": false,
|
| 8 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 9 |
+
"pad_token": "<|hy_pad:opensource|>",
|
| 10 |
+
"tokenizer_class": "TokenizersBackend"
|
| 11 |
+
}
|