Instructions to use inference-optimization/GLM-5.3-Flash-NVFP4-REAP20 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-REAP20 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-REAP20") 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-REAP20") model = AutoModelForMultimodalLM.from_pretrained("inference-optimization/GLM-5.3-Flash-NVFP4-REAP20", 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-REAP20 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-REAP20" # 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-REAP20", "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-REAP20
- SGLang
How to use inference-optimization/GLM-5.3-Flash-NVFP4-REAP20 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-REAP20" \ --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-REAP20", "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-REAP20" \ --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-REAP20", "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-REAP20 with Docker Model Runner:
docker model run hf.co/inference-optimization/GLM-5.3-Flash-NVFP4-REAP20
GLM-5.3-Flash-NVFP4-REAP20
RedHatAI/GLM-5.3-Flash-NVFP4 (a NVFP4 quantization of zai-org/GLM-5.3-Flash) with 20% of its MoE experts structurally pruned with REAP (PRUNE method), produced with llmcompressor.
- Every one of the 42 MoE layers (backbone layers 3-44) keeps its 230 most salient experts of the original 288 (58 pruned per layer, 9660 of 12096 retained)
- Expert selection is uniform across layers: each layer's 58 lowest-REAP-saliency
experts were removed, and the routers and their
e_score_correction_biaswere sliced to match config.jsonrecords the new expert count (n_routed_experts: 230); 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 ignoreslayers.45when 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
multi-domain calibration corpus; see the
REAP expert pruning example
for the calibration and pruning scripts.
Usage
from transformers import AutoProcessor, Glm5NextForConditionalGeneration
model = Glm5NextForConditionalGeneration.from_pretrained(
"inference-optimization/GLM-5.3-Flash-NVFP4-REAP20"
)
processor = AutoProcessor.from_pretrained(
"inference-optimization/GLM-5.3-Flash-NVFP4-REAP20"
)
- Downloads last month
- 37