Run this model with HF Jobs
Run zai-org/GLM-5.3-BF16 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/zai-org/GLM-5.3-BF16. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/zai-org/GLM-5.3-BF16 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/zai-org/GLM-5.3-BF16. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/zai-org/GLM-5.3-BF16. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use zai-org/GLM-5.3-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-BF16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/GLM-5.3-BF16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zai-org/GLM-5.3-BF16") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-5.3-BF16", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zai-org/GLM-5.3-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-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-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zai-org/GLM-5.3-BF16
- SGLang
How to use zai-org/GLM-5.3-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-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-BF16", "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 "zai-org/GLM-5.3-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-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zai-org/GLM-5.3-BF16 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-5.3-BF16
chat template: speed up tool-result validation and reordering (GLM-5.3)
#2
by ShijinZhang - opened
171 unmodified lines172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244171 unmodified lines{%- if block_start > 0 and messages[block_start - 1].role == 'assistant' and messages[block_start - 1].tool_calls -%}{%- set ns_a.tool_calls = messages[block_start - 1].tool_calls -%}{%- endif -%}{%- set ns_chk = namespace(can_sort=true) -%}{%- if not ns_a.tool_calls -%}{%- set ns_chk.can_sort = false -%}{%- else -%}{%- for k in range(block_start, ns_blk.end + 1) -%}{%- if not ns_chk.can_sort -%}{%- break -%}{%- endif -%}{%- set m = messages[k] -%}{%- if is_list_of_outputs(m) -%}{%- for entry in m.content -%}{%- if not ns_chk.can_sort -%}{%- break -%}{%- endif -%}{%- set eid = id_of(entry) -%}{%- if not eid -%}{%- set ns_chk.can_sort = false -%}{%- elif has_dup_tool_result_id(block_start, ns_blk.end, eid) -%}{%- set ns_chk.can_sort = false -%}{%- elif not tc_id_exists(ns_a.tool_calls, eid) -%}{%- set ns_chk.can_sort = false -%}{%- endif -%}{%- endfor -%}{%- else -%}{%- set tk_id = id_of(m) -%}{%- if not tk_id -%}{%- set ns_chk.can_sort = false -%}{%- elif has_dup_tool_result_id(block_start, ns_blk.end, tk_id) -%}{%- set ns_chk.can_sort = false -%}{%- elif not tc_id_exists(ns_a.tool_calls, tk_id) -%}{%- set ns_chk.can_sort = false -%}{%- endif -%}{%- endif -%}{%- endfor -%}{%- for i in range(ns_a.tool_calls | length) -%}{%- if not ns_chk.can_sort -%}{%- break -%}{%- endif -%}{%- set tc_id = id_of(ns_a.tool_calls[i]) -%}{%- if not tc_id -%}{%- set ns_chk.can_sort = false -%}{%- endif -%}{%- for j in range(i + 1, ns_a.tool_calls | length) -%}{%- if id_of(ns_a.tool_calls[j]) == tc_id -%}{%- set ns_chk.can_sort = false -%}{%- break -%}{%- endif -%}{%- endfor -%}{%- endfor -%}{%- endif -%}{%- if ns_chk.can_sort -%}{%- for tc in ns_a.tool_calls -%}{%- set tc_id = id_of(tc) -%}{%- for k in range(block_start, ns_blk.end + 1) -%}{%- set m = messages[k] -%}{%- if is_list_of_outputs(m) -%}{%- for entry in m.content -%}{%- set eid = id_of(entry) -%}{%- if eid == tc_id -%}{%- 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)) -}}{%- endif -%}{%- endif -%}{%- endfor -%}{%- else -%}{%- set tk_id = id_of(m) -%}{%- if tk_id == tc_id -%}{{- render_tool_response(m) -}}{%- endif -%}{%- endif -%}{%- endfor -%}{%- endfor -%}{%- else -%}{%- for k in range(block_start, ns_blk.end + 1) -%}171 unmodified lines172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240171 unmodified lines{%- if block_start > 0 and messages[block_start - 1].role == 'assistant' and messages[block_start - 1].tool_calls -%}{%- set ns_a.tool_calls = messages[block_start - 1].tool_calls -%}{%- endif -%}{%- set ns_chk = namespace(can_sort=true, res=[], mk=[], ek=[], tcs=[]) -%}{%- for k in range(block_start, ns_blk.end + 1) -%}{%- set m = messages[k] -%}{%- if is_list_of_outputs(m) -%}{%- for entry in m.content -%}{%- set ns_chk.res = ns_chk.res + [id_of(entry)] -%}{%- set ns_chk.mk = ns_chk.mk + [k] -%}{%- set ns_chk.ek = ns_chk.ek + [loop.index0] -%}{%- endfor -%}{%- else -%}{%- set ns_chk.res = ns_chk.res + [id_of(m)] -%}{%- set ns_chk.mk = ns_chk.mk + [k] -%}{%- set ns_chk.ek = ns_chk.ek + [-1] -%}{%- endif -%}{%- endfor -%}{%- if not ns_a.tool_calls -%}{%- set ns_chk.can_sort = false -%}{%- else -%}{%- for tc in ns_a.tool_calls -%}{%- set ns_chk.tcs = ns_chk.tcs + [id_of(tc)] -%}{%- 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 -%}{%- if eid not in ns_chk.tcs -%}{%- set ns_chk.can_sort = false -%}{%- break -%}{%- endif -%}{%- endfor -%}{%- endif -%}{%- endif -%}{%- if ns_chk.can_sort -%}{%- set ns_ord = namespace(res=[], tcs=[], j=0, pairs=[]) -%}{%- for eid in ns_chk.res -%}{%- set ns_ord.res = ns_ord.res + [{'id': eid, 'p': loop.index0}] -%}{%- endfor -%}{%- for tc_id in ns_chk.tcs -%}{%- set ns_ord.tcs = ns_ord.tcs + [{'id': tc_id, 'i': loop.index0}] -%}{%- endfor -%}{%- set ns_ord.res = ns_ord.res | sort(attribute='id', case_sensitive=true) -%}{%- for tc in ns_ord.tcs | sort(attribute='id', case_sensitive=true) -%}{%- if ns_ord.j < ns_ord.res | length and ns_ord.res[ns_ord.j].id == tc.id -%}{%- set ns_ord.pairs = ns_ord.pairs + [{'i': tc.i, 'p': ns_ord.res[ns_ord.j].p}] -%}{%- set ns_ord.j = ns_ord.j + 1 -%}{%- endif -%}{%- endfor -%}{%- for pair in ns_ord.pairs | sort(attribute='i') -%}{%- 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)) -}}{%- endif -%}{%- else -%}{{- render_tool_response(m) -}}{%- endif -%}{%- endfor -%}{%- else -%}{%- for k in range(block_start, ns_blk.end + 1) -%}
chat_template.jinja+51-55