Make Baseten deployment work from a clean account
Browse files- README.md +51 -14
- truss/config_nvfp4.yaml +10 -11
- truss/config_nvfp4_4gpu.yaml +12 -14
README.md
CHANGED
|
@@ -36,12 +36,13 @@ token space.
|
|
| 36 |
|
| 37 |
## Quickstart
|
| 38 |
|
| 39 |
-
SGLang needs a small out-of-tree plugin
|
| 40 |
upstream architecture. It ships inside this repo, so there is nothing else to clone:
|
| 41 |
|
| 42 |
```bash
|
| 43 |
-
hf download baseten/GLM-5.2-Vision-NVFP4
|
| 44 |
-
|
|
|
|
| 45 |
```
|
| 46 |
|
| 47 |
### SGLang
|
|
@@ -50,7 +51,7 @@ pip install ./glm5v/plugins
|
|
| 50 |
export SGLANG_EXTERNAL_MODEL_PACKAGE=sglang_glm5v
|
| 51 |
export SGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE=sglang_glm5v
|
| 52 |
export SGLANG_EXTERNAL_MM_MODEL_ARCH=Glm5vForConditionalGeneration
|
| 53 |
-
python -m sglang_glm5v.patch
|
| 54 |
```
|
| 55 |
|
| 56 |
#### 8×B200 — full 1M context
|
|
@@ -91,7 +92,7 @@ python -m sglang.launch_server \
|
|
| 91 |
|
| 92 |
### Query it
|
| 93 |
|
| 94 |
-
Standard OpenAI multimodal messages
|
| 95 |
|
| 96 |
```python
|
| 97 |
from openai import OpenAI
|
|
@@ -108,28 +109,64 @@ r = client.chat.completions.create(
|
|
| 108 |
print(r.choices[0].message.content)
|
| 109 |
```
|
| 110 |
|
| 111 |
-
GLM-5.2 is a reasoning model: with `--reasoning-parser glm45` the chain of thought arrives in
|
| 112 |
`message.reasoning_content` and the answer in `message.content`.
|
| 113 |
|
| 114 |
## Deploy on Baseten
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
```bash
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
cd glm5v/truss
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
```
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
| 127 |
|
| 128 |
```bash
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
```
|
| 132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
## License
|
| 134 |
|
| 135 |
MIT, following both parents: GLM-5.2 (MIT) and Kimi-K2.6 (Modified MIT). The projector weights
|
|
|
|
| 36 |
|
| 37 |
## Quickstart
|
| 38 |
|
| 39 |
+
SGLang needs a small out-of-tree plugin because `Glm5vForConditionalGeneration` is not yet an
|
| 40 |
upstream architecture. It ships inside this repo, so there is nothing else to clone:
|
| 41 |
|
| 42 |
```bash
|
| 43 |
+
uvx --from huggingface-hub hf download baseten/GLM-5.2-Vision-NVFP4 \
|
| 44 |
+
--include 'plugins/*' --local-dir ./glm5v
|
| 45 |
+
uv pip install ./glm5v/plugins
|
| 46 |
```
|
| 47 |
|
| 48 |
### SGLang
|
|
|
|
| 51 |
export SGLANG_EXTERNAL_MODEL_PACKAGE=sglang_glm5v
|
| 52 |
export SGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE=sglang_glm5v
|
| 53 |
export SGLANG_EXTERNAL_MM_MODEL_ARCH=Glm5vForConditionalGeneration
|
| 54 |
+
python -m sglang_glm5v.patch
|
| 55 |
```
|
| 56 |
|
| 57 |
#### 8×B200 — full 1M context
|
|
|
|
| 92 |
|
| 93 |
### Query it
|
| 94 |
|
| 95 |
+
Standard OpenAI multimodal messages deliver the image as `image_url`:
|
| 96 |
|
| 97 |
```python
|
| 98 |
from openai import OpenAI
|
|
|
|
| 109 |
print(r.choices[0].message.content)
|
| 110 |
```
|
| 111 |
|
| 112 |
+
GLM-5.2 is a reasoning model: with `--reasoning-parser glm45`, the chain of thought arrives in
|
| 113 |
`message.reasoning_content` and the answer in `message.content`.
|
| 114 |
|
| 115 |
## Deploy on Baseten
|
| 116 |
|
| 117 |
+
The repository includes ready-to-push [Truss](https://truss.baseten.co) configs. The only
|
| 118 |
+
credential you need is an API key for your own Baseten account; no Hugging Face token or
|
| 119 |
+
pre-created Baseten secret is required.
|
| 120 |
+
|
| 121 |
+
1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and create a Baseten API key.
|
| 122 |
+
2. Export the key, download the small Truss directory, and deploy one of the two configurations:
|
| 123 |
|
| 124 |
```bash
|
| 125 |
+
export BASETEN_API_KEY="your-baseten-api-key"
|
| 126 |
+
uvx truss login --api-key "$BASETEN_API_KEY" --remote baseten --non-interactive
|
| 127 |
+
|
| 128 |
+
uvx --from huggingface-hub hf download baseten/GLM-5.2-Vision-NVFP4 \
|
| 129 |
+
--include 'truss/*' --local-dir ./glm5v
|
| 130 |
cd glm5v/truss
|
| 131 |
+
|
| 132 |
+
# Recommended starting point: 4×B200 and 256k context.
|
| 133 |
+
uvx truss push --remote baseten --config config_nvfp4_4gpu.yaml --wait --output json
|
| 134 |
+
|
| 135 |
+
# Or use 8×B200 for the full 1M-token context.
|
| 136 |
+
# uvx truss push --remote baseten --config config_nvfp4.yaml --wait --output json
|
| 137 |
```
|
| 138 |
|
| 139 |
+
The command creates a new model and published deployment in your Baseten account and prints
|
| 140 |
+
JSON containing `model_id`, `model_version_id`, `predict_url`, and `logs_url`. It does not
|
| 141 |
+
promote the deployment to production.
|
| 142 |
+
|
| 143 |
+
Set `PREDICT_URL` to the returned `predict_url`, then run a multimodal smoke test:
|
| 144 |
|
| 145 |
```bash
|
| 146 |
+
export PREDICT_URL="https://model-...api.baseten.co/deployment/.../predict"
|
| 147 |
+
|
| 148 |
+
curl -fsS "$PREDICT_URL" \
|
| 149 |
+
-H "Authorization: Api-Key $BASETEN_API_KEY" \
|
| 150 |
+
-H "Content-Type: application/json" \
|
| 151 |
+
-d '{
|
| 152 |
+
"model": "glm-5.2-vision",
|
| 153 |
+
"messages": [{
|
| 154 |
+
"role": "user",
|
| 155 |
+
"content": [
|
| 156 |
+
{"type": "image_url", "image_url": {"url": "https://ultralytics.com/images/bus.jpg"}},
|
| 157 |
+
{"type": "text", "text": "Describe this image in detail."}
|
| 158 |
+
]
|
| 159 |
+
}],
|
| 160 |
+
"max_tokens": 512,
|
| 161 |
+
"temperature": 1.0,
|
| 162 |
+
"top_p": 0.95
|
| 163 |
+
}'
|
| 164 |
```
|
| 165 |
|
| 166 |
+
The first deployment downloads about 466 GB of weights and initializes SGLang, so startup can
|
| 167 |
+
take several minutes. If Baseten reports a transient infrastructure or download error, retry the
|
| 168 |
+
same push; no configuration change or additional credential should be necessary.
|
| 169 |
+
|
| 170 |
## License
|
| 171 |
|
| 172 |
MIT, following both parents: GLM-5.2 (MIT) and Kimi-K2.6 (Modified MIT). The projector weights
|
truss/config_nvfp4.yaml
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
|
|
|
|
|
| 1 |
model_name: glm-5.2-vision-nvfp4
|
|
|
|
| 2 |
model_metadata:
|
| 3 |
example_model_input:
|
| 4 |
-
model: glm-5.2-vision
|
| 5 |
messages:
|
| 6 |
- role: user
|
| 7 |
content:
|
|
@@ -17,14 +20,13 @@ model_metadata:
|
|
| 17 |
- openai-compatible
|
| 18 |
|
| 19 |
# Deploy GLM-5.2-Vision (NVFP4 build) on Baseten with Truss.
|
| 20 |
-
# truss push --config config_nvfp4.yaml
|
| 21 |
#
|
| 22 |
-
#
|
| 23 |
-
#
|
| 24 |
-
#
|
| 25 |
-
#
|
| 26 |
#
|
| 27 |
-
# To deploy: truss push --remote <your-remote>
|
| 28 |
base_image:
|
| 29 |
# SGLang 0.5.13, CUDA 13, Blackwell (sm_100). Ships the DSA sparse-attention and
|
| 30 |
# trtllm-gen fp4-MoE kernels this checkpoint needs.
|
|
@@ -39,7 +41,7 @@ docker_server:
|
|
| 39 |
server_port: 8000
|
| 40 |
|
| 41 |
model_cache:
|
| 42 |
-
#
|
| 43 |
- repo_id: baseten/GLM-5.2-Vision-NVFP4
|
| 44 |
revision: main
|
| 45 |
volume_folder: glm5v_nvfp4
|
|
@@ -51,9 +53,6 @@ environment_variables:
|
|
| 51 |
GLM5V_CKPT: /app/model_cache/glm5v_nvfp4
|
| 52 |
GLM5V_QUANTIZATION: modelopt_fp4
|
| 53 |
|
| 54 |
-
secrets:
|
| 55 |
-
hf_access_token: null
|
| 56 |
-
|
| 57 |
resources:
|
| 58 |
accelerator: B200:8
|
| 59 |
use_gpu: true
|
|
|
|
| 1 |
+
# yaml-language-server: $schema=https://raw.githubusercontent.com/basetenlabs/truss/main/truss/config.schema.json
|
| 2 |
+
|
| 3 |
model_name: glm-5.2-vision-nvfp4
|
| 4 |
+
description: GLM-5.2-Vision NVFP4 with 1M context on 8 B200 GPUs.
|
| 5 |
model_metadata:
|
| 6 |
example_model_input:
|
| 7 |
+
model: glm-5.2-vision
|
| 8 |
messages:
|
| 9 |
- role: user
|
| 10 |
content:
|
|
|
|
| 20 |
- openai-compatible
|
| 21 |
|
| 22 |
# Deploy GLM-5.2-Vision (NVFP4 build) on Baseten with Truss.
|
| 23 |
+
# uvx truss push --config config_nvfp4.yaml
|
| 24 |
#
|
| 25 |
+
# There is no checkpoint assembly here: the public Hugging Face repo below is
|
| 26 |
+
# already the fully assembled checkpoint (GLM-5.2 text + MoonViT vision tower +
|
| 27 |
+
# trained projector + processor remote code), so start_server.sh only installs
|
| 28 |
+
# the plugin and launches SGLang.
|
| 29 |
#
|
|
|
|
| 30 |
base_image:
|
| 31 |
# SGLang 0.5.13, CUDA 13, Blackwell (sm_100). Ships the DSA sparse-attention and
|
| 32 |
# trtllm-gen fp4-MoE kernels this checkpoint needs.
|
|
|
|
| 41 |
server_port: 8000
|
| 42 |
|
| 43 |
model_cache:
|
| 44 |
+
# Public Hugging Face repo: no Hugging Face token or Baseten secret is needed.
|
| 45 |
- repo_id: baseten/GLM-5.2-Vision-NVFP4
|
| 46 |
revision: main
|
| 47 |
volume_folder: glm5v_nvfp4
|
|
|
|
| 53 |
GLM5V_CKPT: /app/model_cache/glm5v_nvfp4
|
| 54 |
GLM5V_QUANTIZATION: modelopt_fp4
|
| 55 |
|
|
|
|
|
|
|
|
|
|
| 56 |
resources:
|
| 57 |
accelerator: B200:8
|
| 58 |
use_gpu: true
|
truss/config_nvfp4_4gpu.yaml
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
|
|
|
|
|
| 1 |
model_name: glm-5.2-vision-nvfp4-4gpu
|
|
|
|
| 2 |
model_metadata:
|
| 3 |
example_model_input:
|
| 4 |
-
model: glm-5.2-vision
|
| 5 |
messages:
|
| 6 |
- role: user
|
| 7 |
content:
|
|
@@ -16,19 +19,17 @@ model_metadata:
|
|
| 16 |
tags:
|
| 17 |
- openai-compatible
|
| 18 |
|
| 19 |
-
# Deploy GLM-5.2-Vision (NVFP4 build) on
|
| 20 |
-
# truss push --config config_nvfp4_4gpu.yaml
|
| 21 |
#
|
| 22 |
-
#
|
| 23 |
# at mem-fraction 0.90 and a 256k context rather than the full 1M. Measured on
|
| 24 |
# 4xB200: ~172GB/GPU resident, KV budget ~973k tokens — comfortably above 256k.
|
| 25 |
#
|
| 26 |
-
#
|
| 27 |
-
#
|
| 28 |
-
#
|
| 29 |
-
#
|
| 30 |
-
#
|
| 31 |
-
# To deploy: truss push --remote <your-remote>
|
| 32 |
base_image:
|
| 33 |
# SGLang 0.5.13, CUDA 13, Blackwell (sm_100). Ships the DSA sparse-attention and
|
| 34 |
# trtllm-gen fp4-MoE kernels this checkpoint needs.
|
|
@@ -43,7 +44,7 @@ docker_server:
|
|
| 43 |
server_port: 8000
|
| 44 |
|
| 45 |
model_cache:
|
| 46 |
-
#
|
| 47 |
- repo_id: baseten/GLM-5.2-Vision-NVFP4
|
| 48 |
revision: main
|
| 49 |
volume_folder: glm5v_nvfp4
|
|
@@ -58,9 +59,6 @@ environment_variables:
|
|
| 58 |
GLM5V_MAX_MODEL_LEN: "262144"
|
| 59 |
GLM5V_MEM_FRACTION: "0.90"
|
| 60 |
|
| 61 |
-
secrets:
|
| 62 |
-
hf_access_token: null
|
| 63 |
-
|
| 64 |
resources:
|
| 65 |
accelerator: B200:4
|
| 66 |
use_gpu: true
|
|
|
|
| 1 |
+
# yaml-language-server: $schema=https://raw.githubusercontent.com/basetenlabs/truss/main/truss/config.schema.json
|
| 2 |
+
|
| 3 |
model_name: glm-5.2-vision-nvfp4-4gpu
|
| 4 |
+
description: GLM-5.2-Vision NVFP4 with 256k context on 4 B200 GPUs.
|
| 5 |
model_metadata:
|
| 6 |
example_model_input:
|
| 7 |
+
model: glm-5.2-vision
|
| 8 |
messages:
|
| 9 |
- role: user
|
| 10 |
content:
|
|
|
|
| 19 |
tags:
|
| 20 |
- openai-compatible
|
| 21 |
|
| 22 |
+
# Deploy GLM-5.2-Vision (NVFP4 build) on four B200s instead of eight.
|
| 23 |
+
# uvx truss push --config config_nvfp4_4gpu.yaml
|
| 24 |
#
|
| 25 |
+
# 466GB of NVFP4 weights across 4x183GB leaves ~11GB/GPU of headroom, so this runs
|
| 26 |
# at mem-fraction 0.90 and a 256k context rather than the full 1M. Measured on
|
| 27 |
# 4xB200: ~172GB/GPU resident, KV budget ~973k tokens — comfortably above 256k.
|
| 28 |
#
|
| 29 |
+
# There is no checkpoint assembly here: the public Hugging Face repo below is
|
| 30 |
+
# already the fully assembled checkpoint (GLM-5.2 text + MoonViT vision tower +
|
| 31 |
+
# trained projector + processor remote code), so start_server.sh only installs
|
| 32 |
+
# the plugin and launches SGLang.
|
|
|
|
|
|
|
| 33 |
base_image:
|
| 34 |
# SGLang 0.5.13, CUDA 13, Blackwell (sm_100). Ships the DSA sparse-attention and
|
| 35 |
# trtllm-gen fp4-MoE kernels this checkpoint needs.
|
|
|
|
| 44 |
server_port: 8000
|
| 45 |
|
| 46 |
model_cache:
|
| 47 |
+
# Public Hugging Face repo: no Hugging Face token or Baseten secret is needed.
|
| 48 |
- repo_id: baseten/GLM-5.2-Vision-NVFP4
|
| 49 |
revision: main
|
| 50 |
volume_folder: glm5v_nvfp4
|
|
|
|
| 59 |
GLM5V_MAX_MODEL_LEN: "262144"
|
| 60 |
GLM5V_MEM_FRACTION: "0.90"
|
| 61 |
|
|
|
|
|
|
|
|
|
|
| 62 |
resources:
|
| 63 |
accelerator: B200:4
|
| 64 |
use_gpu: true
|