Text Generation
Transformers
Safetensors
English
Chinese
glm5_next
image-text-to-text
quantized
nvfp4
mxfp8
modelopt
distillation
quantization-aware-distillation
conversational
multimodal
8-bit precision
Instructions to use local-inference-lab/GLM-5.3-Flash-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use local-inference-lab/GLM-5.3-Flash-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="local-inference-lab/GLM-5.3-Flash-NVFP4") 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("local-inference-lab/GLM-5.3-Flash-NVFP4") model = AutoModelForMultimodalLM.from_pretrained("local-inference-lab/GLM-5.3-Flash-NVFP4", 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 local-inference-lab/GLM-5.3-Flash-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "local-inference-lab/GLM-5.3-Flash-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "local-inference-lab/GLM-5.3-Flash-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/local-inference-lab/GLM-5.3-Flash-NVFP4
- SGLang
How to use local-inference-lab/GLM-5.3-Flash-NVFP4 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 "local-inference-lab/GLM-5.3-Flash-NVFP4" \ --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": "local-inference-lab/GLM-5.3-Flash-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "local-inference-lab/GLM-5.3-Flash-NVFP4" \ --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": "local-inference-lab/GLM-5.3-Flash-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use local-inference-lab/GLM-5.3-Flash-NVFP4 with Docker Model Runner:
docker model run hf.co/local-inference-lab/GLM-5.3-Flash-NVFP4
Sync GLM-5.3 tool-result chat template
Browse filesSynchronize chat_template.jinja with zai-org/GLM-5.3-Flash revision 690b705278a3a58e538fcb37c2ca8b5f9511213c. The template preserves assistant tool-call order when serializing tool results, stops invalid reorder scans as soon as their invariant fails, uses Jinja string concatenation consistently, and handles absent message content explicitly. Model weights, tokenizer files, and serving configuration are unchanged.
- chat_template.jinja +10 -6
chat_template.jinja
CHANGED
|
@@ -68,8 +68,8 @@ For each function call, output the function name and arguments within the follow
|
|
| 68 |
{{- emit_audio() -}}
|
| 69 |
{%- endif -%}
|
| 70 |
{%- endfor -%}
|
| 71 |
-
{%-
|
| 72 |
-
{{- content }}
|
| 73 |
{%- endif -%}
|
| 74 |
{%- endmacro -%}
|
| 75 |
{%- macro tool_response(text) -%}
|
|
@@ -159,7 +159,7 @@ For each function call, output the function name and arguments within the follow
|
|
| 159 |
{%- if tc.function %}
|
| 160 |
{%- set tc = tc.function %}
|
| 161 |
{%- endif %}
|
| 162 |
-
{{- '<tool_call>'
|
| 163 |
{% 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 %}
|
| 164 |
{% endif %}
|
| 165 |
{%- elif m.role == 'tool' -%}
|
|
@@ -183,9 +183,11 @@ For each function call, output the function name and arguments within the follow
|
|
| 183 |
{%- set ns_chk.can_sort = false -%}
|
| 184 |
{%- else -%}
|
| 185 |
{%- for k in range(block_start, ns_blk.end + 1) -%}
|
|
|
|
| 186 |
{%- set m = messages[k] -%}
|
| 187 |
{%- if is_list_of_outputs(m) -%}
|
| 188 |
{%- for entry in m.content -%}
|
|
|
|
| 189 |
{%- set eid = id_of(entry) -%}
|
| 190 |
{%- if not eid -%}
|
| 191 |
{%- set ns_chk.can_sort = false -%}
|
|
@@ -207,6 +209,7 @@ For each function call, output the function name and arguments within the follow
|
|
| 207 |
{%- endif -%}
|
| 208 |
{%- endfor -%}
|
| 209 |
{%- for i in range(ns_a.tool_calls | length) -%}
|
|
|
|
| 210 |
{%- set tc_id = id_of(ns_a.tool_calls[i]) -%}
|
| 211 |
{%- if not tc_id -%}
|
| 212 |
{%- set ns_chk.can_sort = false -%}
|
|
@@ -214,9 +217,10 @@ For each function call, output the function name and arguments within the follow
|
|
| 214 |
{%- for j in range(i + 1, ns_a.tool_calls | length) -%}
|
| 215 |
{%- if id_of(ns_a.tool_calls[j]) == tc_id -%}
|
| 216 |
{%- set ns_chk.can_sort = false -%}
|
|
|
|
| 217 |
{%- endif -%}
|
| 218 |
{%- endfor -%}
|
| 219 |
-
|
| 220 |
{%- endif -%}
|
| 221 |
{%- if ns_chk.can_sort -%}
|
| 222 |
{%- for tc in ns_a.tool_calls -%}
|
|
@@ -233,8 +237,8 @@ For each function call, output the function name and arguments within the follow
|
|
| 233 |
{{- tool_response(visible_text(entry.output)) -}}
|
| 234 |
{%- endif -%}
|
| 235 |
{%- endif -%}
|
| 236 |
-
|
| 237 |
-
{%- else -%}
|
| 238 |
{%- set tk_id = id_of(m) -%}
|
| 239 |
{%- if tk_id == tc_id -%}
|
| 240 |
{{- render_tool_response(m) -}}
|
|
|
|
| 68 |
{{- emit_audio() -}}
|
| 69 |
{%- endif -%}
|
| 70 |
{%- endfor -%}
|
| 71 |
+
{%- elif content is not none -%}
|
| 72 |
+
{{- content -}}
|
| 73 |
{%- endif -%}
|
| 74 |
{%- endmacro -%}
|
| 75 |
{%- macro tool_response(text) -%}
|
|
|
|
| 159 |
{%- if tc.function %}
|
| 160 |
{%- set tc = tc.function %}
|
| 161 |
{%- endif %}
|
| 162 |
+
{{- '<tool_call>' ~ tc.name -}}
|
| 163 |
{% 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 %}
|
| 164 |
{% endif %}
|
| 165 |
{%- elif m.role == 'tool' -%}
|
|
|
|
| 183 |
{%- set ns_chk.can_sort = false -%}
|
| 184 |
{%- else -%}
|
| 185 |
{%- for k in range(block_start, ns_blk.end + 1) -%}
|
| 186 |
+
{%- if not ns_chk.can_sort -%}{%- break -%}{%- endif -%}
|
| 187 |
{%- set m = messages[k] -%}
|
| 188 |
{%- if is_list_of_outputs(m) -%}
|
| 189 |
{%- for entry in m.content -%}
|
| 190 |
+
{%- if not ns_chk.can_sort -%}{%- break -%}{%- endif -%}
|
| 191 |
{%- set eid = id_of(entry) -%}
|
| 192 |
{%- if not eid -%}
|
| 193 |
{%- set ns_chk.can_sort = false -%}
|
|
|
|
| 209 |
{%- endif -%}
|
| 210 |
{%- endfor -%}
|
| 211 |
{%- for i in range(ns_a.tool_calls | length) -%}
|
| 212 |
+
{%- if not ns_chk.can_sort -%}{%- break -%}{%- endif -%}
|
| 213 |
{%- set tc_id = id_of(ns_a.tool_calls[i]) -%}
|
| 214 |
{%- if not tc_id -%}
|
| 215 |
{%- set ns_chk.can_sort = false -%}
|
|
|
|
| 217 |
{%- for j in range(i + 1, ns_a.tool_calls | length) -%}
|
| 218 |
{%- if id_of(ns_a.tool_calls[j]) == tc_id -%}
|
| 219 |
{%- set ns_chk.can_sort = false -%}
|
| 220 |
+
{%- break -%}
|
| 221 |
{%- endif -%}
|
| 222 |
{%- endfor -%}
|
| 223 |
+
{%- endfor -%}
|
| 224 |
{%- endif -%}
|
| 225 |
{%- if ns_chk.can_sort -%}
|
| 226 |
{%- for tc in ns_a.tool_calls -%}
|
|
|
|
| 237 |
{{- tool_response(visible_text(entry.output)) -}}
|
| 238 |
{%- endif -%}
|
| 239 |
{%- endif -%}
|
| 240 |
+
{%- endfor -%}
|
| 241 |
+
{%- else -%}
|
| 242 |
{%- set tk_id = id_of(m) -%}
|
| 243 |
{%- if tk_id == tc_id -%}
|
| 244 |
{{- render_tool_response(m) -}}
|