How to use zai-org/GLM-4.6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/GLM-4.6") 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.6") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-4.6") 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]:]))
How to use zai-org/GLM-4.6 with vLLM:
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zai-org/GLM-4.6" # 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.6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'
docker model run hf.co/zai-org/GLM-4.6
How to use zai-org/GLM-4.6 with SGLang:
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zai-org/GLM-4.6" \ --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.6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'
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.6" \ --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.6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'
How to use zai-org/GLM-4.6 with Docker Model Runner:
设三角形 ABC 内接于圆 ω。在 B 和 C 处的 ω 的切线相交于点 D,且直线 AD 与 ω 再次相交于点 P。已知 AB=5、BC=9、AC=10,则 AP 可表示为分数形式 m/n,其中 m 和 n 为互质的整数。求 m+n。用这个问题问模型,模型大概率会陷入死循环。我是在z.ai网站直接测试的
这个问题问glm4.5,模型不会陷入死循环,并且能够给出正确解答。glm4.6的cot思考方式似乎改成了gemini 2.5 pro那样的1 2 3 4列举法,感觉rl需要再打磨下
· Sign up or log in to comment