Instructions to use tiny-random/glm-5.3-flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/glm-5.3-flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/glm-5.3-flash") 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("tiny-random/glm-5.3-flash") model = AutoModelForMultimodalLM.from_pretrained("tiny-random/glm-5.3-flash", 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 tiny-random/glm-5.3-flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/glm-5.3-flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/glm-5.3-flash", "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/tiny-random/glm-5.3-flash
- SGLang
How to use tiny-random/glm-5.3-flash 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 "tiny-random/glm-5.3-flash" \ --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": "tiny-random/glm-5.3-flash", "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 "tiny-random/glm-5.3-flash" \ --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": "tiny-random/glm-5.3-flash", "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 tiny-random/glm-5.3-flash with Docker Model Runner:
docker model run hf.co/tiny-random/glm-5.3-flash
Download config.json from tiny-random/glm-5.3-flash: direct link, hf CLI and curl.
- Browser
- Download file 7.92 kB
-
https://huggingface.co/tiny-random/glm-5.3-flash/resolve/main/config.json
- Command line
-
hf download hf://tiny-random/glm-5.3-flash/config.json
-
curl -L -o config.json https://huggingface.co/tiny-random/glm-5.3-flash/resolve/main/config.json
7.92 kB
| { | |
| "architectures": [ | |
| "Glm5NextForConditionalGeneration" | |
| ], | |
| "text_config": { | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "dtype": "bfloat16", | |
| "eos_token_id": [ | |
| 154820, | |
| 154827, | |
| 154829 | |
| ], | |
| "first_k_dense_replace": 3, | |
| "hc_eps": 1e-06, | |
| "hc_mult": 4, | |
| "hc_sinkhorn_iters": 20, | |
| "head_dim": 0, | |
| "hidden_act": "silu", | |
| "hidden_size": 128, | |
| "index_head_dim": 128, | |
| "index_kpool": 4, | |
| "index_kpool_always_select_tail": true, | |
| "index_kpool_compress": true, | |
| "index_n_heads": 32, | |
| "index_topk": 128, | |
| "index_share_for_mtp_iteration": true, | |
| "indexer_rope_interleave": true, | |
| "indexer_types": [ | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full", | |
| "full" | |
| ], | |
| "initializer_range": 0.02, | |
| "intermediate_size": 128, | |
| "kv_lora_rank": 256, | |
| "layer_types": [ | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "indexed_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "linear_attention", | |
| "indexed_attention" | |
| ], | |
| "linear_attn_config": { | |
| "num_heads": 64, | |
| "gate_lower_bound": -5.0, | |
| "head_dim": 128, | |
| "short_conv_kernel_size": 4, | |
| "kda_layers": [ | |
| 0, | |
| 1, | |
| 2, | |
| 4, | |
| 5, | |
| 6 | |
| ], | |
| "full_attn_layers": [ | |
| 3, | |
| 7 | |
| ] | |
| }, | |
| "max_position_embeddings": 1048576, | |
| "mhc": true, | |
| "mla_use_nope": true, | |
| "mlp_layer_types": [ | |
| "dense", | |
| "dense", | |
| "dense", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse" | |
| ], | |
| "model_type": "glm5_next_text", | |
| "moe_intermediate_size": 128, | |
| "moe_router_dtype": "float32", | |
| "n_group": 1, | |
| "n_routed_experts": 32, | |
| "n_shared_experts": 1, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 64, | |
| "num_experts_per_tok": 8, | |
| "num_hidden_layers": 8, | |
| "num_key_value_heads": 64, | |
| "num_nextn_predict_layers": 1, | |
| "output_router_logits": false, | |
| "pad_token_id": 154820, | |
| "q_lora_rank": 128, | |
| "qk_head_dim": 256, | |
| "qk_nope_head_dim": 32, | |
| "qk_rope_head_dim": 0, | |
| "rms_norm_eps": 1e-05, | |
| "routed_scaling_factor": 2.5, | |
| "router_aux_loss_coef": 0.001, | |
| "scoring_func": "sigmoid", | |
| "swiglu_limit": 10.0, | |
| "tie_word_embeddings": false, | |
| "topk_group": 1, | |
| "topk_method": "noaux_tc", | |
| "use_cache": true, | |
| "v_head_dim": 256, | |
| "vocab_size": 154880, | |
| "linear_head_dim": 128 | |
| }, | |
| "vision_config": { | |
| "attention_bias": true, | |
| "attention_dropout": 0.0, | |
| "depth": 2, | |
| "hidden_act": "silu", | |
| "hidden_size": 128, | |
| "image_size": 28, | |
| "in_channels": 3, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 256, | |
| "model_type": "glm5_next_vision", | |
| "num_heads": 4, | |
| "out_hidden_size": 128, | |
| "patch_size": 14, | |
| "projection_intermediate_size": 64, | |
| "rms_norm_eps": 1e-05, | |
| "spatial_merge_size": 2, | |
| "swiglu_limit": 10.0, | |
| "temporal_patch_size": 2 | |
| }, | |
| "image_token_id": 154854, | |
| "video_token_id": 154855, | |
| "image_start_token_id": 154830, | |
| "image_end_token_id": 154831, | |
| "video_start_token_id": 154832, | |
| "video_end_token_id": 154833, | |
| "tie_word_embeddings": false, | |
| "model_type": "glm5_next", | |
| "transformers_version": "5.16.0", | |
| "quantization_config": { | |
| "activation_scheme": "dynamic", | |
| "fmt": "e4m3", | |
| "modules_to_not_convert": [ | |
| "lm_head", | |
| "model.language_model.embed_tokens", | |
| "model.language_model.layers.0.self_attn.b_proj", | |
| "model.language_model.layers.0.self_attn.forget_gate.f_a_proj", | |
| "model.language_model.layers.0.self_attn.forget_gate.f_b_proj", | |
| "model.language_model.layers.0.self_attn.g_a_proj", | |
| "model.language_model.layers.0.self_attn.g_b_proj", | |
| "model.language_model.layers.0.self_attn.k_proj", | |
| "model.language_model.layers.0.self_attn.o_proj", | |
| "model.language_model.layers.0.self_attn.q_proj", | |
| "model.language_model.layers.0.self_attn.v_proj", | |
| "model.language_model.layers.1.self_attn.b_proj", | |
| "model.language_model.layers.1.self_attn.forget_gate.f_a_proj", | |
| "model.language_model.layers.1.self_attn.forget_gate.f_b_proj", | |
| "model.language_model.layers.1.self_attn.g_a_proj", | |
| "model.language_model.layers.1.self_attn.g_b_proj", | |
| "model.language_model.layers.1.self_attn.k_proj", | |
| "model.language_model.layers.1.self_attn.o_proj", | |
| "model.language_model.layers.1.self_attn.q_proj", | |
| "model.language_model.layers.1.self_attn.v_proj", | |
| "model.language_model.layers.2.self_attn.b_proj", | |
| "model.language_model.layers.2.self_attn.forget_gate.f_a_proj", | |
| "model.language_model.layers.2.self_attn.forget_gate.f_b_proj", | |
| "model.language_model.layers.2.self_attn.g_a_proj", | |
| "model.language_model.layers.2.self_attn.g_b_proj", | |
| "model.language_model.layers.2.self_attn.k_proj", | |
| "model.language_model.layers.2.self_attn.o_proj", | |
| "model.language_model.layers.2.self_attn.q_proj", | |
| "model.language_model.layers.2.self_attn.v_proj", | |
| "model.language_model.layers.3.self_attn.indexer.weights_proj", | |
| "model.language_model.layers.3.self_attn.indexer.wk", | |
| "model.language_model.layers.3.self_attn.indexer.wq_b", | |
| "model.language_model.layers.3.self_attn.kv_b_proj", | |
| "model.language_model.layers.4.self_attn.b_proj", | |
| "model.language_model.layers.4.self_attn.forget_gate.f_a_proj", | |
| "model.language_model.layers.4.self_attn.forget_gate.f_b_proj", | |
| "model.language_model.layers.4.self_attn.g_a_proj", | |
| "model.language_model.layers.4.self_attn.g_b_proj", | |
| "model.language_model.layers.4.self_attn.k_proj", | |
| "model.language_model.layers.4.self_attn.o_proj", | |
| "model.language_model.layers.4.self_attn.q_proj", | |
| "model.language_model.layers.4.self_attn.v_proj", | |
| "model.language_model.layers.5.self_attn.b_proj", | |
| "model.language_model.layers.5.self_attn.forget_gate.f_a_proj", | |
| "model.language_model.layers.5.self_attn.forget_gate.f_b_proj", | |
| "model.language_model.layers.5.self_attn.g_a_proj", | |
| "model.language_model.layers.5.self_attn.g_b_proj", | |
| "model.language_model.layers.5.self_attn.k_proj", | |
| "model.language_model.layers.5.self_attn.o_proj", | |
| "model.language_model.layers.5.self_attn.q_proj", | |
| "model.language_model.layers.5.self_attn.v_proj", | |
| "model.language_model.layers.6.self_attn.b_proj", | |
| "model.language_model.layers.6.self_attn.forget_gate.f_a_proj", | |
| "model.language_model.layers.6.self_attn.forget_gate.f_b_proj", | |
| "model.language_model.layers.6.self_attn.g_a_proj", | |
| "model.language_model.layers.6.self_attn.g_b_proj", | |
| "model.language_model.layers.6.self_attn.k_proj", | |
| "model.language_model.layers.6.self_attn.o_proj", | |
| "model.language_model.layers.6.self_attn.q_proj", | |
| "model.language_model.layers.6.self_attn.v_proj", | |
| "model.language_model.layers.7.self_attn.indexer.weights_proj", | |
| "model.language_model.layers.7.self_attn.indexer.wk", | |
| "model.language_model.layers.7.self_attn.indexer.wq_b", | |
| "model.language_model.layers.7.self_attn.kv_b_proj", | |
| "model.visual", | |
| "model.visual.blocks.0.attn.proj", | |
| "model.visual.blocks.0.attn.qkv", | |
| "model.visual.blocks.0.mlp.down_proj", | |
| "model.visual.blocks.0.mlp.gate_proj", | |
| "model.visual.blocks.0.mlp.up_proj", | |
| "model.visual.blocks.1.attn.proj", | |
| "model.visual.blocks.1.attn.qkv", | |
| "model.visual.blocks.1.mlp.down_proj", | |
| "model.visual.blocks.1.mlp.gate_proj", | |
| "model.visual.blocks.1.mlp.up_proj", | |
| "model.visual.merger.down_proj", | |
| "model.visual.merger.gate_proj", | |
| "model.visual.merger.proj", | |
| "model.visual.merger.up_proj" | |
| ], | |
| "quant_method": "fp8", | |
| "weight_block_size": [ | |
| 32, | |
| 32 | |
| ] | |
| } | |
| } | |