Instructions to use unsloth/GLM-5-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/GLM-5-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/GLM-5-FP8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/GLM-5-FP8") model = AutoModelForCausalLM.from_pretrained("unsloth/GLM-5-FP8", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/GLM-5-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/GLM-5-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": "unsloth/GLM-5-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/GLM-5-FP8
- SGLang
How to use unsloth/GLM-5-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 "unsloth/GLM-5-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": "unsloth/GLM-5-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 "unsloth/GLM-5-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": "unsloth/GLM-5-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use unsloth/GLM-5-FP8 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/GLM-5-FP8 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/GLM-5-FP8 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/GLM-5-FP8 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="unsloth/GLM-5-FP8", max_seq_length=2048, ) - Docker Model Runner
How to use unsloth/GLM-5-FP8 with Docker Model Runner:
docker model run hf.co/unsloth/GLM-5-FP8
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,13 +1,42 @@
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
library_name: transformers
|
| 6 |
license: mit
|
| 7 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
# GLM-5
|
| 11 |
|
| 12 |
<div align="center">
|
| 13 |
<img src=https://raw.githubusercontent.com/zai-org/GLM-5/refs/heads/main/resources/logo.svg width="15%"/>
|
|
@@ -136,7 +165,7 @@ vLLM, SGLang, and xLLM all support local deployment of GLM-5. A simple deploymen
|
|
| 136 |
--mem-fraction-static 0.85 \
|
| 137 |
--served-model-name glm-5-fp8
|
| 138 |
```
|
| 139 |
-
|
| 140 |
Check the [sglang cookbook](https://cookbook.sglang.io/autoregressive/GLM/GLM-5) for more details.
|
| 141 |
|
| 142 |
+ xLLM and other Ascend NPU
|
|
|
|
| 1 |
---
|
| 2 |
language:
|
| 3 |
+
- en
|
| 4 |
+
- zh
|
| 5 |
library_name: transformers
|
| 6 |
license: mit
|
| 7 |
pipeline_tag: text-generation
|
| 8 |
+
base_model:
|
| 9 |
+
- zai-org/GLM-5
|
| 10 |
+
tags:
|
| 11 |
+
- unsloth
|
| 12 |
+
- glm_moe_dsa
|
| 13 |
+
---
|
| 14 |
+
<div>
|
| 15 |
+
<p style="margin-bottom: 0; margin-top: 0;">
|
| 16 |
+
<h1 style="margin-top: 0rem;">See how to run GLM-5 locally - <a href="https://docs.unsloth.ai/models/glm-5">Read our Guide!</a></h1>
|
| 17 |
+
</p>
|
| 18 |
+
<p style="margin-top: 0;margin-bottom: 0;">
|
| 19 |
+
<em><a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0</a> achieves superior accuracy & outperforms other leading quants.</em>
|
| 20 |
+
</p>
|
| 21 |
+
<div style="margin-top: 0;display: flex; gap: 5px; align-items: center; ">
|
| 22 |
+
<a href="https://github.com/unslothai/unsloth/">
|
| 23 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
|
| 24 |
+
</a>
|
| 25 |
+
<a href="https://discord.gg/unsloth">
|
| 26 |
+
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
| 27 |
+
</a>
|
| 28 |
+
<a href="https://docs.unsloth.ai/models/glm-5">
|
| 29 |
+
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
| 30 |
+
</a>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
To run, you must install llama.cpp [PR 19460](https://github.com/ggml-org/llama.cpp/pull/19460).<br>
|
| 35 |
+
You can follow instructions in our [guide here](https://unsloth.ai/docs/models/glm-5#run-glm-5-tutorials).
|
| 36 |
+
|
| 37 |
---
|
| 38 |
|
| 39 |
+
# GLM-5
|
| 40 |
|
| 41 |
<div align="center">
|
| 42 |
<img src=https://raw.githubusercontent.com/zai-org/GLM-5/refs/heads/main/resources/logo.svg width="15%"/>
|
|
|
|
| 165 |
--mem-fraction-static 0.85 \
|
| 166 |
--served-model-name glm-5-fp8
|
| 167 |
```
|
| 168 |
+
|
| 169 |
Check the [sglang cookbook](https://cookbook.sglang.io/autoregressive/GLM/GLM-5) for more details.
|
| 170 |
|
| 171 |
+ xLLM and other Ascend NPU
|