Image-Text-to-Text
Transformers
Safetensors
Chinese
English
glm4v_moe
AWQ
vLLM
conversational
4-bit precision
awq_marlin
Instructions to use QuantTrio/GLM-4.5V-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantTrio/GLM-4.5V-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="QuantTrio/GLM-4.5V-AWQ") 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("QuantTrio/GLM-4.5V-AWQ") model = AutoModelForMultimodalLM.from_pretrained("QuantTrio/GLM-4.5V-AWQ", 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 QuantTrio/GLM-4.5V-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantTrio/GLM-4.5V-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantTrio/GLM-4.5V-AWQ", "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/QuantTrio/GLM-4.5V-AWQ
- SGLang
How to use QuantTrio/GLM-4.5V-AWQ 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 "QuantTrio/GLM-4.5V-AWQ" \ --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": "QuantTrio/GLM-4.5V-AWQ", "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 "QuantTrio/GLM-4.5V-AWQ" \ --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": "QuantTrio/GLM-4.5V-AWQ", "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 QuantTrio/GLM-4.5V-AWQ with Docker Model Runner:
docker model run hf.co/QuantTrio/GLM-4.5V-AWQ
| { | |
| "name_or_path": "tclf90/GLM-4.5V-AWQ", | |
| "architectures": [ | |
| "Glm4vMoeForConditionalGeneration" | |
| ], | |
| "model_type": "glm4v_moe", | |
| "text_config": { | |
| "pad_token_id": 151329, | |
| "vocab_size": 151552, | |
| "eos_token_id": [ | |
| 151329, | |
| 151336, | |
| 151338 | |
| ], | |
| "image_end_token_id": 151340, | |
| "image_start_token_id": 151339, | |
| "image_token_id": 151363, | |
| "head_dim": 128, | |
| "attention_bias": true, | |
| "attention_dropout": 0.0, | |
| "first_k_dense_replace": 1, | |
| "hidden_act": "silu", | |
| "hidden_size": 4096, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 11264, | |
| "max_position_embeddings": 65536, | |
| "model_type": "glm4v_moe_text", | |
| "moe_intermediate_size": 1408, | |
| "n_group": 1, | |
| "n_routed_experts": 128, | |
| "n_shared_experts": 1, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 96, | |
| "num_experts_per_tok": 8, | |
| "num_hidden_layers": 46, | |
| "num_key_value_heads": 8, | |
| "partial_rotary_factor": 0.5, | |
| "rms_norm_eps": 1e-05, | |
| "torch_dtype": "bfloat16", | |
| "rope_scaling": { | |
| "rope_type": "default", | |
| "mrope_section": [ | |
| 8, | |
| 12, | |
| 12 | |
| ] | |
| }, | |
| "rope_theta": 10000.0, | |
| "routed_scaling_factor": 1.0, | |
| "topk_group": 1, | |
| "use_cache": true, | |
| "use_qk_norm": false | |
| }, | |
| "torch_dtype": "float16", | |
| "transformers_version": "4.55.0.dev0", | |
| "video_end_token_id": 151342, | |
| "video_start_token_id": 151341, | |
| "video_token_id": 151364, | |
| "vision_config": { | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "depth": 24, | |
| "hidden_act": "silu", | |
| "hidden_size": 1536, | |
| "image_size": 336, | |
| "in_channels": 3, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 11264, | |
| "model_type": "glm4v_moe", | |
| "num_heads": 12, | |
| "out_hidden_size": 4096, | |
| "patch_size": 14, | |
| "rms_norm_eps": 1e-05, | |
| "spatial_merge_size": 2, | |
| "temporal_patch_size": 2 | |
| }, | |
| "quantization_config": { | |
| "quant_method": "awq_marlin", | |
| "bits": 4, | |
| "group_size": 128, | |
| "version": "gemm", | |
| "zero_point": true, | |
| "modules_to_not_convert": ["visual.", "model.embed_tokens", "model.layers.0.mlp.shared_experts.", "model.layers.1.mlp.shared_experts.", "model.layers.2.mlp.shared_experts.", "model.layers.3.mlp.shared_experts.", "model.layers.4.mlp.shared_experts.", "model.layers.5.mlp.shared_experts.", "model.layers.6.mlp.shared_experts.", "model.layers.7.mlp.shared_experts.", "model.layers.8.mlp.shared_experts.", "model.layers.9.mlp.shared_experts.", "model.layers.10.mlp.shared_experts.", "model.layers.11.mlp.shared_experts.", "model.layers.12.mlp.shared_experts.", "model.layers.13.mlp.shared_experts.", "model.layers.14.mlp.shared_experts.", "model.layers.15.mlp.shared_experts.", "model.layers.16.mlp.shared_experts.", "model.layers.17.mlp.shared_experts.", "model.layers.18.mlp.shared_experts.", "model.layers.19.mlp.shared_experts.", "model.layers.20.mlp.shared_experts.", "model.layers.21.mlp.shared_experts.", "model.layers.22.mlp.shared_experts.", "model.layers.23.mlp.shared_experts.", "model.layers.24.mlp.shared_experts.", "model.layers.25.mlp.shared_experts.", "model.layers.26.mlp.shared_experts.", "model.layers.27.mlp.shared_experts.", "model.layers.28.mlp.shared_experts.", "model.layers.29.mlp.shared_experts.", "model.layers.30.mlp.shared_experts.", "model.layers.31.mlp.shared_experts.", "model.layers.32.mlp.shared_experts.", "model.layers.33.mlp.shared_experts.", "model.layers.34.mlp.shared_experts.", "model.layers.35.mlp.shared_experts.", "model.layers.36.mlp.shared_experts.", "model.layers.37.mlp.shared_experts.", "model.layers.38.mlp.shared_experts.", "model.layers.39.mlp.shared_experts.", "model.layers.40.mlp.shared_experts.", "model.layers.41.mlp.shared_experts.", "model.layers.42.mlp.shared_experts.", "model.layers.43.mlp.shared_experts.", "model.layers.44.mlp.shared_experts.", "model.layers.45.mlp.shared_experts.", "lm_head"] | |
| } | |
| } |