Image-Text-to-Text
Transformers
Safetensors
English
Chinese
glm5_next
nvfp4
fp4
vllm
llm-compressor
compressed-tensors
expert-pruning
reap
conversational
8-bit precision
Instructions to use inference-optimization/GLM-5.3-Flash-NVFP4-REAP25 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inference-optimization/GLM-5.3-Flash-NVFP4-REAP25 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="inference-optimization/GLM-5.3-Flash-NVFP4-REAP25") 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("inference-optimization/GLM-5.3-Flash-NVFP4-REAP25") model = AutoModelForMultimodalLM.from_pretrained("inference-optimization/GLM-5.3-Flash-NVFP4-REAP25", 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 inference-optimization/GLM-5.3-Flash-NVFP4-REAP25 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25", "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/inference-optimization/GLM-5.3-Flash-NVFP4-REAP25
- SGLang
How to use inference-optimization/GLM-5.3-Flash-NVFP4-REAP25 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 "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25" \ --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": "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25", "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 "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25" \ --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": "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25", "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 inference-optimization/GLM-5.3-Flash-NVFP4-REAP25 with Docker Model Runner:
docker model run hf.co/inference-optimization/GLM-5.3-Flash-NVFP4-REAP25
|
Download README.md from inference-optimization/GLM-5.3-Flash-NVFP4-REAP25: direct link, hf CLI and curl.
- Browser
- Download file 2.41 kB
-
https://huggingface.co/inference-optimization/GLM-5.3-Flash-NVFP4-REAP25/resolve/main/README.md
- Command line
-
hf download hf://inference-optimization/GLM-5.3-Flash-NVFP4-REAP25/README.md
-
curl -L -o README.md https://huggingface.co/inference-optimization/GLM-5.3-Flash-NVFP4-REAP25/resolve/main/README.md
2.41 kB
| language: | |
| - en | |
| - zh | |
| library_name: transformers | |
| pipeline_tag: image-text-to-text | |
| tags: | |
| - nvfp4 | |
| - fp4 | |
| - vllm | |
| - llm-compressor | |
| - compressed-tensors | |
| - glm5_next | |
| - expert-pruning | |
| - reap | |
| base_model: | |
| - RedHatAI/GLM-5.3-Flash-NVFP4 | |
| license: mit | |
| license_link: https://choosealicense.com/licenses/mit/ | |
| # GLM-5.3-Flash-NVFP4-REAP25 | |
| [RedHatAI/GLM-5.3-Flash-NVFP4](https://huggingface.co/RedHatAI/GLM-5.3-Flash-NVFP4) | |
| (a NVFP4 quantization of | |
| [zai-org/GLM-5.3-Flash](https://huggingface.co/zai-org/GLM-5.3-Flash)) with 25% | |
| of its MoE experts structurally pruned with **REAP** (PRUNE method), produced | |
| with [llmcompressor](https://github.com/vllm-project/llm-compressor). | |
| - Every one of the 42 MoE layers (backbone layers 3-44) keeps its **216 most | |
| salient experts** of the original 288 (72 pruned per layer, 9072 of 12096 | |
| retained) | |
| - Expert selection is uniform across layers: each layer's 72 lowest-REAP-saliency | |
| experts were removed, and the routers and their `e_score_correction_bias` | |
| were sliced to match | |
| - `config.json` records the new expert count (`n_routed_experts: 216`); expert | |
| indices are remapped contiguously | |
| - The quantization is unchanged from the source checkpoint: MoE experts remain | |
| NVFP4-quantized and the MTP layer (`layers.45`) is left untouched, keeping | |
| its original 288 FP8-quantized experts (Transformers ignores `layers.45` when | |
| loading, so this matches the source model's serving behavior) | |
| - All remaining weights (including attention, vision tower, embeddings and the | |
| shared experts) are untouched | |
| REAP scores each expert by the router-weighted mean of its output activation | |
| norms over the calibration tokens routed to it, | |
| `S_j = mean(g_j * ||f_j||_2)`, using forward computation only (no gradients or | |
| recovery training). This model was calibrated on all 2,048 samples of the | |
| [RazorCal](https://huggingface.co/datasets/inference-optimization/RazorCal) | |
| multi-domain calibration corpus; see the | |
| [REAP expert pruning example](https://github.com/vllm-project/llm-compressor/tree/main/examples/reap_expert_pruning) | |
| for the calibration and pruning scripts. | |
| ## Usage | |
| ```python | |
| from transformers import AutoProcessor, Glm5NextForConditionalGeneration | |
| model = Glm5NextForConditionalGeneration.from_pretrained( | |
| "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25" | |
| ) | |
| processor = AutoProcessor.from_pretrained( | |
| "inference-optimization/GLM-5.3-Flash-NVFP4-REAP25" | |
| ) | |
| ``` | |