Instructions to use zai-org/GLM-4-32B-Base-0414 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-4-32B-Base-0414 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/GLM-4-32B-Base-0414")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zai-org/GLM-4-32B-Base-0414") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-4-32B-Base-0414", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zai-org/GLM-4-32B-Base-0414 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-32B-Base-0414" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-4-32B-Base-0414", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zai-org/GLM-4-32B-Base-0414
- SGLang
How to use zai-org/GLM-4-32B-Base-0414 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-32B-Base-0414" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-4-32B-Base-0414", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-32B-Base-0414" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-4-32B-Base-0414", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use zai-org/GLM-4-32B-Base-0414 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-4-32B-Base-0414
zRzRzRzRzRzRzR commited on
Commit ·
ca8ed56
1
Parent(s): 0188da0
LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
MIT License
|
| 2 |
|
| 3 |
-
Copyright (c) 2025
|
| 4 |
|
| 5 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
| 1 |
MIT License
|
| 2 |
|
| 3 |
+
Copyright (c) 2025 Zhipu AI
|
| 4 |
|
| 5 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
of this software and associated documentation files (the "Software"), to deal
|
README.md
CHANGED
|
@@ -13,4 +13,8 @@ library_name: transformers
|
|
| 13 |
|
| 14 |
Based on our latest technological advancements, we have trained a `GLM-4-0414` series model. During pretraining, we incorporated more code-related and reasoning-related data. In the alignment phase, we optimized the model specifically for agent capabilities. As a result, the model's performance in agent tasks such as tool use, web search, and coding has been significantly improved.
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
This model is a base model. If you need a chat model, please use the [GLM-4-32B-Chat-0414](https://huggingface.co/THUDM/GLM-4-32B-Chat-0414) chat model.
|
|
|
|
| 13 |
|
| 14 |
Based on our latest technological advancements, we have trained a `GLM-4-0414` series model. During pretraining, we incorporated more code-related and reasoning-related data. In the alignment phase, we optimized the model specifically for agent capabilities. As a result, the model's performance in agent tasks such as tool use, web search, and coding has been significantly improved.
|
| 15 |
|
| 16 |
+
## Inference Code
|
| 17 |
+
|
| 18 |
+
Make Sure Using `transforemrs>=4.51.3`.
|
| 19 |
+
|
| 20 |
This model is a base model. If you need a chat model, please use the [GLM-4-32B-Chat-0414](https://huggingface.co/THUDM/GLM-4-32B-Chat-0414) chat model.
|