Instructions to use zai-org/glm-4-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/glm-4-9b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/glm-4-9b", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zai-org/glm-4-9b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zai-org/glm-4-9b 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-9b" # 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-9b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zai-org/glm-4-9b
- SGLang
How to use zai-org/glm-4-9b 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-9b" \ --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-9b", "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-9b" \ --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-9b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use zai-org/glm-4-9b with Docker Model Runner:
docker model run hf.co/zai-org/glm-4-9b
Ubuntu commited on
Commit ·
b7588ac
1
Parent(s): b36f158
english readme
Browse files- README.md +1 -1
- README_en.md +1 -1
README.md
CHANGED
|
@@ -35,7 +35,7 @@ GLM-4V-9B。**GLM-4V-9B** 具备 1120 * 1120 高分辨率下的中英双语多
|
|
| 35 |
| GLM-4-9B | **74.7** | **77.1** | **34.3** | **84.0** | **30.4** | **70.1** |
|
| 36 |
|
| 37 |
|
| 38 |
-
**
|
| 39 |
|
| 40 |
## 协议
|
| 41 |
|
|
|
|
| 35 |
| GLM-4-9B | **74.7** | **77.1** | **34.3** | **84.0** | **30.4** | **70.1** |
|
| 36 |
|
| 37 |
|
| 38 |
+
**本仓库是 GLM-4-9B 的基座版本,支持`8K`上下文长度。**
|
| 39 |
|
| 40 |
## 协议
|
| 41 |
|
README_en.md
CHANGED
|
@@ -24,7 +24,7 @@ We evaluated the GLM-4-9B base model on some typical tasks, and the results are
|
|
| 24 |
| ChatGLM3-6B-Base | 61.4 | 69.0 | - | 72.3 | 25.7 | - |
|
| 25 |
| GLM-4-9B | **74.7** | **77.1** | **34.3** | **84.0** | **30.4** | **70.1** |
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
## LICENSE
|
| 30 |
|
|
|
|
| 24 |
| ChatGLM3-6B-Base | 61.4 | 69.0 | - | 72.3 | 25.7 | - |
|
| 25 |
| GLM-4-9B | **74.7** | **77.1** | **34.3** | **84.0** | **30.4** | **70.1** |
|
| 26 |
|
| 27 |
+
**This repository is the base version of GLM-4-9B, supporting 8K context length.**
|
| 28 |
|
| 29 |
## LICENSE
|
| 30 |
|