Instructions to use tiny-random/glm-5.3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/glm-5.3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/glm-5.3") 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/glm-5.3") model = AutoModelForCausalLM.from_pretrained("tiny-random/glm-5.3", 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/glm-5.3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/glm-5.3" # 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/glm-5.3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tiny-random/glm-5.3
- SGLang
How to use tiny-random/glm-5.3 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/glm-5.3" \ --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/glm-5.3", "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/glm-5.3" \ --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/glm-5.3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tiny-random/glm-5.3 with Docker Model Runner:
docker model run hf.co/tiny-random/glm-5.3
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- .meta.json +20 -0
- LICENSE +29 -0
- README.md +399 -0
- chat_template.jinja +251 -0
- config.json +108 -0
- generation_config.json +12 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +33 -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
|
.meta.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_model": {
|
| 3 |
+
"name": "zai-org/GLM-5.3",
|
| 4 |
+
"commit_id": "ba32f8c19c8738e2c57c71798c601d477a7bf844"
|
| 5 |
+
},
|
| 6 |
+
"env": {
|
| 7 |
+
"python": "3.12.13",
|
| 8 |
+
"packages": {
|
| 9 |
+
"accelerate": "1.13.0",
|
| 10 |
+
"huggingface_hub": "2.3.0",
|
| 11 |
+
"kernels": "0.17.2",
|
| 12 |
+
"safetensors": "0.8.0",
|
| 13 |
+
"tokenizers": "0.23.3",
|
| 14 |
+
"torch": "2.13.0+cu126",
|
| 15 |
+
"transformers": "5.20.2",
|
| 16 |
+
"vllm": "0.1.dev1+g5a3eba034.d20260730.cu126"
|
| 17 |
+
},
|
| 18 |
+
"cuda": "12.6"
|
| 19 |
+
}
|
| 20 |
+
}
|
LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GLM-5.3 License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Z.AI
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person or entity (the "Licensee") obtaining a copy of this software — including the model weights, parameters, configuration files, inference and training code, and associated documentation (collectively, the "Software") — to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software; to run, deploy, fine-tune, or otherwise modify the Software and create derivative works from it; and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
| 6 |
+
|
| 7 |
+
1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Licensee's use of the Software must comply with applicable laws and regulations.
|
| 8 |
+
|
| 9 |
+
2. "Model as a Service" means giving a third party access to language model inference or fine-tuning (e.g., via API) in a manner that allows such third party to exercise meaningful control over the inputs, parameters, or training data. This does not include (a) end-user products with model capabilities solely embedded within specific features or harnesses, or (b) mere relaying of requests to models hosted by others.
|
| 10 |
+
If the Licensee or any of its affiliates operates a Model as a Service business, and the aggregate revenue of the Licensee and its affiliates exceeds 10 billion US dollars (or the equivalent in other currencies) in total over any consecutive 12 months, the Licensee must pass Z.AI's security review before using the Software or its derivative works for any commercial purpose. The scope and method of the security review shall be reasonably determined by Z.AI.
|
| 11 |
+
|
| 12 |
+
3. THE SOFTWARE AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Z.AI OR ITS AFFILIATES OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 13 |
+
|
| 14 |
+
For any questions regarding this license, please contact glmlicense@z.ai.
|
| 15 |
+
|
| 16 |
+
-----
|
| 17 |
+
|
| 18 |
+
版权所有 (c) 2026 Z.AI
|
| 19 |
+
|
| 20 |
+
特此免费授予任何获得本软件副本的个人或实体("被许可方")——包括模型权重、参数、配置文件、推理和训练代码及相关文档(统称"软件")——不受限制地处理本软件的权利,包括但不限于:使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本;运行、部署、微调或以其他方式修改软件并创建衍生作品;以及允许获得软件的其他人行使上述权利,但须遵守以下条件:
|
| 21 |
+
|
| 22 |
+
1. 上述版权声明和本许可声明应包含在软件的所有副本或实质性部分中。被许可方对软件的使用必须符合适用法律法规。
|
| 23 |
+
|
| 24 |
+
2. "模型即服务"指以允许第三方对输入、参数或训练数据行使实质性控制的方式,向第三方提供语言模型推理或微调服务(如通过API)。不包括:(a) 模型能力仅嵌入特定功能或框架中的终端用户产品,或(b) 单纯转发请求至他人托管的模型。
|
| 25 |
+
若被许可方或其关联方运营"模型即服务"业务,且被许可方及关联方在任意连续12个月内累计总收入超过100亿美元(或等值其他货币),则被许可方在使用软件或其衍生作品进行任何商业用途之前,须通过Z.AI的安全审查。安全审查的范围和方式由Z.AI合理确定。
|
| 26 |
+
|
| 27 |
+
3. 软件及其任何输出和结果均按"现状"提供,不附带任何形式的保证,无论是明示还是暗示,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,Z.AI或其关联方或版权持有人均不对任何索赔、损害或其他责任承担责任,无论该责任是基于合同、侵权或其他方式,因软件或使用软件而产生或与之相关。
|
| 28 |
+
|
| 29 |
+
如对本许可有任何疑问,请联系 glmlicense@z.ai。
|
README.md
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
base_model:
|
| 4 |
+
- zai-org/GLM-5.3
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [zai-org/GLM-5.3](https://huggingface.co/zai-org/GLM-5.3).
|
| 8 |
+
|
| 9 |
+
Structural comparison with `zai-org/GLM-5.3`:
|
| 10 |
+
|
| 11 |
+
| Feature | Source | Tiny |
|
| 12 |
+
|---|---:|---:|
|
| 13 |
+
| Architecture / input | GLM-MoE-DSA; text | Same |
|
| 14 |
+
| Vocabulary rows / tied embeddings | 154,880 / false | Same |
|
| 15 |
+
| Backbone layers | 78 | 11: three dense, then two complete shared/shared/shared/full cycles |
|
| 16 |
+
| Hidden size | 6,144 | 128 |
|
| 17 |
+
| Attention heads / NoPE / RoPE / value dimensions | 64 / 192 / 64 / 256 | 64 / 32 / 32 / 256 |
|
| 18 |
+
| Query / KV LoRA rank | 2,048 / 512 | 128 / 256 |
|
| 19 |
+
| Indexer heads / dimension / top-k | 32 / 128 / 2,048 | 32 / 128 / 128 |
|
| 20 |
+
| Routed experts / selected experts / shared experts | 256 / 8 / 1 | 32 / 8 / 1 |
|
| 21 |
+
| Expert intermediate size | 2,048 | 128 |
|
| 22 |
+
| MTP | One DSA/MoE layer with shared embedding/head | Same |
|
| 23 |
+
| Checkpoint precision | BF16 plus E4M3 block-FP8 and FP32 scales | Same; 32x32 blocks for reduced axes |
|
| 24 |
+
|
| 25 |
+
The indexer head remains 128-wide: vLLM's GLM DSA cache and fused-indexer path use a 128-wide cache layout. The source E4M3 format is retained with reduced 32x32 blocks; the TP=4 example selects vLLM's Triton block-FP8 GEMM because H20's automatic Humming kernel requires an output scale group of at least 64.
|
| 26 |
+
Tokenizer and generation assets are copied unchanged from the pinned source revision.
|
| 27 |
+
|
| 28 |
+
| File path | Size |
|
| 29 |
+
|------|------|
|
| 30 |
+
| model.safetensors | 186.9MB |
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
### Example usage:
|
| 34 |
+
|
| 35 |
+
- vLLM (✅ verified)
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
vllm serve tiny-random/glm-5.3 \
|
| 39 |
+
--tensor-parallel-size 4 \
|
| 40 |
+
--speculative-config '{"method":"mtp","num_speculative_tokens":1}' \
|
| 41 |
+
--max-model-len 4096 \
|
| 42 |
+
--max-num-batched-tokens 512 \
|
| 43 |
+
--max-num-seqs 4 \
|
| 44 |
+
--gpu-memory-utilization 0.3 \
|
| 45 |
+
--kernel-config '{"moe_backend":"triton","linear_backend":"triton"}' \
|
| 46 |
+
--compilation-config '{"cudagraph_capture_sizes":[1,2,4,8]}'
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
- Transformers (✅ verified)
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
import torch
|
| 53 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 54 |
+
from transformers.integrations.hub_kernels import allow_all_hub_kernels
|
| 55 |
+
|
| 56 |
+
model_id = "tiny-random/glm-5.3"
|
| 57 |
+
# The GLM-5.3 Transformers implementation supports the DSA sparse mask on
|
| 58 |
+
# SDPA; eager attention is deliberately not selected.
|
| 59 |
+
# Transformers resolves the official fine-grained FP8 kernel from the Hub.
|
| 60 |
+
with allow_all_hub_kernels():
|
| 61 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 62 |
+
model_id, dtype=torch.bfloat16, attn_implementation="sdpa",
|
| 63 |
+
).to("cuda")
|
| 64 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 65 |
+
inputs = tokenizer.apply_chat_template(
|
| 66 |
+
[{"role": "user", "content": "Hello"}], tokenize=True,
|
| 67 |
+
add_generation_prompt=True, return_dict=True, return_tensors="pt",
|
| 68 |
+
).to(model.device)
|
| 69 |
+
output = model.generate(**inputs, do_sample=False, max_new_tokens=10)
|
| 70 |
+
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
### Codes to create this repo (✅ verified):
|
| 74 |
+
|
| 75 |
+
<details><summary>Click to expand</summary>
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
"""Create the GLM-MoE-DSA checkpoint using the public FP8 checkpoint schema."""
|
| 79 |
+
import json
|
| 80 |
+
from pathlib import Path
|
| 81 |
+
from shutil import copyfile
|
| 82 |
+
|
| 83 |
+
import torch
|
| 84 |
+
from huggingface_hub import hf_hub_download, list_repo_files
|
| 85 |
+
from safetensors.torch import save_file
|
| 86 |
+
from transformers import AutoConfig, AutoModelForCausalLM, set_seed
|
| 87 |
+
|
| 88 |
+
source_model_id = "zai-org/GLM-5.3"
|
| 89 |
+
save_folder = "/tmp/tiny-random/glm-53"
|
| 90 |
+
source_revision = "ba32f8c19c8738e2c57c71798c601d477a7bf844"
|
| 91 |
+
set_seed(42)
|
| 92 |
+
folder = Path(save_folder)
|
| 93 |
+
folder.mkdir(parents=True, exist_ok=True)
|
| 94 |
+
raw = json.loads(Path(hf_hub_download(
|
| 95 |
+
source_model_id, "config.json", revision=source_revision)).read_text())
|
| 96 |
+
# The source uses block-FP8. 32x32 is the smallest source-compatible
|
| 97 |
+
# block geometry. TP=4 therefore needs every sharded FP8 axis to be at
|
| 98 |
+
# least 128 wide, so each rank owns one complete 32-wide block.
|
| 99 |
+
raw["quantization_config"]["weight_block_size"] = [32, 32]
|
| 100 |
+
raw.update(
|
| 101 |
+
hidden_size=128,
|
| 102 |
+
num_hidden_layers=11,
|
| 103 |
+
# Retain the source's 64 global attention heads. The regular MLA
|
| 104 |
+
# path shards these to 16 query heads per TP=4 rank; its 32-wide
|
| 105 |
+
# reduced NoPE/RoPE projections and source-sized values keep every
|
| 106 |
+
# backend-required head dimension valid.
|
| 107 |
+
num_attention_heads=64,
|
| 108 |
+
num_key_value_heads=64,
|
| 109 |
+
intermediate_size=128,
|
| 110 |
+
moe_intermediate_size=128,
|
| 111 |
+
n_routed_experts=32,
|
| 112 |
+
num_experts_per_tok=8,
|
| 113 |
+
q_lora_rank=128,
|
| 114 |
+
# Sparse-MQA passes this latent as FA3's q_v input. The optimized
|
| 115 |
+
# CUDA kernel requires it to be at least 256 wide; source uses 512.
|
| 116 |
+
kv_lora_rank=256,
|
| 117 |
+
qk_nope_head_dim=32,
|
| 118 |
+
qk_rope_head_dim=32,
|
| 119 |
+
# vLLM's sparse-MQA FlashAttention path requires q_v >= 256; this
|
| 120 |
+
# therefore retains the source value-head dimension.
|
| 121 |
+
v_head_dim=256,
|
| 122 |
+
index_head_dim=128,
|
| 123 |
+
# This is the DSA indexer head count, distinct from normal attention.
|
| 124 |
+
# vLLM's fused sparse-indexer kernel accepts 32 or 64; retain source 32.
|
| 125 |
+
index_n_heads=32,
|
| 126 |
+
index_topk=128,
|
| 127 |
+
first_k_dense_replace=3,
|
| 128 |
+
)
|
| 129 |
+
# The original three shared-indexer layers followed by one full indexer
|
| 130 |
+
# are retained twice after the dense prefix.
|
| 131 |
+
raw["indexer_types"] = ["full", "full", "full"] + ["shared", "shared", "shared", "full"] * 2
|
| 132 |
+
raw["mlp_layer_types"] = ["dense"] * 3 + ["sparse"] * 8
|
| 133 |
+
|
| 134 |
+
# Build the Transformer graph from the reduced config before serializing
|
| 135 |
+
# the source checkpoint layout.
|
| 136 |
+
config_for_build = dict(raw)
|
| 137 |
+
config_for_build.pop("quantization_config")
|
| 138 |
+
(folder / "config.json").write_text(json.dumps(config_for_build, indent=2) + "\n")
|
| 139 |
+
config = AutoConfig.from_pretrained(folder)
|
| 140 |
+
model = AutoModelForCausalLM.from_config(config, dtype=torch.bfloat16)
|
| 141 |
+
|
| 142 |
+
with torch.no_grad():
|
| 143 |
+
for name, value in model.named_parameters():
|
| 144 |
+
if name.endswith("e_score_correction_bias"):
|
| 145 |
+
value.zero_()
|
| 146 |
+
elif name.endswith("weight") and "layernorm" in name:
|
| 147 |
+
value.fill_(1)
|
| 148 |
+
else:
|
| 149 |
+
value.normal_(mean=0.0, std=0.02)
|
| 150 |
+
|
| 151 |
+
state = {name: value.detach().cpu().contiguous() for name, value in model.state_dict().items()}
|
| 152 |
+
block_out, block_in = raw["quantization_config"]["weight_block_size"]
|
| 153 |
+
|
| 154 |
+
def pack(name: str, weight: torch.Tensor) -> None:
|
| 155 |
+
rows, columns = weight.shape
|
| 156 |
+
assert rows % block_out == 0 and columns % block_in == 0, (name, weight.shape)
|
| 157 |
+
blocks = weight.float().reshape(rows // block_out, block_out, columns // block_in, block_in)
|
| 158 |
+
scales = (blocks.abs().amax(dim=(1, 3)) / 448).clamp_min(1e-12).to(torch.float32)
|
| 159 |
+
state[name] = (blocks / scales[:, None, :, None]).clamp(-448, 448).reshape(weight.shape).to(
|
| 160 |
+
torch.float8_e4m3fn
|
| 161 |
+
).contiguous()
|
| 162 |
+
state[name.removesuffix("weight") + "weight_scale_inv"] = scales.contiguous()
|
| 163 |
+
|
| 164 |
+
def keep_bf16(name: str) -> bool:
|
| 165 |
+
return (
|
| 166 |
+
name in {"model.embed_tokens.weight", "lm_head.weight"}
|
| 167 |
+
or ".layernorm." in name
|
| 168 |
+
or ".indexer.k_norm." in name
|
| 169 |
+
or name.endswith(".indexer.weights_proj.weight")
|
| 170 |
+
or name.endswith(".mlp.gate.weight")
|
| 171 |
+
or name.endswith(".mlp.gate.e_score_correction_bias")
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
# Source exclusion paths are tied to its 78-layer tree. Rebuild the list
|
| 175 |
+
# for the reduced graph so Transformers does not turn BF16 norms, routers
|
| 176 |
+
# or indexer projections into FP8 modules while loading this checkpoint.
|
| 177 |
+
exclusions = {"model.embed_tokens", "lm_head"}
|
| 178 |
+
for module_name, module in model.named_modules():
|
| 179 |
+
if isinstance(module, torch.nn.Linear) and keep_bf16(module_name + ".weight"):
|
| 180 |
+
exclusions.add(module_name)
|
| 181 |
+
raw["quantization_config"]["modules_to_not_convert"] = sorted(exclusions)
|
| 182 |
+
|
| 183 |
+
# The public checkpoint stores routed experts one expert per tensor; the
|
| 184 |
+
# Transformers graph stores its expert matrices as compact three-dimensional
|
| 185 |
+
# tensors. Convert only at serialization time.
|
| 186 |
+
for name in list(state):
|
| 187 |
+
if not name.endswith(".mlp.experts.gate_up_proj"):
|
| 188 |
+
continue
|
| 189 |
+
prefix = name.removesuffix(".gate_up_proj")
|
| 190 |
+
gate_up = state.pop(name)
|
| 191 |
+
down = state.pop(prefix + ".down_proj")
|
| 192 |
+
for expert in range(gate_up.shape[0]):
|
| 193 |
+
gate, up = gate_up[expert].chunk(2, dim=0)
|
| 194 |
+
pack(f"{prefix}.{expert}.gate_proj.weight", gate)
|
| 195 |
+
pack(f"{prefix}.{expert}.up_proj.weight", up)
|
| 196 |
+
pack(f"{prefix}.{expert}.down_proj.weight", down[expert])
|
| 197 |
+
|
| 198 |
+
for name in list(state):
|
| 199 |
+
value = state[name]
|
| 200 |
+
if not (name.endswith(".weight") and value.ndim == 2) or keep_bf16(name):
|
| 201 |
+
continue
|
| 202 |
+
pack(name, value)
|
| 203 |
+
|
| 204 |
+
# GLM's embedded one-layer MTP head is represented as the source's extra
|
| 205 |
+
# decoder layer. It shares the checkpoint's global embedding and LM head.
|
| 206 |
+
base_prefix = "model.layers.10."
|
| 207 |
+
mtp_prefix = "model.layers.11."
|
| 208 |
+
for name, value in list(state.items()):
|
| 209 |
+
if name.startswith(base_prefix):
|
| 210 |
+
state[mtp_prefix + name.removeprefix(base_prefix)] = value.clone()
|
| 211 |
+
state[mtp_prefix + "eh_proj.weight"] = torch.empty(128, 256, dtype=torch.bfloat16).normal_(0, 0.02)
|
| 212 |
+
for name in ("enorm.weight", "hnorm.weight", "shared_head.norm.weight"):
|
| 213 |
+
state[mtp_prefix + name] = torch.ones(128, dtype=torch.bfloat16)
|
| 214 |
+
|
| 215 |
+
save_file(state, folder / "model.safetensors", metadata={"format": "pt"})
|
| 216 |
+
(folder / "config.json").write_text(json.dumps(raw, indent=2) + "\n")
|
| 217 |
+
|
| 218 |
+
assets = {
|
| 219 |
+
"tokenizer.json", "tokenizer_config.json", "special_tokens_map.json",
|
| 220 |
+
"chat_template.jinja", "generation_config.json", "LICENSE",
|
| 221 |
+
}
|
| 222 |
+
for name in sorted(set(list_repo_files(source_model_id, revision=source_revision)) & assets):
|
| 223 |
+
copyfile(hf_hub_download(source_model_id, name, revision=source_revision), folder / name)
|
| 224 |
+
```
|
| 225 |
+
|
| 226 |
+
</details>
|
| 227 |
+
|
| 228 |
+
### Printing the model:
|
| 229 |
+
|
| 230 |
+
<details><summary>Click to expand</summary>
|
| 231 |
+
|
| 232 |
+
```text
|
| 233 |
+
GlmMoeDsaForCausalLM(
|
| 234 |
+
(model): GlmMoeDsaModel(
|
| 235 |
+
(embed_tokens): Embedding(154880, 128, padding_idx=154820)
|
| 236 |
+
(layers): ModuleList(
|
| 237 |
+
(0-2): 3 x GlmMoeDsaDecoderLayer(
|
| 238 |
+
(self_attn): GlmMoeDsaAttention(
|
| 239 |
+
(q_a_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 240 |
+
(q_a_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-06)
|
| 241 |
+
(q_b_proj): Linear(in_features=128, out_features=4096, bias=False)
|
| 242 |
+
(kv_a_proj_with_mqa): Linear(in_features=128, out_features=288, bias=False)
|
| 243 |
+
(kv_a_layernorm): GlmMoeDsaRMSNorm((256,), eps=1e-06)
|
| 244 |
+
(kv_b_proj): Linear(in_features=256, out_features=18432, bias=False)
|
| 245 |
+
(o_proj): Linear(in_features=16384, out_features=128, bias=False)
|
| 246 |
+
(indexer): GlmMoeDsaIndexer(
|
| 247 |
+
(wq_b): Linear(in_features=128, out_features=4096, bias=False)
|
| 248 |
+
(wk): Linear(in_features=128, out_features=128, bias=False)
|
| 249 |
+
(k_norm): LayerNorm((128,), eps=1e-06, elementwise_affine=True, bias=True)
|
| 250 |
+
(weights_proj): Linear(in_features=128, out_features=32, bias=False)
|
| 251 |
+
)
|
| 252 |
+
)
|
| 253 |
+
(mlp): GlmMoeDsaMLP(
|
| 254 |
+
(gate_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 255 |
+
(up_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 256 |
+
(down_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 257 |
+
(act_fn): SiLUActivation()
|
| 258 |
+
)
|
| 259 |
+
(input_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 260 |
+
(post_attention_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 261 |
+
)
|
| 262 |
+
(3-5): 3 x GlmMoeDsaDecoderLayer(
|
| 263 |
+
(self_attn): GlmMoeDsaAttention(
|
| 264 |
+
(q_a_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 265 |
+
(q_a_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-06)
|
| 266 |
+
(q_b_proj): Linear(in_features=128, out_features=4096, bias=False)
|
| 267 |
+
(kv_a_proj_with_mqa): Linear(in_features=128, out_features=288, bias=False)
|
| 268 |
+
(kv_a_layernorm): GlmMoeDsaRMSNorm((256,), eps=1e-06)
|
| 269 |
+
(kv_b_proj): Linear(in_features=256, out_features=18432, bias=False)
|
| 270 |
+
(o_proj): Linear(in_features=16384, out_features=128, bias=False)
|
| 271 |
+
)
|
| 272 |
+
(mlp): GlmMoeDsaMoE(
|
| 273 |
+
(experts): GlmMoeDsaExperts(
|
| 274 |
+
(act_fn): SiLUActivation()
|
| 275 |
+
)
|
| 276 |
+
(gate): GlmMoeDsaTopkRouter()
|
| 277 |
+
(shared_experts): GlmMoeDsaMLP(
|
| 278 |
+
(gate_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 279 |
+
(up_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 280 |
+
(down_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 281 |
+
(act_fn): SiLUActivation()
|
| 282 |
+
)
|
| 283 |
+
)
|
| 284 |
+
(input_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 285 |
+
(post_attention_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 286 |
+
)
|
| 287 |
+
(6): GlmMoeDsaDecoderLayer(
|
| 288 |
+
(self_attn): GlmMoeDsaAttention(
|
| 289 |
+
(q_a_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 290 |
+
(q_a_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-06)
|
| 291 |
+
(q_b_proj): Linear(in_features=128, out_features=4096, bias=False)
|
| 292 |
+
(kv_a_proj_with_mqa): Linear(in_features=128, out_features=288, bias=False)
|
| 293 |
+
(kv_a_layernorm): GlmMoeDsaRMSNorm((256,), eps=1e-06)
|
| 294 |
+
(kv_b_proj): Linear(in_features=256, out_features=18432, bias=False)
|
| 295 |
+
(o_proj): Linear(in_features=16384, out_features=128, bias=False)
|
| 296 |
+
(indexer): GlmMoeDsaIndexer(
|
| 297 |
+
(wq_b): Linear(in_features=128, out_features=4096, bias=False)
|
| 298 |
+
(wk): Linear(in_features=128, out_features=128, bias=False)
|
| 299 |
+
(k_norm): LayerNorm((128,), eps=1e-06, elementwise_affine=True, bias=True)
|
| 300 |
+
(weights_proj): Linear(in_features=128, out_features=32, bias=False)
|
| 301 |
+
)
|
| 302 |
+
)
|
| 303 |
+
(mlp): GlmMoeDsaMoE(
|
| 304 |
+
(experts): GlmMoeDsaExperts(
|
| 305 |
+
(act_fn): SiLUActivation()
|
| 306 |
+
)
|
| 307 |
+
(gate): GlmMoeDsaTopkRouter()
|
| 308 |
+
(shared_experts): GlmMoeDsaMLP(
|
| 309 |
+
(gate_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 310 |
+
(up_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 311 |
+
(down_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 312 |
+
(act_fn): SiLUActivation()
|
| 313 |
+
)
|
| 314 |
+
)
|
| 315 |
+
(input_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 316 |
+
(post_attention_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 317 |
+
)
|
| 318 |
+
(7-9): 3 x GlmMoeDsaDecoderLayer(
|
| 319 |
+
(self_attn): GlmMoeDsaAttention(
|
| 320 |
+
(q_a_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 321 |
+
(q_a_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-06)
|
| 322 |
+
(q_b_proj): Linear(in_features=128, out_features=4096, bias=False)
|
| 323 |
+
(kv_a_proj_with_mqa): Linear(in_features=128, out_features=288, bias=False)
|
| 324 |
+
(kv_a_layernorm): GlmMoeDsaRMSNorm((256,), eps=1e-06)
|
| 325 |
+
(kv_b_proj): Linear(in_features=256, out_features=18432, bias=False)
|
| 326 |
+
(o_proj): Linear(in_features=16384, out_features=128, bias=False)
|
| 327 |
+
)
|
| 328 |
+
(mlp): GlmMoeDsaMoE(
|
| 329 |
+
(experts): GlmMoeDsaExperts(
|
| 330 |
+
(act_fn): SiLUActivation()
|
| 331 |
+
)
|
| 332 |
+
(gate): GlmMoeDsaTopkRouter()
|
| 333 |
+
(shared_experts): GlmMoeDsaMLP(
|
| 334 |
+
(gate_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 335 |
+
(up_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 336 |
+
(down_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 337 |
+
(act_fn): SiLUActivation()
|
| 338 |
+
)
|
| 339 |
+
)
|
| 340 |
+
(input_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 341 |
+
(post_attention_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 342 |
+
)
|
| 343 |
+
(10): GlmMoeDsaDecoderLayer(
|
| 344 |
+
(self_attn): GlmMoeDsaAttention(
|
| 345 |
+
(q_a_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 346 |
+
(q_a_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-06)
|
| 347 |
+
(q_b_proj): Linear(in_features=128, out_features=4096, bias=False)
|
| 348 |
+
(kv_a_proj_with_mqa): Linear(in_features=128, out_features=288, bias=False)
|
| 349 |
+
(kv_a_layernorm): GlmMoeDsaRMSNorm((256,), eps=1e-06)
|
| 350 |
+
(kv_b_proj): Linear(in_features=256, out_features=18432, bias=False)
|
| 351 |
+
(o_proj): Linear(in_features=16384, out_features=128, bias=False)
|
| 352 |
+
(indexer): GlmMoeDsaIndexer(
|
| 353 |
+
(wq_b): Linear(in_features=128, out_features=4096, bias=False)
|
| 354 |
+
(wk): Linear(in_features=128, out_features=128, bias=False)
|
| 355 |
+
(k_norm): LayerNorm((128,), eps=1e-06, elementwise_affine=True, bias=True)
|
| 356 |
+
(weights_proj): Linear(in_features=128, out_features=32, bias=False)
|
| 357 |
+
)
|
| 358 |
+
)
|
| 359 |
+
(mlp): GlmMoeDsaMoE(
|
| 360 |
+
(experts): GlmMoeDsaExperts(
|
| 361 |
+
(act_fn): SiLUActivation()
|
| 362 |
+
)
|
| 363 |
+
(gate): GlmMoeDsaTopkRouter()
|
| 364 |
+
(shared_experts): GlmMoeDsaMLP(
|
| 365 |
+
(gate_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 366 |
+
(up_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 367 |
+
(down_proj): Linear(in_features=128, out_features=128, bias=False)
|
| 368 |
+
(act_fn): SiLUActivation()
|
| 369 |
+
)
|
| 370 |
+
)
|
| 371 |
+
(input_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 372 |
+
(post_attention_layernorm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 373 |
+
)
|
| 374 |
+
)
|
| 375 |
+
(norm): GlmMoeDsaRMSNorm((128,), eps=1e-05)
|
| 376 |
+
(rotary_emb): GlmMoeDsaRotaryEmbedding()
|
| 377 |
+
)
|
| 378 |
+
(lm_head): Linear(in_features=128, out_features=154880, bias=False)
|
| 379 |
+
)
|
| 380 |
+
```
|
| 381 |
+
|
| 382 |
+
</details>
|
| 383 |
+
|
| 384 |
+
### Test environment:
|
| 385 |
+
|
| 386 |
+
- accelerate: 1.13.0
|
| 387 |
+
- huggingface_hub: 2.3.0
|
| 388 |
+
- kernels: 0.17.2
|
| 389 |
+
- safetensors: 0.8.0
|
| 390 |
+
- tokenizers: 0.23.3
|
| 391 |
+
- torch: 2.13.0+cu126
|
| 392 |
+
- transformers: 5.20.2
|
| 393 |
+
- vllm: 0.1.dev1+g5a3eba034.d20260730.cu126
|
| 394 |
+
|
| 395 |
+
### Change log:
|
| 396 |
+
|
| 397 |
+
- 2026-10-24: Initial version.
|
| 398 |
+
|
| 399 |
+
This repo is generated by GPT-6.1-Sol
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[gMASK]<sop>
|
| 2 |
+
{%- set effective_reasoning_effort = reasoning_effort if reasoning_effort is defined and reasoning_effort in ['low', 'high'] else 'max' -%}
|
| 3 |
+
{%- if effective_reasoning_effort is not none -%}<|system|>Reasoning Effort: {{ effective_reasoning_effort | capitalize }}{%- endif -%}
|
| 4 |
+
{%- set clear_thinking = clear_thinking if clear_thinking is defined else false -%}
|
| 5 |
+
{%- if tools -%}
|
| 6 |
+
{%- macro tool_to_json(tool) -%}
|
| 7 |
+
{%- set ns_tool = namespace(first=true) -%}
|
| 8 |
+
{{ '{' -}}
|
| 9 |
+
{%- for k, v in tool.items() -%}
|
| 10 |
+
{%- if k != 'defer_loading' and k != 'strict' -%}
|
| 11 |
+
{%- if not ns_tool.first -%}{{- ', ' -}}{%- endif -%}
|
| 12 |
+
{%- set ns_tool.first = false -%}
|
| 13 |
+
"{{ k }}": {{ v | tojson(ensure_ascii=False) }}
|
| 14 |
+
{%- endif -%}
|
| 15 |
+
{%- endfor -%}
|
| 16 |
+
{{- '}' -}}
|
| 17 |
+
{%- endmacro -%}
|
| 18 |
+
{%- macro tool_references_to_response(refs) -%}
|
| 19 |
+
{{- '<tool_response><tools>\n' -}}
|
| 20 |
+
{%- for tr in refs -%}
|
| 21 |
+
{%- for tool in tools -%}
|
| 22 |
+
{%- if 'function' in tool -%}
|
| 23 |
+
{%- set tool = tool['function'] -%}
|
| 24 |
+
{%- endif -%}
|
| 25 |
+
{%- if tool.name == tr.name -%}
|
| 26 |
+
{{- tool_to_json(tool) + '\n' -}}
|
| 27 |
+
{%- endif -%}
|
| 28 |
+
{%- endfor -%}
|
| 29 |
+
{%- endfor -%}
|
| 30 |
+
{{- '</tools></tool_response>' -}}
|
| 31 |
+
{%- endmacro -%}
|
| 32 |
+
<|system|>
|
| 33 |
+
# Tools
|
| 34 |
+
|
| 35 |
+
You may call one or more functions to assist with the user query.
|
| 36 |
+
|
| 37 |
+
You are provided with function signatures within <tools></tools> XML tags:
|
| 38 |
+
<tools>
|
| 39 |
+
{% for tool in tools %}
|
| 40 |
+
{%- if 'function' in tool -%}
|
| 41 |
+
{%- set tool = tool['function'] -%}
|
| 42 |
+
{%- endif -%}
|
| 43 |
+
{% if tool.defer_loading is not defined or not tool.defer_loading %}
|
| 44 |
+
{{ tool_to_json(tool) }}
|
| 45 |
+
{% endif %}
|
| 46 |
+
{% endfor %}
|
| 47 |
+
</tools>
|
| 48 |
+
|
| 49 |
+
For each function call, output the function name and arguments within the following XML format:
|
| 50 |
+
<tool_call>{function-name}<arg_key>{arg-key-1}</arg_key><arg_value>{arg-value-1}</arg_value><arg_key>{arg-key-2}</arg_key><arg_value>{arg-value-2}</arg_value>...</tool_call>{%- endif -%}
|
| 51 |
+
{%- macro visible_text(content) -%}
|
| 52 |
+
{%- if content is string -%}
|
| 53 |
+
{{- content }}
|
| 54 |
+
{%- elif content is iterable and content is not mapping -%}
|
| 55 |
+
{%- for item in content -%}
|
| 56 |
+
{%- if item is mapping and item.type == 'text' -%}
|
| 57 |
+
{{- item.text }}
|
| 58 |
+
{%- elif item is string -%}
|
| 59 |
+
{{- item }}
|
| 60 |
+
{%- elif item is mapping and item.type in ['image', 'image_url', 'video', 'video_url', 'audio', 'audio_url', 'input_audio'] -%}
|
| 61 |
+
{%- set media_type = item.type | replace('_url', '') | replace('input_', '') -%}
|
| 62 |
+
{{- "<reminder>You are unable to process this " ~ media_type ~ " because you don't have multi-modal input ability. Try different methods.</reminder>" }}
|
| 63 |
+
{%- endif -%}
|
| 64 |
+
{%- endfor -%}
|
| 65 |
+
{%- elif content is not none -%}
|
| 66 |
+
{{- content }}
|
| 67 |
+
{%- endif -%}
|
| 68 |
+
{%- endmacro -%}
|
| 69 |
+
{%- macro tool_response(text) -%}
|
| 70 |
+
{{- '<tool_response>' + text + '</tool_response>' -}}
|
| 71 |
+
{%- endmacro -%}
|
| 72 |
+
{%- macro render_tool_response(m) -%}
|
| 73 |
+
{%- if m.content is string -%}
|
| 74 |
+
{{- tool_response(m.content) -}}
|
| 75 |
+
{%- elif m.content and m.content is not mapping and m.content.0.type == "tool_reference" -%}
|
| 76 |
+
{{- tool_references_to_response(m.content) -}}
|
| 77 |
+
{%- elif is_list_of_outputs(m) -%}
|
| 78 |
+
{%- for tr in m.content -%}
|
| 79 |
+
{%- if tr.output is iterable and tr.output is not string and tr.output is not mapping and tr.output and tr.output.0.type == "tool_reference" -%}
|
| 80 |
+
{{- tool_references_to_response(tr.output) -}}
|
| 81 |
+
{%- else -%}
|
| 82 |
+
{{- tool_response(visible_text(tr.output)) -}}
|
| 83 |
+
{%- endif -%}
|
| 84 |
+
{%- endfor -%}
|
| 85 |
+
{%- else -%}
|
| 86 |
+
{{- tool_response(visible_text(m.content)) -}}
|
| 87 |
+
{%- endif -%}
|
| 88 |
+
{%- endmacro -%}
|
| 89 |
+
{%- macro id_of(obj) -%}
|
| 90 |
+
{%- if obj.tool_call_id -%}
|
| 91 |
+
{{- obj.tool_call_id -}}
|
| 92 |
+
{%- elif obj.id -%}
|
| 93 |
+
{{- obj.id -}}
|
| 94 |
+
{%- endif -%}
|
| 95 |
+
{%- endmacro -%}
|
| 96 |
+
{%- macro is_list_of_outputs(m) -%}
|
| 97 |
+
{%- if m.content and m.content.0.output is defined -%}1{%- endif -%}
|
| 98 |
+
{%- endmacro -%}
|
| 99 |
+
{%- macro has_dup_tool_result_id(lo, hi, target) -%}
|
| 100 |
+
{%- set ns_cnt = namespace(n=0) -%}
|
| 101 |
+
{%- for k in range(lo, hi + 1) -%}
|
| 102 |
+
{%- set m = messages[k] -%}
|
| 103 |
+
{%- if is_list_of_outputs(m) -%}
|
| 104 |
+
{%- for entry in m.content -%}
|
| 105 |
+
{%- if id_of(entry) == target -%}
|
| 106 |
+
{%- set ns_cnt.n = ns_cnt.n + 1 -%}
|
| 107 |
+
{%- endif -%}
|
| 108 |
+
{%- endfor -%}
|
| 109 |
+
{%- elif id_of(m) == target -%}
|
| 110 |
+
{%- set ns_cnt.n = ns_cnt.n + 1 -%}
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if ns_cnt.n > 1 -%}{%- break -%}{%- endif -%}
|
| 113 |
+
{%- endfor -%}
|
| 114 |
+
{%- if ns_cnt.n > 1 -%}1{%- endif -%}
|
| 115 |
+
{%- endmacro -%}
|
| 116 |
+
{%- macro tc_id_exists(tcs, target) -%}
|
| 117 |
+
{%- set ns_f = namespace(found=false) -%}
|
| 118 |
+
{%- for tc in tcs -%}
|
| 119 |
+
{%- if id_of(tc) == target -%}
|
| 120 |
+
{%- set ns_f.found = true -%}
|
| 121 |
+
{%- break -%}
|
| 122 |
+
{%- endif -%}
|
| 123 |
+
{%- endfor -%}
|
| 124 |
+
{%- if ns_f.found -%}1{%- endif -%}
|
| 125 |
+
{%- endmacro -%}
|
| 126 |
+
{%- set ns = namespace(last_user_index=-1) -%}
|
| 127 |
+
{%- for m in messages %}
|
| 128 |
+
{%- if m.role == 'user' %}
|
| 129 |
+
{%- set ns.last_user_index = loop.index0 -%}
|
| 130 |
+
{%- endif %}
|
| 131 |
+
{%- endfor %}
|
| 132 |
+
{%- for m in messages -%}
|
| 133 |
+
{%- if m.role == 'user' -%}<|user|>{{ visible_text(m.content) }}
|
| 134 |
+
{%- elif m.role == 'assistant' -%}
|
| 135 |
+
<|assistant|>
|
| 136 |
+
{%- set content = visible_text(m.content) %}
|
| 137 |
+
{%- if m.reasoning_content is string %}
|
| 138 |
+
{%- set reasoning_content = m.reasoning_content %}
|
| 139 |
+
{%- elif '</think>' in content %}
|
| 140 |
+
{%- set reasoning_content = content.split('</think>')[0].split('<think>')[-1] %}
|
| 141 |
+
{%- set content = content.split('</think>')[-1] %}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{%- if (not clear_thinking or loop.index0 > ns.last_user_index) and reasoning_content is defined -%}
|
| 144 |
+
{{ '<think>' + reasoning_content + '</think>'}}
|
| 145 |
+
{%- else -%}
|
| 146 |
+
{{ '<think></think>' }}
|
| 147 |
+
{%- endif -%}
|
| 148 |
+
{%- if content.strip() -%}
|
| 149 |
+
{{ content.strip() }}
|
| 150 |
+
{%- endif -%}
|
| 151 |
+
{% if m.tool_calls %}
|
| 152 |
+
{% for tc in m.tool_calls %}
|
| 153 |
+
{%- if tc.function %}
|
| 154 |
+
{%- set tc = tc.function %}
|
| 155 |
+
{%- endif %}
|
| 156 |
+
{{- '<tool_call>' + tc.name -}}
|
| 157 |
+
{% set _args = tc.arguments %}{% for k, v in _args.items() %}<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson(ensure_ascii=False) if v is not string else v }}</arg_value>{% endfor %}</tool_call>{% endfor %}
|
| 158 |
+
{% endif %}
|
| 159 |
+
{%- elif m.role == 'tool' -%}
|
| 160 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 161 |
+
{{- '<|observation|>' -}}
|
| 162 |
+
{%- set block_start = loop.index0 -%}
|
| 163 |
+
{%- set ns_blk = namespace(end=block_start) -%}
|
| 164 |
+
{%- for j in range(block_start, messages|length) -%}
|
| 165 |
+
{%- if messages[j].role == 'tool' -%}
|
| 166 |
+
{%- set ns_blk.end = j -%}
|
| 167 |
+
{%- else -%}
|
| 168 |
+
{%- break -%}
|
| 169 |
+
{%- endif -%}
|
| 170 |
+
{%- endfor -%}
|
| 171 |
+
{%- set ns_a = namespace(tool_calls=none) -%}
|
| 172 |
+
{%- if block_start > 0 and messages[block_start - 1].role == 'assistant' and messages[block_start - 1].tool_calls -%}
|
| 173 |
+
{%- set ns_a.tool_calls = messages[block_start - 1].tool_calls -%}
|
| 174 |
+
{%- endif -%}
|
| 175 |
+
{%- set ns_chk = namespace(can_sort=true, res=[], mk=[], ek=[], tcs=[]) -%}
|
| 176 |
+
{%- for k in range(block_start, ns_blk.end + 1) -%}
|
| 177 |
+
{%- set m = messages[k] -%}
|
| 178 |
+
{%- if is_list_of_outputs(m) -%}
|
| 179 |
+
{%- for entry in m.content -%}
|
| 180 |
+
{%- set ns_chk.res = ns_chk.res + [id_of(entry)] -%}
|
| 181 |
+
{%- set ns_chk.mk = ns_chk.mk + [k] -%}
|
| 182 |
+
{%- set ns_chk.ek = ns_chk.ek + [loop.index0] -%}
|
| 183 |
+
{%- endfor -%}
|
| 184 |
+
{%- else -%}
|
| 185 |
+
{%- set ns_chk.res = ns_chk.res + [id_of(m)] -%}
|
| 186 |
+
{%- set ns_chk.mk = ns_chk.mk + [k] -%}
|
| 187 |
+
{%- set ns_chk.ek = ns_chk.ek + [-1] -%}
|
| 188 |
+
{%- endif -%}
|
| 189 |
+
{%- endfor -%}
|
| 190 |
+
{%- if not ns_a.tool_calls -%}
|
| 191 |
+
{%- set ns_chk.can_sort = false -%}
|
| 192 |
+
{%- else -%}
|
| 193 |
+
{%- for tc in ns_a.tool_calls -%}
|
| 194 |
+
{%- set ns_chk.tcs = ns_chk.tcs + [id_of(tc)] -%}
|
| 195 |
+
{%- endfor -%}
|
| 196 |
+
{%- if '' in ns_chk.res or '' in ns_chk.tcs -%}
|
| 197 |
+
{%- set ns_chk.can_sort = false -%}
|
| 198 |
+
{%- elif ns_chk.res | unique(case_sensitive=true) | list | length != ns_chk.res | length -%}
|
| 199 |
+
{%- set ns_chk.can_sort = false -%}
|
| 200 |
+
{%- elif ns_chk.tcs | unique(case_sensitive=true) | list | length != ns_chk.tcs | length -%}
|
| 201 |
+
{%- set ns_chk.can_sort = false -%}
|
| 202 |
+
{%- else -%}
|
| 203 |
+
{%- for eid in ns_chk.res -%}
|
| 204 |
+
{%- if eid not in ns_chk.tcs -%}
|
| 205 |
+
{%- set ns_chk.can_sort = false -%}
|
| 206 |
+
{%- break -%}
|
| 207 |
+
{%- endif -%}
|
| 208 |
+
{%- endfor -%}
|
| 209 |
+
{%- endif -%}
|
| 210 |
+
{%- endif -%}
|
| 211 |
+
{%- if ns_chk.can_sort -%}
|
| 212 |
+
{%- set ns_ord = namespace(res=[], tcs=[], j=0, pairs=[]) -%}
|
| 213 |
+
{%- for eid in ns_chk.res -%}
|
| 214 |
+
{%- set ns_ord.res = ns_ord.res + [{'id': eid, 'p': loop.index0}] -%}
|
| 215 |
+
{%- endfor -%}
|
| 216 |
+
{%- for tc_id in ns_chk.tcs -%}
|
| 217 |
+
{%- set ns_ord.tcs = ns_ord.tcs + [{'id': tc_id, 'i': loop.index0}] -%}
|
| 218 |
+
{%- endfor -%}
|
| 219 |
+
{%- set ns_ord.res = ns_ord.res | sort(attribute='id', case_sensitive=true) -%}
|
| 220 |
+
{%- for tc in ns_ord.tcs | sort(attribute='id', case_sensitive=true) -%}
|
| 221 |
+
{%- if ns_ord.j < ns_ord.res | length and ns_ord.res[ns_ord.j].id == tc.id -%}
|
| 222 |
+
{%- set ns_ord.pairs = ns_ord.pairs + [{'i': tc.i, 'p': ns_ord.res[ns_ord.j].p}] -%}
|
| 223 |
+
{%- set ns_ord.j = ns_ord.j + 1 -%}
|
| 224 |
+
{%- endif -%}
|
| 225 |
+
{%- endfor -%}
|
| 226 |
+
{%- for pair in ns_ord.pairs | sort(attribute='i') -%}
|
| 227 |
+
{%- set m = messages[ns_chk.mk[pair.p]] -%}
|
| 228 |
+
{%- if ns_chk.ek[pair.p] >= 0 -%}
|
| 229 |
+
{%- set entry = m.content[ns_chk.ek[pair.p]] -%}
|
| 230 |
+
{%- if entry.output is iterable and entry.output is not string and entry.output is not mapping and entry.output and entry.output.0.type == "tool_reference" -%}
|
| 231 |
+
{{- tool_references_to_response(entry.output) -}}
|
| 232 |
+
{%- else -%}
|
| 233 |
+
{{- tool_response(visible_text(entry.output)) -}}
|
| 234 |
+
{%- endif -%}
|
| 235 |
+
{%- else -%}
|
| 236 |
+
{{- render_tool_response(m) -}}
|
| 237 |
+
{%- endif -%}
|
| 238 |
+
{%- endfor -%}
|
| 239 |
+
{%- else -%}
|
| 240 |
+
{%- for k in range(block_start, ns_blk.end + 1) -%}
|
| 241 |
+
{{- render_tool_response(messages[k]) -}}
|
| 242 |
+
{%- endfor -%}
|
| 243 |
+
{%- endif -%}
|
| 244 |
+
{% endif -%}
|
| 245 |
+
{%- elif m.role == 'system' -%}
|
| 246 |
+
<|system|>{{ visible_text(m.content) }}
|
| 247 |
+
{%- endif -%}
|
| 248 |
+
{%- endfor -%}
|
| 249 |
+
{%- if add_generation_prompt -%}
|
| 250 |
+
<|assistant|>{{- '<think>' -}}
|
| 251 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"GlmMoeDsaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"dtype": "bfloat16",
|
| 8 |
+
"eos_token_id": [
|
| 9 |
+
154820,
|
| 10 |
+
154827,
|
| 11 |
+
154829
|
| 12 |
+
],
|
| 13 |
+
"ep_size": 1,
|
| 14 |
+
"first_k_dense_replace": 3,
|
| 15 |
+
"head_dim": 192,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"hidden_size": 128,
|
| 18 |
+
"index_head_dim": 128,
|
| 19 |
+
"index_n_heads": 32,
|
| 20 |
+
"index_share_for_mtp_iteration": true,
|
| 21 |
+
"index_skip_topk_offset": 3,
|
| 22 |
+
"index_topk": 128,
|
| 23 |
+
"index_topk_freq": 4,
|
| 24 |
+
"index_topk_pattern": null,
|
| 25 |
+
"indexer_rope_interleave": true,
|
| 26 |
+
"indexer_types": [
|
| 27 |
+
"full",
|
| 28 |
+
"full",
|
| 29 |
+
"full",
|
| 30 |
+
"shared",
|
| 31 |
+
"shared",
|
| 32 |
+
"shared",
|
| 33 |
+
"full",
|
| 34 |
+
"shared",
|
| 35 |
+
"shared",
|
| 36 |
+
"shared",
|
| 37 |
+
"full"
|
| 38 |
+
],
|
| 39 |
+
"initializer_range": 0.02,
|
| 40 |
+
"intermediate_size": 128,
|
| 41 |
+
"kv_lora_rank": 256,
|
| 42 |
+
"max_position_embeddings": 1048576,
|
| 43 |
+
"mlp_layer_types": [
|
| 44 |
+
"dense",
|
| 45 |
+
"dense",
|
| 46 |
+
"dense",
|
| 47 |
+
"sparse",
|
| 48 |
+
"sparse",
|
| 49 |
+
"sparse",
|
| 50 |
+
"sparse",
|
| 51 |
+
"sparse",
|
| 52 |
+
"sparse",
|
| 53 |
+
"sparse",
|
| 54 |
+
"sparse"
|
| 55 |
+
],
|
| 56 |
+
"model_type": "glm_moe_dsa",
|
| 57 |
+
"moe_intermediate_size": 128,
|
| 58 |
+
"moe_layer_freq": 1,
|
| 59 |
+
"moe_router_dtype": "float32",
|
| 60 |
+
"n_group": 1,
|
| 61 |
+
"n_routed_experts": 32,
|
| 62 |
+
"n_shared_experts": 1,
|
| 63 |
+
"norm_topk_prob": true,
|
| 64 |
+
"num_attention_heads": 64,
|
| 65 |
+
"num_experts_per_tok": 8,
|
| 66 |
+
"num_hidden_layers": 11,
|
| 67 |
+
"num_key_value_heads": 64,
|
| 68 |
+
"num_nextn_predict_layers": 1,
|
| 69 |
+
"pad_token_id": 154820,
|
| 70 |
+
"pretraining_tp": 1,
|
| 71 |
+
"q_lora_rank": 128,
|
| 72 |
+
"qk_head_dim": 256,
|
| 73 |
+
"qk_nope_head_dim": 32,
|
| 74 |
+
"qk_rope_head_dim": 32,
|
| 75 |
+
"rms_norm_eps": 1e-05,
|
| 76 |
+
"rope_interleave": true,
|
| 77 |
+
"rope_parameters": {
|
| 78 |
+
"rope_theta": 8000000,
|
| 79 |
+
"rope_type": "default"
|
| 80 |
+
},
|
| 81 |
+
"routed_scaling_factor": 2.5,
|
| 82 |
+
"scoring_func": "sigmoid",
|
| 83 |
+
"tie_word_embeddings": false,
|
| 84 |
+
"topk_group": 1,
|
| 85 |
+
"topk_method": "noaux_tc",
|
| 86 |
+
"transformers_version": "5.15.0",
|
| 87 |
+
"use_cache": true,
|
| 88 |
+
"v_head_dim": 256,
|
| 89 |
+
"vocab_size": 154880,
|
| 90 |
+
"quantization_config": {
|
| 91 |
+
"activation_scheme": "dynamic",
|
| 92 |
+
"fmt": "e4m3",
|
| 93 |
+
"quant_method": "fp8",
|
| 94 |
+
"weight_block_size": [
|
| 95 |
+
32,
|
| 96 |
+
32
|
| 97 |
+
],
|
| 98 |
+
"modules_to_not_convert": [
|
| 99 |
+
"lm_head",
|
| 100 |
+
"model.embed_tokens",
|
| 101 |
+
"model.layers.0.self_attn.indexer.weights_proj",
|
| 102 |
+
"model.layers.1.self_attn.indexer.weights_proj",
|
| 103 |
+
"model.layers.10.self_attn.indexer.weights_proj",
|
| 104 |
+
"model.layers.2.self_attn.indexer.weights_proj",
|
| 105 |
+
"model.layers.6.self_attn.indexer.weights_proj"
|
| 106 |
+
]
|
| 107 |
+
}
|
| 108 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
154820,
|
| 5 |
+
154827,
|
| 6 |
+
154829
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 154820,
|
| 9 |
+
"temperature": 1.0,
|
| 10 |
+
"top_p": 0.95,
|
| 11 |
+
"transformers_version": "5.12.0"
|
| 12 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b64a1fc11affd23f3ca38fa5bf0fd27d26069a975540df5f67decac3e01cc0a8
|
| 3 |
+
size 186878480
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19e773648cb4e65de8660ea6365e10acca112d42a854923df93db4a6f333a82d
|
| 3 |
+
size 20217442
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"clean_up_tokenization_spaces": false,
|
| 4 |
+
"do_lower_case": false,
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"extra_special_tokens": [
|
| 7 |
+
"<|endoftext|>",
|
| 8 |
+
"[MASK]",
|
| 9 |
+
"[gMASK]",
|
| 10 |
+
"[sMASK]",
|
| 11 |
+
"<sop>",
|
| 12 |
+
"<eop>",
|
| 13 |
+
"<|system|>",
|
| 14 |
+
"<|user|>",
|
| 15 |
+
"<|assistant|>",
|
| 16 |
+
"<|observation|>",
|
| 17 |
+
"<|begin_of_image|>",
|
| 18 |
+
"<|end_of_image|>",
|
| 19 |
+
"<|begin_of_video|>",
|
| 20 |
+
"<|end_of_video|>",
|
| 21 |
+
"<|begin_of_audio|>",
|
| 22 |
+
"<|end_of_audio|>",
|
| 23 |
+
"<|begin_of_transcription|>",
|
| 24 |
+
"<|end_of_transcription|>"
|
| 25 |
+
],
|
| 26 |
+
"is_local": true,
|
| 27 |
+
"model_max_length": 1048576,
|
| 28 |
+
"model_specific_special_tokens": {},
|
| 29 |
+
"pad_token": "<|endoftext|>",
|
| 30 |
+
"padding_side": "left",
|
| 31 |
+
"remove_space": false,
|
| 32 |
+
"tokenizer_class": "TokenizersBackend"
|
| 33 |
+
}
|