danielhanchen commited on
Commit
cbebece
·
verified ·
1 Parent(s): 15849c1

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. README.md +242 -0
  3. chat_template.jinja +88 -0
  4. config.json +44 -0
  5. generation_config.json +11 -0
  6. model-00001-of-00092.safetensors +3 -0
  7. model-00002-of-00092.safetensors +3 -0
  8. model-00003-of-00092.safetensors +3 -0
  9. model-00004-of-00092.safetensors +3 -0
  10. model-00005-of-00092.safetensors +3 -0
  11. model-00006-of-00092.safetensors +3 -0
  12. model-00007-of-00092.safetensors +3 -0
  13. model-00008-of-00092.safetensors +3 -0
  14. model-00009-of-00092.safetensors +3 -0
  15. model-00010-of-00092.safetensors +3 -0
  16. model-00011-of-00092.safetensors +3 -0
  17. model-00012-of-00092.safetensors +3 -0
  18. model-00013-of-00092.safetensors +3 -0
  19. model-00014-of-00092.safetensors +3 -0
  20. model-00015-of-00092.safetensors +3 -0
  21. model-00016-of-00092.safetensors +3 -0
  22. model-00017-of-00092.safetensors +3 -0
  23. model-00018-of-00092.safetensors +3 -0
  24. model-00019-of-00092.safetensors +3 -0
  25. model-00020-of-00092.safetensors +3 -0
  26. model-00021-of-00092.safetensors +3 -0
  27. model-00022-of-00092.safetensors +3 -0
  28. model-00023-of-00092.safetensors +3 -0
  29. model-00024-of-00092.safetensors +3 -0
  30. model-00025-of-00092.safetensors +3 -0
  31. model-00026-of-00092.safetensors +3 -0
  32. model-00027-of-00092.safetensors +3 -0
  33. model-00028-of-00092.safetensors +3 -0
  34. model-00029-of-00092.safetensors +3 -0
  35. model-00030-of-00092.safetensors +3 -0
  36. model-00031-of-00092.safetensors +3 -0
  37. model-00032-of-00092.safetensors +3 -0
  38. model-00033-of-00092.safetensors +3 -0
  39. model-00034-of-00092.safetensors +3 -0
  40. model-00035-of-00092.safetensors +3 -0
  41. model-00036-of-00092.safetensors +3 -0
  42. model-00037-of-00092.safetensors +3 -0
  43. model-00038-of-00092.safetensors +3 -0
  44. model-00039-of-00092.safetensors +3 -0
  45. model-00040-of-00092.safetensors +3 -0
  46. model-00041-of-00092.safetensors +3 -0
  47. model-00042-of-00092.safetensors +3 -0
  48. model-00043-of-00092.safetensors +3 -0
  49. model-00044-of-00092.safetensors +3 -0
  50. model-00045-of-00092.safetensors +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - unsloth
