Instructions to use axteam/GLM-4.7-Flash-FP8-dynamic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use axteam/GLM-4.7-Flash-FP8-dynamic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="axteam/GLM-4.7-Flash-FP8-dynamic") 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("axteam/GLM-4.7-Flash-FP8-dynamic") model = AutoModelForCausalLM.from_pretrained("axteam/GLM-4.7-Flash-FP8-dynamic", 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 axteam/GLM-4.7-Flash-FP8-dynamic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "axteam/GLM-4.7-Flash-FP8-dynamic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axteam/GLM-4.7-Flash-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/axteam/GLM-4.7-Flash-FP8-dynamic
- SGLang
How to use axteam/GLM-4.7-Flash-FP8-dynamic 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 "axteam/GLM-4.7-Flash-FP8-dynamic" \ --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": "axteam/GLM-4.7-Flash-FP8-dynamic", "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 "axteam/GLM-4.7-Flash-FP8-dynamic" \ --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": "axteam/GLM-4.7-Flash-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use axteam/GLM-4.7-Flash-FP8-dynamic with Docker Model Runner:
docker model run hf.co/axteam/GLM-4.7-Flash-FP8-dynamic
GLM-4.7-Flash ยท FP8 (dynamic)
8-bit quantization of zai-org/GLM-4.7-Flash for vLLM serving. Quantized by axteam.
| Base model | zai-org/GLM-4.7-Flash |
| Method | FP8 (dynamic) |
| Format | compressed-tensors float-quantized (scheme FP8_DYNAMIC) |
| Weights / activations | W8A8 โ FP8 E4M3 weights (per-channel), dynamic per-token FP8 activations |
| Architecture | MoE (GLM-4.7 Lite ยท Glm4MoeLite) ยท 31.2B ยท 202K context ยท text-only |
| Size on disk | ~32.2 GB |
| Calibration | None (data-free) |
| License | mit |
Quantization details
- Scheme โ W8A8 โ FP8 E4M3 weights (per-channel), dynamic per-token FP8 activations, stored as compressed-tensors
float-quantized(schemeFP8_DYNAMIC). - Kept in BF16 โ token embeddings, the LM head, and all RMSNorms. Only attention & MLP projections are quantized. In addition, the MoE router (
mlp.gate, incl.e_score_correction_bias) is kept in BF16. The MTP layer (model.layers.47:eh_proj,shared_head.head) is quantized like the other layers. - Post-training quantization (no retraining). Tokenizer /
chat_templateidentical to the original.
Requirements
| Runtime | vLLM โ the architecture is in vLLM โฅ 0.15.0; tested here with vLLM 0.32.0. |
| vLLM install | vLLM 0.32 itself needs Python 3.11โ3.14, torch 2.13 (CUDA 13.0 build, so an NVIDIA driver with CUDA 13 support), transformers โฅ5.16.1,<5.20 and compressed-tensors 0.17.0 (both pinned by vLLM; 0.17.0 reads this checkpoint, which was saved with 0.19.0 โ do not upgrade it separately). |
| GPU | NVIDIA Turing (sm75, e.g. T4) or newer. FP8 math runs on Ada / Hopper / Blackwell (sm89+); on Turing and Ampere vLLM switches to weight-only FP8 automatically. V100 (sm70) is not supported. (Kernel choice per GPU from vLLM 0.32's selection code; only B200 was run here.) |
| Memory | Weights: 32.2 GB. Add KV cache (grows with context length ร concurrent requests) and a few GB for activations / CUDA graphs; use --tensor-parallel-size N when the weights do not fit one GPU. |
| Transformers (without vLLM) | transformers>=5.15.0. |
| trust_remote_code | not needed |
Usage (vLLM)
Start an OpenAI-compatible server:
vllm serve axteam/GLM-4.7-Flash-FP8-dynamic --max-model-len 32768
Query it:
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "axteam/GLM-4.7-Flash-FP8-dynamic",
"messages": [{"role": "user", "content": "๋ํ๋ฏผ๊ตญ์ ์๋๋ ์ด๋์ธ๊ฐ์?"}],
"temperature": 1.0, "max_tokens": 512
}'
Offline inference in Python:
from vllm import LLM, SamplingParams
llm = LLM(model="axteam/GLM-4.7-Flash-FP8-dynamic", max_model_len=32768)
params = SamplingParams(temperature=1.0, max_tokens=1024)
out = llm.chat([{"role": "user", "content": "Explain model quantization in two sentences."}], params)
print(out[0].outputs[0].text)
Recommended sampling (from the original
generation_config.json):temperature=1.0. Thinking mode is on by default in the chat template; to turn it off passchat_template_kwargs={"enable_thinking": False}(Pythonllm.chat(..., chat_template_kwargs=...), or"chat_template_kwargs": {"enable_thinking": false}in the request body).
Reducing KV-cache memory (optional, serve-time)
The KV cache is kept in BF16 by default. KV-cache precision is a runtime choice, independent of the weight quantization above; for long contexts or large batches FP8 roughly halves KV-cache memory:
vllm serve axteam/GLM-4.7-Flash-FP8-dynamic --kv-cache-dtype fp8
License
Quantized derivative of zai-org/GLM-4.7-Flash (mit).
ํ๊ตญ์ด ์์ฝ
zai-org/GLM-4.7-Flash์ FP8 (W8A8) ์์ํ ๋น๋ ยท ์ ์ axteam
๊ฐ์
| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| ์๋ณธ ๋ชจ๋ธ | zai-org/GLM-4.7-Flash |
| ์์ํ ๋ฐฉ์ | FP8 ๋์ ์์ํ (W8A8) |
| ์ ์ฅ ํ์ | compressed-tensors float-quantized (scheme FP8_DYNAMIC) |
| ๋ชจ๋ธ ๊ตฌ์กฐ | MoE (GLM-4.7 Lite, Glm4MoeLite) ยท 31.2B ยท ์ปจํ
์คํธ 202K ยท ํ
์คํธ ์ ์ฉ |
| ์ฉ๋ | 32.2 GB |
| ๋ณด์ ๋ฐ์ดํฐ | ์์ (๋ณด์ ๋ฐ์ดํฐ ๋ถํ์) |
์์ํ ์์ธ
- ๊ฐ์ค์น: FP8(E4M3), ์ถ๋ ฅ ์ฑ๋๋ณ ์ค์ผ์ผ
- ํ์ฑํ: ์คํ ์ ํ ํฐ๋ณ ๋์ FP8
- ๋ฐฉ์: PTQ(ํ์ต ํ ์์ํ, ์ฌํ์ต ์์) ยท ๊ฐ์ค์น ์ค์ผ์ผ์ ๋ฏธ๋ฆฌ ๊ณ์ฐ, ํ์ฑํ ์ค์ผ์ผ์ ์คํ ์ ํ ํฐ๋ง๋ค ๊ณ์ฐ
- BF16 ์ ์ง: ํ ํฐ ์๋ฒ ๋ฉยทLM ํค๋ยท๋ชจ๋ RMSNormยทMoE ๋ผ์ฐํฐ(
mlp.gate,e_score_correction_biasํฌํจ) - ์์ํ ๋์: ์ดํ
์
ยทMLP projection (MTP ์ธต
model.layers.47๋ ๋ค๋ฅธ ์ธต๊ณผ ๊ฐ์ด ์์ํ) - ์๋ณธ๊ณผ ๋์ผ: ํ ํฌ๋์ด์ ยทchat templateยทgeneration config
ํ์ง (์ค์ธก)
- ๋ฒค์น๋งํฌ ํ๊ท : 66.56 โ MMLUยทGSM8KยทARC-ChallengeยทWinograndeยทKMMLUยทHAE-RAE, lm-evaluation-harness(vLLM) (์๋ณธ์ ๋ฏธ์ธก์ )
์๊ตฌ์ฌํญ
- ์คํ ์์ง: vLLM 0.15.0 ์ด์ โ vLLM 0.32.0์์ ์ค์ธก
- vLLM 0.32 ์ค์น ์กฐ๊ฑด: Python 3.11~3.14, torch 2.13(CUDA 13.0 ๋น๋ โ CUDA 13 ์ง์ ๋๋ผ์ด๋ฒ ํ์), transformers 5.16.1 ์ด์ 5.20 ๋ฏธ๋ง, compressed-tensors 0.17.0 (vLLM ๊ณ ์ ๋ฒ์ ์ผ๋ก ์ด ์ฒดํฌํฌ์ธํธ ๋ก๋ ๊ฐ๋ฅ, ๋ณ๋๋ก ์ฌ๋ฆฌ์ง ๋ง ๊ฒ)
- GPU: NVIDIA Turing(sm75, ์: T4) ์ด์ โ FP8 ์ฐ์ฐ์ AdaยทHopperยทBlackwell(sm89 ์ด์)์์ ์ํ, ๊ทธ๋ณด๋ค ์ค๋๋ GPU๋ vLLM์ด ๊ฐ์ค์น ์ ์ฉ FP8๋ก ์๋ ์ ํ. V100(sm70) ๋ฏธ์ง์
- ๋ฉ๋ชจ๋ฆฌ: ๊ฐ์ค์น 32.2 GB + KV ์บ์(์ปจํ
์คํธ ๊ธธ์ด ร ๋์ ์์ฒญ ์์ ๋น๋ก) + ํ์ฑํยทCUDA graph ์ GB โ ํ ์ฅ์ ๋ค์ด๊ฐ์ง ์์ผ๋ฉด
--tensor-parallel-size N - Transformers๋ก ์ง์ ์ฌ์ฉ: transformers 5.15.0 ์ด์
- trust_remote_code: ๋ถํ์
์ฌ์ฉ๋ฒ
- ์๋ฒ ์คํ:
vllm serve axteam/GLM-4.7-Flash-FP8-dynamic --max-model-len 32768โ OpenAI ํธํ API (๊ธฐ๋ณธ ํฌํธ 8000) - Python:
LLM(model="axteam/GLM-4.7-Flash-FP8-dynamic").chat(...)โ ์ ์ฒด ์์๋ ์ Usage ์ฐธ๊ณ - ๊ถ์ฅ ์ํ๋ง:
temperature=1.0 - thinking ๋ชจ๋: ๊ธฐ๋ณธ ์ผ์ง โ ๋๋ ค๋ฉด
chat_template_kwargs={"enable_thinking": False} - KV ์บ์ ์ ๊ฐ(์ ํ):
--kv-cache-dtype fp8โ ๊ธด ๋ฌธ๋งฅยท๋๋ ์์ฒญ์์ KV ๋ฉ๋ชจ๋ฆฌ ์ฝ ์ ๋ฐ, ๊ฐ์ค์น ์์ํ์ ๋ณ๊ฐ์ธ ์คํ ์ต์
๋ผ์ด์ ์ค
- ๋ผ์ด์ ์ค: MIT โ ์๋ณธ ๋ชจ๋ธ์ ๋ผ์ด์ ์ค๋ฅผ ๊ทธ๋๋ก ๋ฐ๋ฆ
- ๊ถ๋ฆฌ: ์๋ณธ ๊ฐ์ค์นยทํ ํฌ๋์ด์ ์ ๊ถ๋ฆฌ๋ Z.ai์ ์์ผ๋ฉฐ, ์ด ๋ฆฌํฌ๋ ์์ํ ํ์๋ฌผ
- Downloads last month
- -
Model tree for axteam/GLM-4.7-Flash-FP8-dynamic
Base model
zai-org/GLM-4.7-Flash