Instructions to use zai-org/GLM-4.5-Air-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-Air-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-Air-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-Air-FP8") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-4.5-Air-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-Air-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-Air-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-Air-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zai-org/GLM-4.5-Air-FP8
- SGLang
How to use zai-org/GLM-4.5-Air-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-Air-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-Air-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-Air-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-Air-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zai-org/GLM-4.5-Air-FP8 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-4.5-Air-FP8
glm looping on \n
Hey guys ,
Been spinning up GLM-4.5-air lately and i make him generate some structured output. Sometimes (not constantly) it just gets stuck after one of the field names generating '\n' in loop
For inference parameters i use :
{"extra_body": {'repetition_penalty': 1.05,'length_penalty': 1.05}}
{"temperature": 0.6, "top_p": 0.95,"max_tokens": 16384}
I use vllm
Anyone encountered such issue or has an idea?
Thx!
It seems you're using an incorrect vLLM version. Try using the latest version. Are you using the version with FP8? And what's your TP?
Hey thanks for the answer!
I'm using vllm==0.10.1.1 , will try 10.2
I use fp8 version, yeah I expect quantization do not help in those issues.
About Tensor parallelism i use simply one H200 with 64k of context .
Don't get me wrong in most of cases the model is doing a great job, just its shame sometimes he gets stuck in a loop like that .
If you're using the FP8 version, you should definitely update and try it out, as this version had some bugs that have been fixed in version 0.10.2.
Oh nice i did not get the chance to try yet but will keep you updated !