Image-Text-to-Text
Transformers
Safetensors
glm5_next
glm
glm-5
multimodal
vision-language
Mixture of Experts
sparse-attention
mla
quantization
rfa
rfi
rocm
rdna4
gfx1201
4-bit precision
conversational
8-bit precision
Instructions to use djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700") model = AutoModelForMultimodalLM.from_pretrained("djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700", "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/djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700
- SGLang
How to use djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700 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 "djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700" \ --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": "djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700", "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 "djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700" \ --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": "djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700", "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 djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700 with Docker Model Runner:
docker model run hf.co/djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: zai-org/GLM-5.3-Flash
|
| 4 |
+
tags:
|
| 5 |
+
- glm
|
| 6 |
+
- mla
|
| 7 |
+
- linear-attention
|
| 8 |
+
- moe
|
| 9 |
+
- multimodal
|
| 10 |
+
- rocm
|
| 11 |
+
- rdna4
|
| 12 |
+
- gfx1201
|
| 13 |
+
- rfa
|
| 14 |
+
- rfi
|
| 15 |
+
- amd
|
| 16 |
+
- text-generation
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# GLM-5.3-Flash RFA-RFI8 β FOR INFERENCE ON 8Γ R9700 (RDNA4/gfx1201)
|
| 20 |
+
|
| 21 |
+
A **self-quantized derivative** of
|
| 22 |
+
**[zai-org/GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash)** (321B MoE, β18B active),
|
| 23 |
+
quantized with a **RFA + RFI8 composite** and validated for serving on
|
| 24 |
+
**8Γ AMD Radeon R9700 (gfx1201 / RDNA4)**.
|
| 25 |
+
|
| 26 |
+
> β οΈ **Not compatible with stock vLLM.** This checkpoint uses the `rfi` composite quantizer and the
|
| 27 |
+
> `Glm5NextForConditionalGeneration` architecture on the RDNA4 path, which requires the patched
|
| 28 |
+
> vLLM + overlay in **[djdeniro/GLM-5.3-Flash-rocm-r9700](https://huggingface.co/djdeniro/GLM-5.3-Flash-rocm-r9700)**.
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## Model
|
| 33 |
+
|
| 34 |
+
- **Base:** [zai-org/GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash) β MIT license.
|
| 35 |
+
- **Architecture:** 321B MoE, β18B active; **45 layers = 34 KDA (linear attention) + 11 DSA
|
| 36 |
+
(sparse-MLA)**; mHC hidden-state compression; **native multimodal** (image + video); 1 nextn MTP
|
| 37 |
+
layer; 288 routed experts (top-8) + 1 shared expert.
|
| 38 |
+
- **Paper:** [arXiv:2602.15763](https://arxiv.org/abs/2602.15763).
|
| 39 |
+
|
| 40 |
+
## Quantization
|
| 41 |
+
|
| 42 |
+
| Scheme | Applied to | bpw |
|
| 43 |
+
|--------|-----------|-----|
|
| 44 |
+
| **RFA** | MoE routed experts | 4.5 |
|
| 45 |
+
| **RFI8** (int8 W8A8) | attention / shared / dense linears (structural) | 8.25 |
|
| 46 |
+
| **BF16** | dense copies + MTP layer | 16 |
|
| 47 |
+
|
| 48 |
+
Total **β197.8 GB** (25 safetensors shards). Full recipe (archspec, source patches, kda-remap,
|
| 49 |
+
run scripts) is in the code repo: **[djdeniro/GLM-5.3-Flash-rocm-r9700](https://huggingface.co/djdeniro/GLM-5.3-Flash-rocm-r9700)** (`quant/`).
|
| 50 |
+
|
| 51 |
+
## Quick start (8Γ R9700)
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
git clone https://huggingface.co/djdeniro/GLM-5.3-Flash-rocm-r9700 overlay
|
| 55 |
+
huggingface-cli download djdeniro/GLM-5.3-Flash-RFA-RFI8-8xR9700 --local-dir ./models
|
| 56 |
+
|
| 57 |
+
docker run --rm --tty --ipc=host --shm-size=128g \
|
| 58 |
+
--device /dev/kfd:/dev/kfd --device /dev/dri:/dev/dri \
|
| 59 |
+
-v "$PWD/models":/models:ro -v "$PWD/overlay":/overlay:ro \
|
| 60 |
+
--entrypoint bash tcclaviger/vllm:latest \
|
| 61 |
+
-c "/overlay/apply_overlay.sh && exec vllm serve /models \
|
| 62 |
+
--served-model-name glm53-flash --trust-remote-code --quantization rfi \
|
| 63 |
+
--tensor-parallel-size 8 --gpu-memory-utilization 0.95 \
|
| 64 |
+
--max-model-len 190080 --max-num-seqs 4 --kv-cache-dtype auto"
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Use `overlay/run-glm53.sh` (or `denet-large.sh` via llama-swap) for the full production command.
|
| 68 |
+
|
| 69 |
+
## Performance (8Γ R9700, gfx1201)
|
| 70 |
+
|
| 71 |
+
- **Decode:** β **34β37 t/s** at bs=1 (FULL cudagraph).
|
| 72 |
+
- **TTFT:** β **0.13β0.6 s** (prompt-dependent, `reasoning_effort="low"`).
|
| 73 |
+
- **Context:** **190k** tokens with bf16 KV.
|
| 74 |
+
|
| 75 |
+
## Multimodal
|
| 76 |
+
|
| 77 |
+
Images are resized preserving aspect ratio: **min 384Γ384** (upscale) / **max 1280Γ1280**
|
| 78 |
+
(downscale). The processor/video tower is the native Glm5Next multimodal path.
|
| 79 |
+
|
| 80 |
+
## Known limitations
|
| 81 |
+
|
| 82 |
+
- **MTP is OFF** β the nextn drafter is blocked by vLLM's kv-cache-group assertion.
|
| 83 |
+
- **Do NOT enable fp8 KV** (`--kv-cache-dtype fp8` + `--calculate-kv-scales`): runtime scale
|
| 84 |
+
calibration runs through an unwarmed KDA recurrent state on the profile dummy-run, producing
|
| 85 |
+
wrong `_k_scale` β hard output looping (upstream vLLM issue **#37554**). The checkpoint ships no
|
| 86 |
+
static KV scales β serve with **bf16 KV** (`--kv-cache-dtype auto`).
|
| 87 |
+
- **Chat:** send `reasoning_effort="low"` (the GLM-5.3 chat template defaults to Reasoning Effort
|
| 88 |
+
Max and over-thinks on long generations).
|
| 89 |
+
|
| 90 |
+
## License & attribution
|
| 91 |
+
|
| 92 |
+
- **License:** MIT.
|
| 93 |
+
- **Original model:** [zai-org/GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash) β Β© Z.ai
|
| 94 |
+
(zai-org), MIT license.
|
| 95 |
+
- **Paper:** [arXiv:2602.15763](https://arxiv.org/abs/2602.15763).
|