Instructions to use zai-org/GLM-5.3-Flash-BF16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-5.3-Flash-BF16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="zai-org/GLM-5.3-Flash-BF16") 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("zai-org/GLM-5.3-Flash-BF16") model = AutoModelForMultimodalLM.from_pretrained("zai-org/GLM-5.3-Flash-BF16", 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 zai-org/GLM-5.3-Flash-BF16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zai-org/GLM-5.3-Flash-BF16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5.3-Flash-BF16", "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/zai-org/GLM-5.3-Flash-BF16
- SGLang
How to use zai-org/GLM-5.3-Flash-BF16 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 "zai-org/GLM-5.3-Flash-BF16" \ --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": "zai-org/GLM-5.3-Flash-BF16", "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 "zai-org/GLM-5.3-Flash-BF16" \ --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": "zai-org/GLM-5.3-Flash-BF16", "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 zai-org/GLM-5.3-Flash-BF16 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-5.3-Flash-BF16
Make the chat template work in llama.cpp and add a response template
#3
by Rocketknight1 HF Staff - opened
Files changed (2)
- chat_template.jinja+16-6
- tokenizer_config.json+48-1
77 unmodified lines787980818283848586878811 unmodified lines10010110210310410510622 unmodified lines12913013113213313466 unmodified lines20120220320420520620720820923 unmodified lines23323423523623723823977 unmodified lines{%- macro render_tool_response(m) -%}{%- if m.content is string -%}{{- tool_response(m.content) -}}{%- elif m.content and m.content is not mapping and m.content.0.type == "tool_reference" -%}{{- tool_references_to_response(m.content) -}}{%- elif is_list_of_outputs(m) -%}{%- for tr in m.content -%}{%- if tr.output is iterable and tr.output is not string and tr.output is not mapping and tr.output and tr.output.0.type == "tool_reference" -%}{{- tool_references_to_response(tr.output) -}}{%- else -%}{{- tool_response(visible_text(tr.output)) -}}11 unmodified lines{%- endif -%}{%- endmacro -%}{%- macro is_list_of_outputs(m) -%}{%- if m.content and m.content.0.output is defined -%}1{%- endif -%}{%- endmacro -%}{%- macro has_dup_tool_result_id(lo, hi, target) -%}{%- set ns_cnt = namespace(n=0) -%}22 unmodified lines{%- endfor -%}{%- if ns_f.found -%}1{%- endif -%}{%- endmacro -%}{%- set ns = namespace(last_user_index=-1) -%}{%- for m in messages %}{%- if m.role == 'user' %}66 unmodified lines{%- endfor -%}{%- if '' in ns_chk.res or '' in ns_chk.tcs -%}{%- set ns_chk.can_sort = false -%}{%- elif ns_chk.res | unique(case_sensitive=true) | list | length != ns_chk.res | length -%}{%- set ns_chk.can_sort = false -%}{%- elif ns_chk.tcs | unique(case_sensitive=true) | list | length != ns_chk.tcs | length -%}{%- set ns_chk.can_sort = false -%}{%- else -%}{%- for eid in ns_chk.res -%}23 unmodified lines{%- set m = messages[ns_chk.mk[pair.p]] -%}{%- if ns_chk.ek[pair.p] >= 0 -%}{%- set entry = m.content[ns_chk.ek[pair.p]] -%}{%- if entry.output is iterable and entry.output is not string and entry.output is not mapping and entry.output and entry.output.0.type == "tool_reference" -%}{{- tool_references_to_response(entry.output) -}}{%- else -%}{{- tool_response(visible_text(entry.output)) -}}77 unmodified lines787980818283848586878811 unmodified lines10010110210310410510622 unmodified lines12913013113213313413513613713813914014114214314466 unmodified lines21121221321421521621721821923 unmodified lines24324424524624724824977 unmodified lines{%- macro render_tool_response(m) -%}{%- if m.content is string -%}{{- tool_response(m.content) -}}{%- elif m.content and m.content is not mapping and m.content[0].type == "tool_reference" -%}{{- tool_references_to_response(m.content) -}}{%- elif is_list_of_outputs(m) -%}{%- for tr in m.content -%}{%- if tr.output is iterable and tr.output is not string and tr.output is not mapping and tr.output and tr.output[0].type == "tool_reference" -%}{{- tool_references_to_response(tr.output) -}}{%- else -%}{{- tool_response(visible_text(tr.output)) -}}11 unmodified lines{%- endif -%}{%- endmacro -%}{%- macro is_list_of_outputs(m) -%}{%- if m.content and m.content[0].output is defined -%}1{%- endif -%}{%- endmacro -%}{%- macro has_dup_tool_result_id(lo, hi, target) -%}{%- set ns_cnt = namespace(n=0) -%}22 unmodified lines{%- endfor -%}{%- if ns_f.found -%}1{%- endif -%}{%- endmacro -%}{%- macro has_duplicates(ids) -%}{%- set ns_dup = namespace(seen=[], found=false) -%}{%- for x in ids -%}{%- if x in ns_dup.seen -%}{%- set ns_dup.found = true -%}{%- endif -%}{%- set ns_dup.seen = ns_dup.seen + [x] -%}{%- endfor -%}{%- if ns_dup.found -%}1{%- endif -%}{%- endmacro -%}{%- set ns = namespace(last_user_index=-1) -%}{%- for m in messages %}{%- if m.role == 'user' %}66 unmodified lines{%- endfor -%}{%- if '' in ns_chk.res or '' in ns_chk.tcs -%}{%- set ns_chk.can_sort = false -%}{%- elif has_duplicates(ns_chk.res) -%}{%- set ns_chk.can_sort = false -%}{%- elif has_duplicates(ns_chk.tcs) -%}{%- set ns_chk.can_sort = false -%}{%- else -%}{%- for eid in ns_chk.res -%}23 unmodified lines{%- set m = messages[ns_chk.mk[pair.p]] -%}{%- if ns_chk.ek[pair.p] >= 0 -%}{%- set entry = m.content[ns_chk.ek[pair.p]] -%}{%- if entry.output is iterable and entry.output is not string and entry.output is not mapping and entry.output and entry.output[0].type == "tool_reference" -%}{{- tool_references_to_response(entry.output) -}}{%- else -%}{{- tool_response(visible_text(entry.output)) -}}
28 unmodified lines293031323328 unmodified lines"pad_token": "<|endoftext|>","padding_side": "left","remove_space": false,"tokenizer_class": "TokenizersBackend"}28 unmodified lines2930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798028 unmodified lines"pad_token": "<|endoftext|>","padding_side": "left","remove_space": false,"tokenizer_class": "TokenizersBackend","response_template": {"defaults": {"role": "assistant"},"start_anchor": "<|assistant|>","fields": {"reasoning_content": {"open_pattern": "<think>|(?=</think>)","close_pattern": "</think>|(?=<tool_call>)","content": "text","content_args": {"strip": true},"repeats": true,"join": ""},"tool_calls": {"open_pattern": "\\s*<tool_call>\\s*(?P<name>[^<]*?)\\s*(?=<arg_key>|</tool_call>)","close": "</tool_call>","repeats": true,"content": "xml-inline","content_args": {"tag_pattern": "<arg_key>\\s*(?P<key>.*?)\\s*</arg_key>\\s*<arg_value>(?P<value>.*?)</arg_value>"},"transform": {"type": "function","function": {"name": "{name}","arguments": "{content}"}}},"content": {"close": ["<|user|>","<|observation|>","<|endoftext|>"],"content": "text","content_args": {"strip": false},"repeats": true,"join": ""}}}}
chat_template.jinja+16-6
tokenizer_config.json+48-1