Instructions to use cgg507/GLM-Steam-320B-A18B-v2a-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cgg507/GLM-Steam-320B-A18B-v2a-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="cgg507/GLM-Steam-320B-A18B-v2a-NVFP4") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("cgg507/GLM-Steam-320B-A18B-v2a-NVFP4") model = AutoModelForMultimodalLM.from_pretrained("cgg507/GLM-Steam-320B-A18B-v2a-NVFP4", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cgg507/GLM-Steam-320B-A18B-v2a-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cgg507/GLM-Steam-320B-A18B-v2a-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cgg507/GLM-Steam-320B-A18B-v2a-NVFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/cgg507/GLM-Steam-320B-A18B-v2a-NVFP4
- SGLang
How to use cgg507/GLM-Steam-320B-A18B-v2a-NVFP4 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 "cgg507/GLM-Steam-320B-A18B-v2a-NVFP4" \ --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": "cgg507/GLM-Steam-320B-A18B-v2a-NVFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "cgg507/GLM-Steam-320B-A18B-v2a-NVFP4" \ --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": "cgg507/GLM-Steam-320B-A18B-v2a-NVFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use cgg507/GLM-Steam-320B-A18B-v2a-NVFP4 with Docker Model Runner:
docker model run hf.co/cgg507/GLM-Steam-320B-A18B-v2a-NVFP4
GLM-Steam-320B-A18B-v2a-NVFP4
NVFP4 quant of TheDrummer/GLM-Steam-320B-A18B-v2a-TEST
(Glm5NextForConditionalGeneration, same architecture as GLM-5.3-Flash). The layout mirrors
RedHatAI/GLM-5.3-Flash-NVFP4, so it should load the same way in vLLM / nmoe.
Layout (compressed-tensors, mixed-precision, ~198 GB)
| Part | Format |
|---|---|
Routed experts, layers 3-44 (gate/up/down_proj) |
NVFP4 W4A4 (nvfp4-pack-quantized): FP4 E2M1 weights + activations, group 16, FP8 E4M3 group scales + FP32 global scale, static per-tensor input global scale |
| MTP layer 45 routed experts | FP8 E4M3 weights, block [128,128] BF16 scales, dynamic per-group(128) FP8 activations (model_mtp.safetensors) |
| Everything else (attention / KDA, indexer, shared experts, dense layers 0-2, router, lm_head, embeddings, vision tower) | BF16 (unchanged) |
Recipe
- llm-compressor 0.15.0, compressed-tensors 0.20.1, transformers 5.21.0
QuantizationModifierwithconfig_groupsmatching the RedHatAI recipe (tensor_groupstrategy, group 16,memoryless_minmaxweight observer,static_minmaxinput observer), targetsre:.*\.layers\.(?:[3-9]|[1-3][0-9]|4[0-4])\.mlp\.experts\..*(gate|up|down)_proj$; ignorere:.*visual.*,lm_head,re:.*mlp\.gate$,re:.*self_attn\.indexer\..*- Sequential pipeline (one decoder layer at a time, CPU/disk offload),
moe_calibrate_all_experts=True(every expert sees every calibration token) - MTP experts (layer 45) were not calibrated (llm-compressor doesn't support MTP calibration); they were FP8 block-quantized data-free afterwards, matching the RedHatAI checkpoint's MTP format
Calibration data
256 samples, max 2048 tokens each (386k tokens total, mean ~1.5k), formatted with the model's chat template:
- 128 x HuggingFaceH4/ultrachat_200k (train_sft, shuffled seed 0)
- 96 x Gryphe/Sonnet3.5-Charcard-Roleplay (multi-turn character roleplay)
- 32 x Gryphe/Opus-WritingPrompts (creative writing)
Status
Untested beyond offline checks: tensor layout, dequantization error against the BF16 weights, and a config parse. No vLLM or generation test was run (the 1x L40S quant box can't hold the ~198 GB checkpoint).
Offline check results: all 36,288 NVFP4 expert linears and 864 FP8 MTP expert linears are present, and every source module is accounted for. Sampled NVFP4 experts from layers 3/4/10/22/33/44 dequantize with mean relative error 0.092 (cos ~0.996) against BF16. FP8 MTP experts dequantize with relative error ~0.026. Non-quantized tensors are bit-identical to the source.
- Downloads last month
- 177
Model tree for cgg507/GLM-Steam-320B-A18B-v2a-NVFP4
Base model
zai-org/GLM-5.3-Flash