Text Generation
Transformers
Safetensors
English
Chinese
glm4_moe
Mixture of Experts
fp8
conversational
compressed-tensors
Instructions to use zai-org/GLM-4.5-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-4.5-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/GLM-4.5-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zai-org/GLM-4.5-FP8") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-4.5-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zai-org/GLM-4.5-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zai-org/GLM-4.5-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-4.5-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zai-org/GLM-4.5-FP8
- SGLang
How to use zai-org/GLM-4.5-FP8 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zai-org/GLM-4.5-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-4.5-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zai-org/GLM-4.5-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-4.5-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zai-org/GLM-4.5-FP8 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-4.5-FP8
Improve model card: Add citation and specific tags (moe, fp8)
#3
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -5,6 +5,9 @@ language:
|
|
| 5 |
library_name: transformers
|
| 6 |
license: mit
|
| 7 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# GLM-4.5-FP8
|
|
@@ -89,8 +92,8 @@ Under the configurations in the table below, the models can utilize their full 1
|
|
| 89 |
| GLM-4.5 | BF16 | H100 x 32 / H200 x 16 | sglang |
|
| 90 |
| GLM-4.5 | FP8 | H100 x 16 / H200 x 8 | sglang |
|
| 91 |
| GLM-4.5-Air | BF16 | H100 x 8 / H200 x 4 | sglang |
|
| 92 |
-
| GLM-4.5-Air | FP8 | H100 x 4 / H200 x 2 | sglang |
|
| 93 |
-
|
| 94 |
### Fine-tuning
|
| 95 |
|
| 96 |
The code can run under the configurations in the table below
|
|
@@ -221,4 +224,16 @@ python3 -m sglang.launch_server \
|
|
| 221 |
+ When using `vLLM` and `SGLang`, thinking mode is enabled by default when sending requests. If you want to disable the
|
| 222 |
thinking switch, you need to add the `extra_body={"chat_template_kwargs": {"enable_thinking": False}}` parameter.
|
| 223 |
+ Both support tool calling. Please use OpenAI-style tool description format for calls.
|
| 224 |
-
+ For specific code, please refer to `api_request.py` in the `inference` folder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
library_name: transformers
|
| 6 |
license: mit
|
| 7 |
pipeline_tag: text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- moe
|
| 10 |
+
- fp8
|
| 11 |
---
|
| 12 |
|
| 13 |
# GLM-4.5-FP8
|
|
|
|
| 92 |
| GLM-4.5 | BF16 | H100 x 32 / H200 x 16 | sglang |
|
| 93 |
| GLM-4.5 | FP8 | H100 x 16 / H200 x 8 | sglang |
|
| 94 |
| GLM-4.5-Air | BF16 | H100 x 8 / H200 x 4 | sglang |
|
| 95 |
+
| GLM-4.5-Air | FP8 | H100 x 4 / H200 x 2 | sglang |\
|
| 96 |
+
|
| 97 |
### Fine-tuning
|
| 98 |
|
| 99 |
The code can run under the configurations in the table below
|
|
|
|
| 224 |
+ When using `vLLM` and `SGLang`, thinking mode is enabled by default when sending requests. If you want to disable the
|
| 225 |
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 |
+
+ For specific code, please refer to `api_request.py` in the `inference` folder.
|
| 228 |
+
|
| 229 |
+
## Citation
|
| 230 |
+
If you find our work useful or helpful for your R&D works, please feel free to cite our paper as below.
|
| 231 |
+
|
| 232 |
+
```bibtex
|
| 233 |
+
@article{zhu2025glm45,
|
| 234 |
+
title={GLM-4.5: Agentic, Reasoning, and Coding (ARC) Foundation Models},
|
| 235 |
+
author={Zhu, Xiaohan and Sun, Tianxiang and Wang, Hao and Xu, Yi and Zhang, Yichen and Wang, Junyi and Huang, Junjie and Zeng, Jiao and Huang, Yangyang and Gu, Ruipeng and Zhang, Xiaodong and Du, Mengying and Han, Hao and Li, Chao and Xiao, Jin and Guo, Weidong and Li, Zhen and Lu, Jingkang and Chen, Shu and Chen, Huadong and Chen, Peng and Liu, Hongguang and Guo, Guang and Liu, Wen and Yang, Tianyu and Hu, Bo and Zhang, Wenmin and Sun, Maosong},
|
| 236 |
+
journal={arXiv preprint arXiv:2508.06471},
|
| 237 |
+
year={2025}
|
| 238 |
+
}
|
| 239 |
+
```
|