Instructions to use DiscoStew/GLM-4.6V-3Bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DiscoStew/GLM-4.6V-3Bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="DiscoStew/GLM-4.6V-3Bit") 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("DiscoStew/GLM-4.6V-3Bit") model = AutoModelForMultimodalLM.from_pretrained("DiscoStew/GLM-4.6V-3Bit", 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]:])) - MLX
How to use DiscoStew/GLM-4.6V-3Bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("DiscoStew/GLM-4.6V-3Bit") config = load_config("DiscoStew/GLM-4.6V-3Bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use DiscoStew/GLM-4.6V-3Bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DiscoStew/GLM-4.6V-3Bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DiscoStew/GLM-4.6V-3Bit", "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/DiscoStew/GLM-4.6V-3Bit
- SGLang
How to use DiscoStew/GLM-4.6V-3Bit 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 "DiscoStew/GLM-4.6V-3Bit" \ --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": "DiscoStew/GLM-4.6V-3Bit", "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 "DiscoStew/GLM-4.6V-3Bit" \ --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": "DiscoStew/GLM-4.6V-3Bit", "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" } } ] } ] }' - Pi
How to use DiscoStew/GLM-4.6V-3Bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "DiscoStew/GLM-4.6V-3Bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "DiscoStew/GLM-4.6V-3Bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use DiscoStew/GLM-4.6V-3Bit with Docker Model Runner:
docker model run hf.co/DiscoStew/GLM-4.6V-3Bit
- Hermes Agent
How to use DiscoStew/GLM-4.6V-3Bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "DiscoStew/GLM-4.6V-3Bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default DiscoStew/GLM-4.6V-3Bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use DiscoStew/GLM-4.6V-3Bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "DiscoStew/GLM-4.6V-3Bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "DiscoStew/GLM-4.6V-3Bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload folder using huggingface_hub
Browse filesFiles changed (19)
- .gitattributes+1
- chat_template.jinjaAdded+141
- config.jsonAdded+90
- generation_config.jsonAdded+14
- model-00001-of-00009.safetensorsAdded+3
- model-00002-of-00009.safetensorsAdded+3
- model-00003-of-00009.safetensorsAdded+3
- model-00004-of-00009.safetensorsAdded+3
- model-00005-of-00009.safetensorsAdded+3
- model-00006-of-00009.safetensorsAdded+3
- model-00007-of-00009.safetensorsAdded+3
- model-00008-of-00009.safetensorsAdded+3
- model-00009-of-00009.safetensorsAdded+3
- model.safetensors.index.jsonAdded
- preprocessor_config.jsonAdded+11
- processor_config.jsonAdded+75
- tokenizer.jsonAdded+3
- tokenizer_config.jsonAdded+66
- video_preprocessor_config.jsonAdded+11
32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141[gMASK]<sop>{%- if tools -%}<|system|># Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:<tools>{% for tool in tools %}{{ tool | tojson(ensure_ascii=False) }}{% endfor %}</tools>
For each function call, output the function name and arguments within the following XML format:<tool_call>{function-name}<arg_key>{arg-key-1}</arg_key><arg_value>{arg-value-1}</arg_value><arg_key>{arg-key-2}</arg_key><arg_value>{arg-value-2}</arg_value>...</tool_call>{%- endif -%}{%- macro visible_text(content) -%} {%- if content is string -%} {{- content }} {%- elif content is iterable and content is not mapping -%} {%- for item in content -%} {%- if item is mapping and item.type == 'text' -%} {{- item.text }} {%- elif item is mapping and (item.type == 'image' or 'image' in item) -%} <|begin_of_image|><|image|><|end_of_image|> {%- elif item is mapping and (item.type == 'video' or 'video' in item) -%} <|begin_of_video|><|video|><|end_of_video|> {%- elif item is string -%} {{- item }} {%- endif -%} {%- endfor -%} {%- else -%} {{- content }} {%- endif -%}{%- endmacro -%}{%- set ns = namespace(last_user_index=-1) %}{%- for m in messages %} {%- if m.role == 'user' %} {% set ns.last_user_index = loop.index0 -%} {%- endif %}{%- endfor %}{% for m in messages %}{%- if m.role == 'user' -%}<|user|>{% if m.content is string %}{{ m.content }}{%- else %}{%- for item in m.content %}{% if item.type == 'video' or 'video' in item %}<|begin_of_video|><|video|><|end_of_video|>{% elif item.type == 'image' or 'image' in item %}<|begin_of_image|><|image|><|end_of_image|>{% elif item.type == 'text' %}{{ item.text }}{%- endif %}{%- endfor %}{%- endif %}{{- '/nothink' if (enable_thinking is defined and not enable_thinking and not visible_text(m.content).endswith("/nothink")) else '' -}}{%- elif m.role == 'assistant' -%}<|assistant|>{%- set reasoning_content = '' %}{%- set content = visible_text(m.content) %}{%- if m.reasoning_content is string %} {%- set reasoning_content = m.reasoning_content %}{%- else %} {%- if '</think>' in content %} {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %} {%- set content = content.split('</think>')[-1].lstrip('\n') %} {%- endif %}{%- endif %}{%- if loop.index0 > ns.last_user_index and reasoning_content -%}{{ '\n<think>' + reasoning_content.strip() + '</think>'}}{%- else -%}{{ '\n<think></think>' }}{%- endif -%}{%- if content.strip() -%}{{ '\n' + content.strip() }}{%- endif -%}{% if m.tool_calls %}{% for tc in m.tool_calls %}{%- if tc.function %} {%- set tc = tc.function %}{%- endif %}{{ '\n<tool_call>' + tc.name }}{% set _args = tc.arguments %}{% for k, v in _args.items() %}<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson(ensure_ascii=False) if v is not string else v }}</arg_value>{% endfor %}</tool_call>{% endfor %}{% endif %}{%- elif m.role == 'tool' -%}{%- if m.content is string -%}{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %} {{- '<|observation|>' }}{%- endif %}{{- '\n<tool_response>\n' }}{{- m.content }}{{- '\n</tool_response>' }}{% elif m.content is iterable and m.content is not mapping %}{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}{{- '<|observation|>' }}{%- endif %}{{- '\n<tool_response>\n' }}{%- for tr in m.content -%} {%- if tr is mapping and tr.type is defined -%} {%- set t = tr.type | lower -%} {%- if t == 'text' and tr.text is defined -%}{{ tr.text }} {%- elif t in ['image', 'image_url'] -%}<|begin_of_image|><|image|><|end_of_image|> {%- elif t in ['video', 'video_url'] -%}<|begin_of_video|><|video|><|end_of_video|> {%- else -%}{{ tr | tojson(ensure_ascii=False) }} {%- endif -%} {%- else -%}{{ tr.output if tr.output is defined else tr }} {%- endif -%}{%- endfor -%}{{- '\n</tool_response>' }}{%- else -%}<|observation|>{% for tr in m.content %}
<tool_response>{{ tr.output if tr.output is defined else tr }}</tool_response>{% endfor -%}{% endif -%}{# ====== 逻辑结束 ====== #}{%- elif m.role == 'system' -%}<|system|>{{ visible_text(m.content) }}{%- endif -%}{%- endfor -%}{%- if add_generation_prompt -%}<|assistant|>{{'<think></think>\n' if (enable_thinking is defined and not enable_thinking) else ''}}{%- endif -%}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990{ "architectures": [ "Glm4vMoeForConditionalGeneration" ], "image_end_token_id": 151340, "image_start_token_id": 151339, "image_token_id": 151363, "model_type": "glm4v_moe", "quantization": { "group_size": 128, "bits": 3, "mode": "affine" }, "quantization_config": { "group_size": 128, "bits": 3, "mode": "affine" }, "text_config": { "attention_bias": true, "attention_dropout": 0.0, "dtype": "bfloat16", "eos_token_id": [ 151329, 151336, 151338 ], "first_k_dense_replace": 1, "head_dim": 128, "hidden_act": "silu", "hidden_size": 4096, "initializer_range": 0.02, "intermediate_size": 10944, "max_position_embeddings": 131072, "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, "num_nextn_predict_layers": 0, "pad_token_id": 151329, "partial_rotary_factor": 0.5, "qk_layernorm": false, "rms_norm_eps": 1e-05, "rope_parameters": { "mrope_section": [ 8, 12, 12 ], "partial_rotary_factor": 0.5, "rope_theta": 500000, "rope_type": "default" }, "routed_scaling_factor": 1.0, "topk_group": 1, "use_cache": true, "use_qk_norm": false, "vocab_size": 151552 }, "tie_word_embeddings": false, "transformers_version": "5.0.0rc0", "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_dropout_prob": 0.0, "hidden_size": 1536, "image_size": 336, "in_channels": 3, "initializer_range": 0.02, "intermediate_size": 10944, "model_type": "glm4v_moe_vision", "num_heads": 12, "out_hidden_size": 4096, "patch_size": 14, "rms_norm_eps": 1e-05, "spatial_merge_size": 2, "temporal_patch_size": 2 }}1234567891011121314{ "_from_model_config": true, "do_sample": true, "eos_token_id": [ 151329, 151336, 151338 ], "pad_token_id": 151329, "top_p": 0.6, "temperature": 0.8, "top_k": 2, "transformers_version": "5.0.0rc0"}123version https://git-lfs.github.com/spec/v1oid sha256:fac4bbf64ee7408108781c78f8e101559cb6b217d2d9dee230f5f3858c6630cesize 5340544345123version https://git-lfs.github.com/spec/v1oid sha256:370bb3d2f91218c24ebad159d09033eacf8ede38426aea320a4d111ac51cd7afsize 5368424302123version https://git-lfs.github.com/spec/v1oid sha256:157a3fc5180d491412c15bdfdce5bd23e7d2e9fcdaeb564c6f8ceb1306b26a5dsize 5104768329123version https://git-lfs.github.com/spec/v1oid sha256:04bcadea3ad1ae8adaa6f54c18684e9af33aad2864bb012476c39730b0533afdsize 5368424520123version https://git-lfs.github.com/spec/v1oid sha256:6d40f8c89c91b839f7f2bdbb22160a46a65587595f317b152076c5e2cb7a6ed2size 5104768327123version https://git-lfs.github.com/spec/v1oid sha256:7ef2b5415b828fbffab9f2a901797c4bb41c65728489071d83a40364bd17d3dbsize 5368424528123version https://git-lfs.github.com/spec/v1oid sha256:60d441fad8712f15d3fe38cbc498b142532d2b0f0b9b8238d0329f4bad1b9547size 5104768381123version https://git-lfs.github.com/spec/v1oid sha256:db699082d3683ddcaa34cfbacc2249251481e05542d4e01d8dd836d40c014df8size 5368424490123version https://git-lfs.github.com/spec/v1oid sha256:f57e6ab5d9dde036d271505711c972817bb02cceebe6f7c2401e68e45e3f05fbsize 31085164751234567891011{ "size": {"shortest_edge": 12544, "longest_edge": 9633792}, "do_rescale": true, "patch_size": 14, "temporal_patch_size": 2, "merge_size": 2, "image_mean": [0.48145466, 0.4578275, 0.40821073], "image_std": [0.26862954, 0.26130258, 0.27577711], "image_processor_type": "Glm46VImageProcessor", "processor_class": "Glm46VProcessor"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475{ "image_processor": { "do_convert_rgb": true, "do_normalize": true, "do_rescale": true, "do_resize": true, "image_mean": [ 0.48145466, 0.4578275, 0.40821073 ], "image_processor_type": "Glm46VImageProcessor", "image_std": [ 0.26862954, 0.26130258, 0.27577711 ], "merge_size": 2, "patch_size": 14, "processor_class": "Glm46VProcessor", "resample": 3, "rescale_factor": 0.00392156862745098, "size": { "longest_edge": 9633792, "shortest_edge": 12544 }, "temporal_patch_size": 2 }, "processor_class": "Glm46VProcessor", "video_processor": { "crop_size": null, "data_format": "channels_first", "default_to_square": true, "device": null, "do_center_crop": null, "do_convert_rgb": true, "do_normalize": true, "do_pad": null, "do_rescale": true, "do_resize": true, "do_sample_frames": true, "fps": 2, "image_mean": [ 0.48145466, 0.4578275, 0.40821073 ], "image_std": [ 0.26862954, 0.26130258, 0.27577711 ], "input_data_format": null, "max_duration": 300, "max_image_size": { "longest_edge": 47040000 }, "merge_size": 2, "num_frames": 16, "pad_size": null, "patch_size": 14, "processor_class": "Glm46VProcessor", "resample": 3, "rescale_factor": 0.00392156862745098, "return_metadata": false, "return_tensors": null, "size": { "longest_edge": 47040000, "shortest_edge": 12544 }, "temporal_patch_size": 2, "video_metadata": null, "video_processor_type": "Glm46VVideoProcessor" }}123version https://git-lfs.github.com/spec/v1oid sha256:f0ccf2252fe9cd23ada23a829ec409aab397dbd2ac4f372d3a1a23d1f7c72d6bsize 19970686123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566{ "additional_special_tokens": [ "<|endoftext|>", "[MASK]", "[gMASK]", "[sMASK]", "<sop>", "<eop>", "<|system|>", "<|user|>", "<|assistant|>", "<|observation|>", "<|begin_of_image|>", "<|end_of_image|>", "<|begin_of_video|>", "<|end_of_video|>", "<|begin_of_audio|>", "<|end_of_audio|>", "<|image|>", "<|video|>", "<|begin_of_transcription|>", "<|end_of_transcription|>", "<|code_prefix|>", "<|code_middle|>", "<|code_suffix|>", "/nothink" ], "backend": "tokenizers", "clean_up_tokenization_spaces": false, "do_lower_case": false, "eos_token": "<|endoftext|>", "extra_special_tokens": [ "<|endoftext|>", "[MASK]", "[gMASK]", "[sMASK]", "<sop>", "<eop>", "<|system|>", "<|user|>", "<|assistant|>", "<|observation|>", "<|begin_of_image|>", "<|end_of_image|>", "<|begin_of_video|>", "<|end_of_video|>", "<|begin_of_audio|>", "<|end_of_audio|>", "<|image|>", "<|video|>", "<|begin_of_transcription|>", "<|end_of_transcription|>", "<|code_prefix|>", "<|code_middle|>", "<|code_suffix|>", "/nothink" ], "is_local": true, "model_max_length": 128000, "model_specific_special_tokens": {}, "pad_token": "<|endoftext|>", "padding_side": "left", "processor_class": "Glm46VProcessor", "remove_space": false, "tokenizer_class": "TokenizersBackend"}1234567891011{ "size": {"shortest_edge": 12544, "longest_edge": 47040000}, "do_rescale": true, "patch_size": 14, "temporal_patch_size": 2, "merge_size": 2, "image_mean": [0.48145466, 0.4578275, 0.40821073], "image_std": [0.26862954, 0.26130258, 0.27577711], "video_processor_type": "Glm46VVideoProcessor", "processor_class": "Glm46VProcessor"}.gitattributes+1
chat_template.jinjaAdded+141
config.jsonAdded+90
generation_config.jsonAdded+14
model-00001-of-00009.safetensorsAdded+3
model-00002-of-00009.safetensorsAdded+3
model-00003-of-00009.safetensorsAdded+3
model-00004-of-00009.safetensorsAdded+3
model-00005-of-00009.safetensorsAdded+3
model-00006-of-00009.safetensorsAdded+3
model-00007-of-00009.safetensorsAdded+3
model-00008-of-00009.safetensorsAdded+3
model-00009-of-00009.safetensorsAdded+3
model.safetensors.index.jsonAdded
preprocessor_config.jsonAdded+11
processor_config.jsonAdded+75
tokenizer.jsonAdded+3
tokenizer_config.jsonAdded+66
video_preprocessor_config.jsonAdded+11