4
+ base_model:
5
+ - zai-org/GLM-4.7
6
+ language:
7
+ - en
8
+ - zh
9
+ library_name: transformers
10
+ license: mit
11
+ pipeline_tag: text-generation
12
+ ---
13
+ > [!NOTE]
14
+ > Includes Unsloth **chat template fixes**! <br> For `llama.cpp`, use `--jinja`
15
+ >
16
+
17
+ <div>
18
+ <p style="margin-top: 0;margin-bottom: 0;">
19
+ <em><a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0</a> achieves superior accuracy & outperforms other leading quants.</em>
20
+ </p>
21
+ <div style="display: flex; gap: 5px; align-items: center; ">
22
+ <a href="https://github.com/unslothai/unsloth/">
23
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
24
+ </a>
25
+ <a href="https://discord.gg/unsloth">
26
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
27
+ </a>
28
+ <a href="https://docs.unsloth.ai/">
29
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
30
+ </a>
31
+ </div>
32
+ </div>
33
+
34
+
35
+ # GLM-4.7
36
+
37
+ <div align="center">
38
+ <img src=https://raw.githubusercontent.com/zai-org/GLM-4.5/refs/heads/main/resources/logo.svg width="15%"/>
39
+ </div>
40
+ <p align="center">
41
+ 👋 Join our <a href="https://discord.gg/QR7SARHRxK" target="_blank">Discord</a> community.
42
+ <br>
43
+ 📖 Check out the GLM-4.7 <a href="https://z.ai/blog/glm-4.7" target="_blank">technical blog</a>, <a href="https://arxiv.org/abs/2508.06471" target="_blank">technical report(GLM-4.5)</a>.
44
+ <br>
45
+ 📍 Use GLM-4.7 API services on <a href="https://docs.z.ai/guides/llm/glm-4.7">Z.ai API Platform. </a>
46
+ <br>
47
+ 👉 One click to <a href="https://chat.z.ai">GLM-4.7</a>.
48
+ </p>
49
+
50
+ ## Introduction
51
+
52
+ **GLM-4.7**, your new coding partner, is coming with the following features:
53
+
54
+ - **Core Coding**: GLM-4.7 brings clear gains, compared to its predecessor GLM-4.6, in multilingual agentic coding and terminal-based tasks, including (73.8%, +5.8%) on SWE-bench, (66.7%, +12.9%) on SWE-bench Multilingual, and (41%, +16.5%) on Terminal Bench 2.0. GLM-4.7 also supports thinking before acting, with significant improvements on complex tasks in mainstream agent frameworks such as Claude Code, Kilo Code, Cline, and Roo Code.
55
+ - **Vibe Coding**: GLM-4.7 takes a big step forward in improving UI quality. It produces cleaner, more modern webpages and generates better-looking slides with more accurate layout and sizing.
56
+ - **Tool Using**: GLM-4.7 achieves significantly improvements in Tool using. Significant better performances can be seen on benchmarks such as τ^2-Bench and on web browsing via BrowseComp.
57
+ - **Complex Reasoning**: GLM-4.7 delivers a substantial boost in mathematical and reasoning capabilities, achieving (42.8%, +12.4%) on the HLE (Humanity’s Last Exam) benchmark compared to GLM-4.6.
58
+
59
+ You can also see significant improvements in many other scenarios such as chat, creative writing, and role-play scenario.
60
+
61
+ ![bench](https://raw.githubusercontent.com/zai-org/GLM-4.5/refs/heads/main/resources/bench_glm47.png)
62
+
63
+ **Performances on Benchmarks.** More detailed comparisons of GLM-4.7 with other models GPT-5-High, GPT-5.1-High, Claude Sonnet 4.5, Gemini 3.0 Pro, DeepSeek-V3.2, Kimi K2 Thinking, on 17 benchmarks (including 8 reasoning, 5 coding, and 3 agents benchmarks) can be seen in the below table.
64
+
65
+ | Benchmark | GLM-4.7 | GLM-4.6 | Kimi K2 Thinking | DeepSeek-V3.2 | Gemini 3.0 Pro | Claude Sonnet 4.5 | GPT-5-High | GPT-5.1-High |
66
+ |:-------------------------------|:-------:|:-------:|:----------------:|:-------------:|:--------------:|:-----------------:|:----------:|:------------:|
67
+ | MMLU-Pro | 84.3 | 83.2 | 84.6 | 85.0 | 90.1 | 88.2 | 87.5 | 87.0 |
68
+ | GPQA-Diamond | 85.7 | 81.0 | 84.5 | 82.4 | 91.9 | 83.4 | 85.7 | 88.1 |
69
+ | HLE | 24.8 | 17.2 | 23.9 | 25.1 | 37.5 | 13.7 | 26.3 | 25.7 |
70
+ | HLE (w/ Tools) | 42.8 | 30.4 | 44.9 | 40.8 | 45.8 | 32.0 | 35.2 | 42.7 |
71
+ | AIME 2025 | 95.7 | 93.9 | 94.5 | 93.1 | 95.0 | 87.0 | 94.6 | 94.0 |
72
+ | HMMT Feb. 2025 | 97.1 | 89.2 | 89.4 | 92.5 | 97.5 | 79.2 | 88.3 | 96.3 |
73
+ | HMMT Nov. 2025 | 93.5 | 87.7 | 89.2 | 90.2 | 93.3 | 81.7 | 89.2 | - |
74
+ | IMOAnswerBench | 82.0 | 73.5 | 78.6 | 78.3 | 83.3 | 65.8 | 76.0 | - |
75
+ | LiveCodeBench-v6 | 84.9 | 82.8 | 83.1 | 83.3 | 90.7 | 64.0 | 87.0 | 87.0 |
76
+ | SWE-bench Verified | 73.8 | 68.0 | 71.3 | 73.1 | 76.2 | 77.2 | 74.9 | 76.3 |
77
+ | SWE-bench Multilingual | 66.7 | 53.8 | 61.1 | 70.2 | - | 68.0 | 55.3 | - |
78
+ | Terminal Bench Hard | 33.3 | 23.6 | 30.6 | 35.4 | 39.0 | 33.3 | 30.5 | 43.0 |
79
+ | Terminal Bench 2.0 | 41.0 | 24.5 | 35.7 | 46.4 | 54.2 | 42.8 | 35.2 | 47.6 |
80
+ | BrowseComp | 52.0 | 45.1 | - | 51.4 | - | 24.1 | 54.9 | 50.8 |
81
+ | BrowseComp (w/ Context Manage) | 67.5 | 57.5 | 60.2 | 67.6 | 59.2 | - | - | - |
82
+ | BrowseComp-Zh | 66.6 | 49.5 | 62.3 | 65.0 | - | 42.4 | 63.0 | - |
83
+ | τ²-Bench | 87.4 | 75.2 | 74.3 | 85.3 | 90.7 | 87.2 | 82.4 | 82.7 |
84
+
85
+ > **Coding:** AGI is a long journey, and benchmarks are only one way to evaluate performance. While the metrics provide necessary checkpoints, the most important thing is still how it *feels*. True intelligence isn't just about acing a test or processing data faster; ultimately, the success of AGI will be measured by how seamlessly it integrates into our lives-**"coding"** this time.
86
+
87
+
88
+ ## Getting started with GLM-4.7
89
+
90
+ ### Interleaved Thinking & Preserved Thinking
91
+
92
+ ![bench](https://raw.githubusercontent.com/zai-org/GLM-4.5/refs/heads/main/resources/thinking.png)
93
+
94
+ GLM-4.7 further enhances **Interleaved Thinking** (a feature introduced since GLM-4.5) and introduces **Preserved Thinking** and **Turn-level Thinking**. By thinking between actions and staying consistent across turns, it makes complex tasks more stable and more controllable:
95
+ - **Interleaved Thinking**: The model thinks before every response and tool calling, improving instruction following and the quality of generation.
96
+ - **Preserved Thinking**: In coding agent scenarios, the model automatically retains all thinking blocks across multi-turn conversations, reusing the existing reasoning instead of re-deriving from scratch. This reduces information loss and inconsistencies, and is well-suited for long-horizon, complex tasks.
97
+ - **Turn-level Thinking**: The model supports per-turn control over reasoning within a session—disable thinking for lightweight requests to reduce latency/cost, enable it for complex tasks to improve accuracy and stability.
98
+
99
+ More details: https://docs.z.ai/guides/capabilities/thinking-mode
100
+
101
+ ### Evaluation Parameters
102
+
103
+ **Default Settings (Most Tasks)**
104
+
105
+ * temperature: `1.0`
106
+ * top-p: `0.95`
107
+ * max new tokens: `131072`
108
+
109
+ For multi-turn agentic tasks (τ²-Bench and Terminal Bench 2), please turn on [Preserved Thinking mode](https://docs.z.ai/guides/capabilities/thinking-mode).
110
+
111
+ **Terminal Bench, SWE Bench Verified**
112
+
113
+ * temperature: `0.7`
114
+ * top-p: `1.0`
115
+ * max new tokens: `16384`
116
+
117
+ **τ^2-Bench**
118
+
119
+ * Temperature: `0`
120
+ * Max new tokens: `16384`
121
+
122
+ For τ^2-Bench evaluation, we added an additional prompt to the Retail and Telecom user interaction to avoid failure modes caused by users ending the interaction incorrectly. For the Airline domain, we applied the domain fixes as proposed in the [Claude Opus 4.5](https://assets.anthropic.com/m/64823ba7485345a7/Claude-Opus-4-5-System-Card.pdf) release report.
123
+
124
+ ## Serve GLM-4.7 Locally
125
+
126
+ For local deployment, GLM-4.7 supports inference frameworks including vLLM and SGLang. Comprehensive deployment instructions are available in the official [Github](https://github.com/zai-org/GLM-4.5) repository.
127
+
128
+
129
+ vLLM and SGLang only support GLM-4.7 on their main branches. you can use their official docker images for inference.
130
+
131
+ ### vLLM
132
+
133
+ Using Docker as:
134
+
135
+ ```shell
136
+ docker pull vllm/vllm-openai:nightly
137
+ ```
138
+
139
+ or using pip (must use pypi.org as the index url):
140
+
141
+ ```shell
142
+ pip install -U vllm --pre --index-url https://pypi.org/simple --extra-index-url https://wheels.vllm.ai/nightly
143
+ ```
144
+
145
+ ### SGLang
146
+
147
+ Using Docker as:
148
+
149
+ ```shell
150
+ docker pull lmsysorg/sglang:dev
151
+ ```
152
+
153
+ or using pip install sglang from source.
154
+
155
+
156
+ ### transformers
157
+
158
+ using with transformers as `4.57.3` and then run:
159
+
160
+ ```python
161
+ import torch
162
+ from transformers import AutoModelForCausalLM, AutoTokenizer
163
+
164
+ MODEL_PATH = "zai-org/GLM-4.7"
165
+ messages = [{"role": "user", "content": "hello"}]
166
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
167
+ inputs = tokenizer.apply_chat_template(
168
+ messages,
169
+ tokenize=True,
170
+ add_generation_prompt=True,
171
+ return_dict=True,
172
+ return_tensors="pt",
173
+ )
174
+ model = AutoModelForCausalLM.from_pretrained(
175
+ pretrained_model_name_or_path=MODEL_PATH,
176
+ torch_dtype=torch.bfloat16,
177
+ device_map="auto",
178
+ )
179
+ inputs = inputs.to(model.device)
180
+ generated_ids = model.generate(**inputs, max_new_tokens=128, do_sample=False)
181
+ output_text = tokenizer.decode(generated_ids[0][inputs.input_ids.shape[1] :])
182
+ print(output_text)
183
+ ```
184
+
185
+ ### vLLM
186
+
187
+ ```shell
188
+ vllm serve zai-org/GLM-4.7-FP8 \
189
+ --tensor-parallel-size 8 \
190
+ --tool-call-parser glm47 \
191
+ --reasoning-parser glm45 \
192
+ --enable-auto-tool-choice \
193
+ --served-model-name glm-4.7-fp8
194
+ ```
195
+
196
+ ### SGLang
197
+
198
+ ```shell
199
+ python3 -m sglang.launch_server \
200
+ --model-path zai-org/GLM-4.7-FP8 \
201
+ --tp-size 8 \
202
+ --tool-call-parser glm47 \
203
+ --reasoning-parser glm45 \
204
+ --speculative-algorithm EAGLE \
205
+ --speculative-num-steps 3 \
206
+ --speculative-eagle-topk 1 \
207
+ --speculative-num-draft-tokens 4 \
208
+ --mem-fraction-static 0.8 \
209
+ --served-model-name glm-4.7-fp8 \
210
+ --host 0.0.0.0 \
211
+ --port 8000
212
+ ```
213
+
214
+ ### Parameter Instructions
215
+
216
+ - For agentic tasks of GLM-4.7, please turn on [Preserved Thinking mode](https://docs.z.ai/guides/capabilities/thinking-mode) by adding the following config (only sglang support):
217
+
218
+ ```
219
+ "chat_template_kwargs": {
220
+ "enable_thinking": true,
221
+ "clear_thinking": false
222
+ }
223
+ ```
224
+
225
+ - When using `vLLM` and `SGLang`, thinking mode is enabled by default when sending requests. If you want to disable the thinking switch, you need to add the `extra_body={"chat_template_kwargs": {"enable_thinking": False}}` parameter.
226
+ - Both support tool calling. Please use OpenAI-style tool description format for calls.
227
+
228
+
229
+ ## Citation
230
+
231
+ If you find our work useful in your research, please consider citing the following paper:
232
+
233
+ ```bibtex
234
+ @misc{5team2025glm45agenticreasoningcoding,
235
+ title={GLM-4.5: Agentic, Reasoning, and Coding (ARC) Foundation Models},
236
+ author={GLM Team and Aohan Zeng and Xin Lv and Qinkai Zheng and Zhenyu Hou and Bin Chen and Chengxing Xie and Cunxiang Wang and Da Yin and Hao Zeng and Jiajie Zhang and Kedong Wang and Lucen Zhong and Mingdao Liu and Rui Lu and Shulin Cao and Xiaohan Zhang and Xuancheng Huang and Yao Wei and Yean Cheng and Yifan An and Yilin Niu and Yuanhao Wen and Yushi Bai and Zhengxiao Du and Zihan Wang and Zilin Zhu and Bohan Zhang and Bosi Wen and Bowen Wu and Bowen Xu and Can Huang and Casey Zhao and Changpeng Cai and Chao Yu and Chen Li and Chendi Ge and Chenghua Huang and Chenhui Zhang and Chenxi Xu and Chenzheng Zhu and Chuang Li and Congfeng Yin and Daoyan Lin and Dayong Yang and Dazhi Jiang and Ding Ai and Erle Zhu and Fei Wang and Gengzheng Pan and Guo Wang and Hailong Sun and Haitao Li and Haiyang Li and Haiyi Hu and Hanyu Zhang and Hao Peng and Hao Tai and Haoke Zhang and Haoran Wang and Haoyu Yang and He Liu and He Zhao and Hongwei Liu and Hongxi Yan and Huan Liu and Huilong Chen and Ji Li and Jiajing Zhao and Jiamin Ren and Jian Jiao and Jiani Zhao and Jianyang Yan and Jiaqi Wang and Jiayi Gui and Jiayue Zhao and Jie Liu and Jijie Li and Jing Li and Jing Lu and Jingsen Wang and Jingwei Yuan and Jingxuan Li and Jingzhao Du and Jinhua Du and Jinxin Liu and Junkai Zhi and Junli Gao and Ke Wang and Lekang Yang and Liang Xu and Lin Fan and Lindong Wu and Lintao Ding and Lu Wang and Man Zhang and Minghao Li and Minghuan Xu and Mingming Zhao and Mingshu Zhai and Pengfan Du and Qian Dong and Shangde Lei and Shangqing Tu and Shangtong Yang and Shaoyou Lu and Shijie Li and Shuang Li and Shuang-Li and Shuxun Yang and Sibo Yi and Tianshu Yu and Wei Tian and Weihan Wang and Wenbo Yu and Weng Lam Tam and Wenjie Liang and Wentao Liu and Xiao Wang and Xiaohan Jia and Xiaotao Gu and Xiaoying Ling and Xin Wang and Xing Fan and Xingru Pan and Xinyuan Zhang and Xinze Zhang and Xiuqing Fu and Xunkai Zhang and Yabo Xu and Yandong Wu and Yida Lu and Yidong Wang and Yilin Zhou and Yiming Pan and Ying Zhang and Yingli Wang and Yingru Li and Yinpei Su and Yipeng Geng and Yitong Zhu and Yongkun Yang and Yuhang Li and Yuhao Wu and Yujiang Li and Yunan Liu and Yunqing Wang and Yuntao Li and Yuxuan Zhang and Zezhen Liu and Zhen Yang and Zhengda Zhou and Zhongpei Qiao and Zhuoer Feng and Zhuorui Liu and Zichen Zhang and Zihan Wang and Zijun Yao and Zikang Wang and Ziqiang Liu and Ziwei Chai and Zixuan Li and Zuodong Zhao and Wenguang Chen and Jidong Zhai and Bin Xu and Minlie Huang and Hongning Wang and Juanzi Li and Yuxiao Dong and Jie Tang},
237
+ year={2025},
238
+ eprint={2508.06471},
239
+ archivePrefix={arXiv},
240
+ primaryClass={cs.CL},
241
+ url={https://arxiv.org/abs/2508.06471},
242
+ }
chat_template.jinja ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# Unsloth template fixes #}
2
+ [gMASK]<sop>
3
+ {%- if tools -%}
4
+ <|system|>
5
+ # Tools
6
+
7
+ You may call one or more functions to assist with the user query.
8
+
9
+ You are provided with function signatures within <tools></tools> XML tags:
10
+ <tools>
11
+ {% for tool in tools %}
12
+ {{ tool | tojson|string }}
13
+ {% endfor %}
14
+ </tools>
15
+
16
+ For each function call, output the function name and arguments within the following XML format:
17
+ <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 -%}
18
+ {%- macro visible_text(content) -%}
19
+ {%- if content is string -%}
20
+ {{- content }}
21
+ {%- elif content is iterable and content is not mapping -%}
22
+ {%- for item in content -%}
23
+ {%- if item is mapping and item.type == 'text' -%}
24
+ {{- item.text }}
25
+ {%- elif item is string -%}
26
+ {{- item }}
27
+ {%- endif -%}
28
+ {%- endfor -%}
29
+ {%- else -%}
30
+ {{- content }}
31
+ {%- endif -%}
32
+ {%- endmacro -%}
33
+ {%- set ns = namespace(last_user_index=-1) %}
34
+ {%- for m in messages %}
35
+ {%- if m.role == 'user' %}
36
+ {% set ns.last_user_index = loop.index0 -%}
37
+ {%- endif %}
38
+ {%- endfor %}
39
+ {% for m in messages %}
40
+ {%- if m.role == 'user' -%}<|user|>{{ visible_text(m.content) }}
41
+ {%- elif m.role == 'assistant' -%}
42
+ <|assistant|>
43
+ {%- set reasoning_content = '' %}
44
+ {%- set content = visible_text(m.content) %}
45
+ {%- if m.reasoning_content is string %}
46
+ {%- set reasoning_content = m.reasoning_content %}
47
+ {%- else %}
48
+ {%- if '</think>' in content %}
49
+ {%- set reasoning_content = ((content.split('</think>')|first).rstrip('\n').split('<think>')|last).lstrip('\n') %}
50
+ {%- set content = (content.split('</think>')|last).lstrip('\n') %}
51
+ {%- endif %}
52
+ {%- endif %}
53
+ {%- if ((clear_thinking is defined and not clear_thinking) or loop.index0 > ns.last_user_index) and reasoning_content -%}
54
+ {{ '<think>' + reasoning_content.strip() + '</think>'}}
55
+ {%- else -%}
56
+ {{ '</think>' }}
57
+ {%- endif -%}
58
+ {%- if content.strip() -%}
59
+ {{ content.strip() }}
60
+ {%- endif -%}
61
+ {% if m.tool_calls %}
62
+ {% for tc in m.tool_calls %}
63
+ {%- if tc.function %}
64
+ {%- set tc = tc.function %}
65
+ {%- endif %}
66
+ {{- '<tool_call>' + tc.name -}}
67
+ {% set _args = tc.arguments %}{%- if _args is mapping %}{% for k, v in _args|items %}<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson|string if v is not string else v }}</arg_value>{% endfor %}{%- endif %}</tool_call>{% endfor %}
68
+ {% endif %}
69
+ {%- elif m.role == 'tool' -%}
70
+ {%- if m.content is string -%}
71
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
72
+ {{- '<|observation|>' }}
73
+ {%- endif %}
74
+ {{- '<tool_response>' }}
75
+ {{- m.content }}
76
+ {{- '</tool_response>' }}
77
+ {%- else -%}
78
+ <|observation|>{% for tr in m.content %}
79
+ <tool_response>{{ tr.output if tr.output is defined else tr }}</tool_response>{% endfor -%}
80
+ {% endif -%}
81
+ {%- elif m.role == 'system' -%}
82
+ <|system|>{{ visible_text(m.content) }}
83
+ {%- endif -%}
84
+ {%- endfor -%}
85
+ {%- if add_generation_prompt -%}
86
+ <|assistant|>{{- '</think>' if (enable_thinking is defined and not enable_thinking) else '<think>' -}}
87
+ {%- endif -%}
88
+ {# Copyright 2025-present Unsloth. Apache 2.0 License. #}
config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Glm4MoeForCausalLM"
4
+ ],
5
+ "attention_bias": true,
6
+ "attention_dropout": 0.0,
7
+ "torch_dtype": "bfloat16",
8
+ "eos_token_id": [
9
+ 151329,
10
+ 151336,
11
+ 151338
12
+ ],
13
+ "first_k_dense_replace": 3,
14
+ "head_dim": 128,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 5120,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 12288,
19
+ "max_position_embeddings": 202752,
20
+ "model_type": "glm4_moe",
21
+ "moe_intermediate_size": 1536,
22
+ "n_group": 1,
23
+ "n_routed_experts": 160,
24
+ "n_shared_experts": 1,
25
+ "norm_topk_prob": true,
26
+ "num_attention_heads": 96,
27
+ "num_experts_per_tok": 8,
28
+ "num_hidden_layers": 92,
29
+ "num_key_value_heads": 8,
30
+ "num_nextn_predict_layers": 1,
31
+ "pad_token_id": 151330,
32
+ "partial_rotary_factor": 0.5,
33
+ "rms_norm_eps": 1e-05,
34
+ "rope_scaling": null,
35
+ "rope_theta": 1000000,
36
+ "routed_scaling_factor": 2.5,
37
+ "tie_word_embeddings": false,
38
+ "topk_group": 1,
39
+ "transformers_version": "4.57.3",
40
+ "unsloth_fixed": true,
41
+ "use_cache": true,
42
+ "use_qk_norm": true,
43
+ "vocab_size": 151552
44
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": [
4
+ 151329,
5
+ 151336,
6
+ 151338
7
+ ],
8
+ "pad_token_id": 151329,
9
+ "temperature": 1.0,
10
+ "transformers_version": "4.56.2"
11
+ }
model-00001-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68a6fdc167ec2112ded8d04a97966739ae07cf4698e4b29d192536c06f013e51
3
+ size 2202060968
model-00002-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15296a7b7190f062f80d6fda3f64786bc4bfcbc3eb72b060ee633e1d95822bf2
3
+ size 650168352
model-00003-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b518e9565f74a154bfd46786aa1d9f8ebb1c053f962256b5352f33431f7f007
3
+ size 650168352
model-00004-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e8db1605ce2afe1f8475c1183aefdd582b802f93430254fc67ebec3ff87c1ae
3
+ size 7871313120
model-00005-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b6a0f06e3ef8c5dfa2f8ce31c2397654d93cc709d74f666118748b80d64b8d7
3
+ size 7871313120
model-00006-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:705dfb6825169f023cbed84007ad007e4676255e9ddb0c376618c8a5f37db07b
3
+ size 7871313120
model-00007-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c63bba33598a046d5fc6a4b6be2fa38f5795f5969771ac732860aae1bc6df5a
3
+ size 7871313120
model-00008-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:476c0136870b99eeb705dc9e277d3538c0fe917eb030a3efe45c135c537d1639
3
+ size 7871313120
model-00009-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d6ced5113e74e01b833eb5fcdf78fcdbd8259dc2f0d7c39e1401e783d06ffd4
3
+ size 7871313120
model-00010-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f76b445ffb294d5ed248d4d81c3ca0b15bca9e9f6fb2acf36c4ad1b30c82b47
3
+ size 7871313120
model-00011-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ec0e4bcd13137e0915bed1e8dcaacbd6d874cba36ce344afd75f34fb3f1ac6c
3
+ size 7871313616
model-00012-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef236827f5bb49e4b656eec99462f95d4b2fb576d65c349e275e307a3049adb3
3
+ size 7871313616
model-00013-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7173db5ec5755bb2f6c7c0020761d4e7c98d510f24c64898bece11131ef18768
3
+ size 7871313616
model-00014-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fb1a2e2bca6a3b2aca3218fa4775cfec7a50d31e773fc0a33554c8b426d06a5
3
+ size 7871313616
model-00015-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8abc2995ffa8b6542dbf489bcc5cdeb9b7f5a66b620d25ca0b116e1a2bf990fe
3
+ size 7871313616
model-00016-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdb08861b405bef1ed5c71395580597abb2bf6af7bd42e4b4b037e2a997f4e83
3
+ size 7871313616
model-00017-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5671d6fd9ffcb251101577a414e6918f1a82036c4abea44cab68aafb1a452501
3
+ size 7871313616
model-00018-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21c1aba4f208f6982896783bb33d87488ac8ee7fbb26ff12a2fdbd7fc02eb384
3
+ size 7871313616
model-00019-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd9e23d4c5b6ec9654f7b3c71a0b851d0e37fdfe94a98bf78e897939b3f64178
3
+ size 7871313616
model-00020-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06f33e14ee03d4a7db54e7136a8553beacdd31afe05044fd09ca10b63616d271
3
+ size 7871313616
model-00021-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23f45515976a4f6ad85d1ab97a2bfefa930d776f47bcbfc0148249d51d0d87f7
3
+ size 7871313616
model-00022-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7b67850a3b19945cffaae859724b476e0f6864b58d5378205492a09d073986a
3
+ size 7871313616
model-00023-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1dff224046d45db02f63f1fa45eaf9d7783b6bb0f00ef3e446f9d65ef330b0cc
3
+ size 7871313616
model-00024-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d082e9e4fe4a813eb2683e23cff52dcb85d438e25bc5d3bdbb01f69e2732be61
3
+ size 7871313616
model-00025-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23b20871d461f9a350bdcf67d12c0095cf24c70ab1f98e5333741eaa6a6c5e1c
3
+ size 7871313616
model-00026-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:428edb09eb0917aebf12a836d33a58897b402458c7aa23a7c7290e924b20bcb6
3
+ size 7871313616
model-00027-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c282a88d7e8bc4fd57c7c80a7114c66da82a81dc78f934b3404b6ab7e1f1c09
3
+ size 7871313616
model-00028-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e79def67bd54f46e39a005bbbe62e765fb6aafa46efb9840235cf0fb715b6978
3
+ size 7871313616
model-00029-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb3421d27afd0cd7f675f5317f242862d835eaf9cfadc9a78f0942df8078b4a8
3
+ size 7871313616
model-00030-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:649320f0046102954667a216a33db63890b9aefb5f05ef4e8e388b3079594733
3
+ size 7871313616
model-00031-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24f00a67630f089abead00b1ab573410f7980a1325e2dd5b0a21e48315c969ac
3
+ size 7871313616
model-00032-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:686516209abebdd06d923fa537c8047b9b87fbca6e367689031f5941be29d7e0
3
+ size 7871313616
model-00033-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d08ea10cbc9d6792f9dbcfd16f9dd579411c439a275ddc08e6cfaf1180ee0f80
3
+ size 7871313616
model-00034-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c6ffd9adb18fd2c8469c612151476dd61906b337c6d2a7e42f9ee0c740d9200
3
+ size 7871313616
model-00035-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b010414eb4ab1dce16759b8e5852b05265290ead08eff54b7b82dba78737029
3
+ size 7871313616
model-00036-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6e06322143dfe75f88925bd41387a74762278f143ed7f0d52c3299f9d95b6a3
3
+ size 7871313616
model-00037-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6046141408a257c55a273985fb86fd9b7b95b64b57388f0adc38355f84e8ddb
3
+ size 7871313616
model-00038-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a305c39a91b0038d23fd226a987c36e22e4e6f30333df5fcec82cd5e5b632ef
3
+ size 7871313616
model-00039-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b8cb2fe51cac4b22d1aab7cccc25bdce8bd52953466b09b3e974d7d356418a0
3
+ size 7871313616
model-00040-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb4f4b16a377e1e09e4e52dfbd9d66b75458e4271a77f273430bffb61369b751
3
+ size 7871313616
model-00041-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0aba8077b06b1365bae77d04df01f72137b32272e9696ea6ab642e5cc434f5c9
3
+ size 7871313616
model-00042-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df0a314dac9df0ddeb7fcaf60e007f650dde5cc101f1bb532de1c660c31bd48e
3
+ size 7871313616
model-00043-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a340ac212f460e1b16d681d39cc8bc42245f807916c3bf5c42221f7e72cb9c22
3
+ size 7871313616
model-00044-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:befcbefa0573decb72a49fa2544080c2804081521567b9add974c536b43bfb57
3
+ size 7871313616
model-00045-of-00092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9fb874dadf025d4f3a634a77b01da540811a7f276eb26e8ca900b47bcb013c9
3
+ size 7871313616