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.
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 (dynamic) λ‘ μμνν μλΉμ©(8-bit) λͺ¨λΈμ
λλ€. μμ±: axteam.
- λ°©μ β FP8 E4M3, κ°μ€μΉ μ±λλ³ μ€μΌμΌ, νμ±ν λμ FP8. νμ compressed-tensors
float-quantized(schemeFP8_DYNAMIC). - BF16 μ μ§ β μλ² λ©Β·LM ν€λΒ·λͺ¨λ norm. attentionΒ·MLP projection λ§ μμν. μΆκ°λ‘ MoE λΌμ°ν°(
mlp.gate,e_score_correction_biasν¬ν¨)λ BF16 μ μ§. MTP μΈ΅(model.layers.47μeh_projΒ·shared_head.head)μ λ€λ₯Έ μΈ΅μ²λΌ μμνλ¨. - PTQ(μ¬νμ΅ μμ), ν ν¬λμ΄μ Β·chat_template μλ³Έ λμΌ.
- μ€ν β
vllm serve axteam/GLM-4.7-Flash-FP8-dynamic --max-model-len 32768λ‘ OpenAI νΈν μλ²(ν¬νΈ 8000), λλ PythonLLM(model="axteam/GLM-4.7-Flash-FP8-dynamic").chat(...)(μ μμ). κΆμ₯ μνλ§temperature=1.0. thinking λκΈ°:chat_template_kwargs={"enable_thinking": False}. - KV μΊμ μ κ°(λ°νμ) β
--kv-cache-dtype fp8.
- Downloads last month
- -
Model tree for axteam/GLM-4.7-Flash-FP8-dynamic
Base model
zai-org/GLM-4.7-Flash