初始化项目,由ModelHub XC社区提供模型
Model: unsloth/GLM-Z1-9B-0414-GGUF Source: Original Platform
This commit is contained in:
73
.gitattributes
vendored
Normal file
73
.gitattributes
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.db* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ark* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text
|
||||||
|
**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gguf* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ggml filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.llamafile* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-BF16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-IQ4_NL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q2_K_L.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-IQ1_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-IQ1_S.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-IQ2_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-IQ2_XXS.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-IQ3_XXS.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-Q2_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-Q3_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-Q4_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-Q5_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-Q6_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
GLM-Z1-9B-0414-UD-Q8_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
3
GLM-Z1-9B-0414-BF16.gguf
Normal file
3
GLM-Z1-9B-0414-BF16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6480864c0cbceb57b9276430ec363f18bc20f146c93c187bcb7af098ec2975d6
|
||||||
|
size 18811582336
|
||||||
3
GLM-Z1-9B-0414-IQ4_NL.gguf
Normal file
3
GLM-Z1-9B-0414-IQ4_NL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c16cb8acf28f797e88c42e43171304518a819f62234b5553d2873eed7c4d4169
|
||||||
|
size 5465176192
|
||||||
3
GLM-Z1-9B-0414-IQ4_XS.gguf
Normal file
3
GLM-Z1-9B-0414-IQ4_XS.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d6414302c0a4baddb25519e5a36a202105214a32f7b87a346696e546b4d5019c
|
||||||
|
size 5281675392
|
||||||
3
GLM-Z1-9B-0414-Q2_K.gguf
Normal file
3
GLM-Z1-9B-0414-Q2_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:bfaa7b38268015a4188698416980978377cb0e467276a46f9398d3851f002c29
|
||||||
|
size 4006344832
|
||||||
3
GLM-Z1-9B-0414-Q2_K_L.gguf
Normal file
3
GLM-Z1-9B-0414-Q2_K_L.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:87e86d6b54fdfffbb8e401b999552a422a5ae598b99b5a3a74a1228339155ecb
|
||||||
|
size 4151834752
|
||||||
3
GLM-Z1-9B-0414-Q3_K_M.gguf
Normal file
3
GLM-Z1-9B-0414-Q3_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:64f5be86b29ee8d282ebf9a651a0c55f48a139bb7c4b04dabd44f6517bc858b4
|
||||||
|
size 4974508160
|
||||||
3
GLM-Z1-9B-0414-Q3_K_S.gguf
Normal file
3
GLM-Z1-9B-0414-Q3_K_S.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:fc848e447f1fb297b37ae80c8506c8be217097f3bbcff14d780082e65a1aefdc
|
||||||
|
size 4592040064
|
||||||
3
GLM-Z1-9B-0414-Q4_0.gguf
Normal file
3
GLM-Z1-9B-0414-Q4_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:629226f9671aba67437acc180df1c268a4863845e27f6a95282d0f37c14cc74a
|
||||||
|
size 5477464192
|
||||||
3
GLM-Z1-9B-0414-Q4_1.gguf
Normal file
3
GLM-Z1-9B-0414-Q4_1.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3a2eb6b913de2d177c3c9787ea21062966995c80dc3a747c1524d78dc076044f
|
||||||
|
size 6008600704
|
||||||
3
GLM-Z1-9B-0414-Q4_K_M.gguf
Normal file
3
GLM-Z1-9B-0414-Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1e8f66084c215b89738c87a7c53f9a9e116708ab9b02cf1c2e4225d767466b68
|
||||||
|
size 6166575232
|
||||||
3
GLM-Z1-9B-0414-Q4_K_S.gguf
Normal file
3
GLM-Z1-9B-0414-Q4_K_S.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:43e29067c4cd50999a960da99d48a98d8d3f1744d2752cddd36dd511b9783d75
|
||||||
|
size 5758482560
|
||||||
3
GLM-Z1-9B-0414-Q5_K_M.gguf
Normal file
3
GLM-Z1-9B-0414-Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ed64fa8be1da17fbc52c8d49abd48713b0c58b4c80dfb7b2863317db913518cb
|
||||||
|
size 7050918016
|
||||||
3
GLM-Z1-9B-0414-Q5_K_S.gguf
Normal file
3
GLM-Z1-9B-0414-Q5_K_S.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:37e1832efee545abf51b97c0b896d68ef38af00b29bf957723b4c9961f95bd6b
|
||||||
|
size 6697515136
|
||||||
3
GLM-Z1-9B-0414-Q6_K.gguf
Normal file
3
GLM-Z1-9B-0414-Q6_K.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:05279ce170e1fbe8786d4e6f55067dbd5ad3d54442dd832f44389ba4d8eb8de8
|
||||||
|
size 8266643584
|
||||||
3
GLM-Z1-9B-0414-Q8_0.gguf
Normal file
3
GLM-Z1-9B-0414-Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2e0585fc3d2e9e56dbf6b9cb57f89fd187078deea378912b37742d6bc533d040
|
||||||
|
size 9999612032
|
||||||
3
GLM-Z1-9B-0414-UD-IQ1_M.gguf
Normal file
3
GLM-Z1-9B-0414-UD-IQ1_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b020a8153be4662042d4259acf6f558e2c02f21dc5bfa5427e5a557abe2bd717
|
||||||
|
size 3318151296
|
||||||
3
GLM-Z1-9B-0414-UD-IQ1_S.gguf
Normal file
3
GLM-Z1-9B-0414-UD-IQ1_S.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ae9ba103cdc109c377f705f248fe4a42533e7c55664f0614beab7b0e80505e0b
|
||||||
|
size 3204200576
|
||||||
3
GLM-Z1-9B-0414-UD-IQ2_M.gguf
Normal file
3
GLM-Z1-9B-0414-UD-IQ2_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:43c9c9990a7be436f10982091c386c6561164ef05cfe2b6fc3de1358177188ca
|
||||||
|
size 3992025216
|
||||||
3
GLM-Z1-9B-0414-UD-IQ2_XXS.gguf
Normal file
3
GLM-Z1-9B-0414-UD-IQ2_XXS.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c9ec76cbf9dfe70b3ed3acfec56004b08596eca6363d39a1d21df48077c43fa1
|
||||||
|
size 3511154816
|
||||||
3
GLM-Z1-9B-0414-UD-IQ3_XXS.gguf
Normal file
3
GLM-Z1-9B-0414-UD-IQ3_XXS.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3d98cf620549c1164b00bee565243557abf14bb763acd38b1a46894e5c455f8d
|
||||||
|
size 4234836096
|
||||||
3
GLM-Z1-9B-0414-UD-Q2_K_XL.gguf
Normal file
3
GLM-Z1-9B-0414-UD-Q2_K_XL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:69d0b975dcb2bc149823bf354a6d2e11a2d2bababe278415adbeb6033089a5c4
|
||||||
|
size 4211062912
|
||||||
3
GLM-Z1-9B-0414-UD-Q3_K_XL.gguf
Normal file
3
GLM-Z1-9B-0414-UD-Q3_K_XL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5a5cbd1c98f83a16f20fe6229ac4db2acc52d990a83a6b83922cde8ecbd751e5
|
||||||
|
size 5139871872
|
||||||
3
GLM-Z1-9B-0414-UD-Q4_K_XL.gguf
Normal file
3
GLM-Z1-9B-0414-UD-Q4_K_XL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8306f0e73ddb82ad34c5a6df8a7099cae088ad3e30094089a924a3051ce38bac
|
||||||
|
size 6187350144
|
||||||
3
GLM-Z1-9B-0414-UD-Q5_K_XL.gguf
Normal file
3
GLM-Z1-9B-0414-UD-Q5_K_XL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:11ae18524ecb36051ea2d9dbf8ea15f6ac1880d257c6d81ee5c510b0d4b0bc1a
|
||||||
|
size 7006189696
|
||||||
3
GLM-Z1-9B-0414-UD-Q6_K_XL.gguf
Normal file
3
GLM-Z1-9B-0414-UD-Q6_K_XL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2c8be93916a225bd9a1f8bac1f0fdd2f3d75de45777dc24e98113ff214185980
|
||||||
|
size 8886032512
|
||||||
3
GLM-Z1-9B-0414-UD-Q8_K_XL.gguf
Normal file
3
GLM-Z1-9B-0414-UD-Q8_K_XL.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:082f810df168f2abc1a94836daa8dcf684766934eacd9d7a816d1579a5475617
|
||||||
|
size 12075300992
|
||||||
140
README.md
Normal file
140
README.md
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
---
|
||||||
|
tags:
|
||||||
|
- unsloth
|
||||||
|
base_model:
|
||||||
|
- THUDM/GLM-Z1-9B-0414
|
||||||
|
license: mit
|
||||||
|
language:
|
||||||
|
- zh
|
||||||
|
- en
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
library_name: transformers
|
||||||
|
---
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If you are using `llama.cpp`, use `--jinja` to enable the system prompt.
|
||||||
|
>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p style="margin-top: 0;margin-bottom: 0;">
|
||||||
|
<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>
|
||||||
|
</p>
|
||||||
|
<div style="display: flex; gap: 5px; align-items: center; ">
|
||||||
|
<a href="https://github.com/unslothai/unsloth/">
|
||||||
|
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
|
||||||
|
</a>
|
||||||
|
<a href="https://discord.gg/unsloth">
|
||||||
|
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
||||||
|
</a>
|
||||||
|
<a href="https://docs.unsloth.ai/basics/qwen3-how-to-run-and-fine-tune">
|
||||||
|
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
# GLM-4-Z1-9B-0414
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
The GLM family welcomes a new generation of open-source models, the **GLM-4-32B-0414** series, featuring 32 billion parameters. Its performance is comparable to OpenAI's GPT series and DeepSeek's V3/R1 series, and it supports very user-friendly local deployment features. GLM-4-32B-Base-0414 was pre-trained on 15T of high-quality data, including a large amount of reasoning-type synthetic data, laying the foundation for subsequent reinforcement learning extensions. In the post-training stage, in addition to human preference alignment for dialogue scenarios, we also enhanced the model's performance in instruction following, engineering code, and function calling using techniques such as rejection sampling and reinforcement learning, strengthening the atomic capabilities required for agent tasks. GLM-4-32B-0414 achieves good results in areas such as engineering code, Artifact generation, function calling, search-based Q&A, and report generation. Some benchmarks even rival larger models like GPT-4o and DeepSeek-V3-0324 (671B).
|
||||||
|
|
||||||
|
**GLM-Z1-32B-0414** is a reasoning model with **deep thinking capabilities**. This was developed based on GLM-4-32B-0414 through cold start and extended reinforcement learning, as well as further training of the model on tasks involving mathematics, code, and logic. Compared to the base model, GLM-Z1-32B-0414 significantly improves mathematical abilities and the capability to solve complex tasks. During the training process, we also introduced general reinforcement learning based on pairwise ranking feedback, further enhancing the model's general capabilities.
|
||||||
|
|
||||||
|
**GLM-Z1-Rumination-32B-0414** is a deep reasoning model with **rumination capabilities** (benchmarked against OpenAI's Deep Research). Unlike typical deep thinking models, the rumination model employs longer periods of deep thought to solve more open-ended and complex problems (e.g., writing a comparative analysis of AI development in two cities and their future development plans). The rumination model integrates search tools during its deep thinking process to handle complex tasks and is trained by utilizing multiple rule-based rewards to guide and extend end-to-end reinforcement learning. Z1-Rumination shows significant improvements in research-style writing and complex retrieval tasks.
|
||||||
|
|
||||||
|
Finally, **GLM-Z1-9B-0414** is a surprise. We employed the aforementioned series of techniques to train a 9B small-sized model that maintains the open-source tradition. Despite its smaller scale, GLM-Z1-9B-0414 still exhibits excellent capabilities in mathematical reasoning and general tasks. Its overall performance is already at a leading level among open-source models of the same size. Especially in resource-constrained scenarios, this model achieves an excellent balance between efficiency and effectiveness, providing a powerful option for users seeking lightweight deployment.
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://raw.githubusercontent.com/THUDM/GLM-4/refs/heads/main/resources/Bench-Z1-32B.png">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="100%" src="https://raw.githubusercontent.com/THUDM/GLM-4/refs/heads/main/resources/Bench-Z1-9B.png">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Model Usage Guidelines
|
||||||
|
|
||||||
|
### I. Sampling Parameters
|
||||||
|
|
||||||
|
| Parameter | Recommended Value | Description |
|
||||||
|
| ------------ | ----------------- | -------------------------------------------- |
|
||||||
|
| temperature | **0.6** | Balances creativity and stability |
|
||||||
|
| top_p | **0.95** | Cumulative probability threshold for sampling|
|
||||||
|
| top_k | **40** | Filters out rare tokens while maintaining diversity |
|
||||||
|
| max_new_tokens | **30000** | Leaves enough tokens for thinking |
|
||||||
|
|
||||||
|
### II. Enforced Thinking
|
||||||
|
|
||||||
|
- Add \<think\>\n to the **first line**: Ensures the model thinks before responding
|
||||||
|
- When using `chat_template.jinja`, the prompt is automatically injected to enforce this behavior
|
||||||
|
|
||||||
|
|
||||||
|
### III. Dialogue History Trimming
|
||||||
|
|
||||||
|
- Retain only the **final user-visible reply**.
|
||||||
|
Hidden thinking content should **not** be saved to history to reduce interference—this is already implemented in `chat_template.jinja`
|
||||||
|
|
||||||
|
|
||||||
|
### IV. Handling Long Contexts (YaRN)
|
||||||
|
|
||||||
|
- When input length exceeds **8,192 tokens**, consider enabling YaRN (Rope Scaling)
|
||||||
|
|
||||||
|
- In supported frameworks, add the following snippet to `config.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"rope_scaling": {
|
||||||
|
"type": "yarn",
|
||||||
|
"factor": 4.0,
|
||||||
|
"original_max_position_embeddings": 32768
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Static YaRN** applies uniformly to all text. It may slightly degrade performance on short texts, so enable as needed.
|
||||||
|
|
||||||
|
## Inference Code
|
||||||
|
|
||||||
|
Make Sure Using `transforemrs>=4.51.3`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
MODEL_PATH = "THUDM/GLM-4-Z1-9B-0414"
|
||||||
|
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, device_map="auto")
|
||||||
|
|
||||||
|
message = [{"role": "user", "content": "Let a, b be positive real numbers such that ab = a + b + 3. Determine the range of possible values for a + b."}]
|
||||||
|
|
||||||
|
inputs = tokenizer.apply_chat_template(
|
||||||
|
message,
|
||||||
|
return_tensors="pt",
|
||||||
|
add_generation_prompt=True,
|
||||||
|
return_dict=True,
|
||||||
|
).to(model.device)
|
||||||
|
|
||||||
|
generate_kwargs = {
|
||||||
|
"input_ids": inputs["input_ids"],
|
||||||
|
"attention_mask": inputs["attention_mask"],
|
||||||
|
"max_new_tokens": 4096,
|
||||||
|
"do_sample": False,
|
||||||
|
}
|
||||||
|
out = model.generate(**generate_kwargs)
|
||||||
|
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
||||||
|
```
|
||||||
|
|
||||||
|
## Citations
|
||||||
|
|
||||||
|
If you find our work useful, please consider citing the following paper.
|
||||||
|
|
||||||
|
```
|
||||||
|
@misc{glm2024chatglm,
|
||||||
|
title={ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools},
|
||||||
|
author={Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang},
|
||||||
|
year={2024},
|
||||||
|
eprint={2406.12793},
|
||||||
|
archivePrefix={arXiv},
|
||||||
|
primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
|
||||||
|
}
|
||||||
|
```
|
||||||
28
config.json
Normal file
28
config.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"Glm4ForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": true,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"eos_token_id": 151329,
|
||||||
|
"head_dim": 128,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 4096,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 13696,
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"model_type": "glm4",
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_hidden_layers": 40,
|
||||||
|
"num_key_value_heads": 2,
|
||||||
|
"pad_token_id": 151330,
|
||||||
|
"partial_rotary_factor": 0.5,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"transformers_version": "4.52.0.dev0",
|
||||||
|
"unsloth_fixed": true,
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 151552
|
||||||
|
}
|
||||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||||
BIN
imatrix_unsloth.dat
Normal file
BIN
imatrix_unsloth.dat
Normal file
Binary file not shown.
11
params
Normal file
11
params
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"min_p": 0.01,
|
||||||
|
"stop": [
|
||||||
|
"<|system|>",
|
||||||
|
"<|user|>",
|
||||||
|
"<|assistant|>",
|
||||||
|
"<|observation|>"
|
||||||
|
],
|
||||||
|
"temperature": 0.2,
|
||||||
|
"top_p": 1
|
||||||
|
}
|
||||||
41
template
Normal file
41
template
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
[gMASK]<sop>{{- /* ---------- tools section ---------- */}}
|
||||||
|
{{- if .Tools }}
|
||||||
|
<|system|>
|
||||||
|
# Available Tools
|
||||||
|
{{- range .Tools }}
|
||||||
|
## {{- if .Function }}{{ .Function.Name }}{{- else }}{{ .Name }}{{- end }}
|
||||||
|
|
||||||
|
{{ json .Function }}
|
||||||
|
When calling one of the tools above, pass the arguments in JSON format.
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* ---------- system messages ---------- */}}
|
||||||
|
{{- range .Messages }}
|
||||||
|
{{- if eq .Role "system" }}
|
||||||
|
<|system|>
|
||||||
|
{{ .Content }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* ---------- user / assistant / observation ---------- */}}
|
||||||
|
{{- range .Messages }}
|
||||||
|
{{- if ne .Role "system" }}
|
||||||
|
{{- if eq .Role "user" }}
|
||||||
|
<|user|>
|
||||||
|
{{ .Content }}
|
||||||
|
{{- else if eq .Role "assistant" }}
|
||||||
|
{{- if .ToolCalls }}{{/* assistant function-call */}}
|
||||||
|
<|assistant|>{{ json .ToolCalls }}
|
||||||
|
{{ .Content }}
|
||||||
|
{{- else }}{{/* normal assistant message */}}
|
||||||
|
<|assistant|>
|
||||||
|
{{ .Content }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if eq .Role "observation" }}
|
||||||
|
<|observation|>
|
||||||
|
{{ .Content }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
<|assistant|>
|
||||||
Reference in New Issue
Block a user