Instructions to use lukealonso/GLM-5.2-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lukealonso/GLM-5.2-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lukealonso/GLM-5.2-NVFP4", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("lukealonso/GLM-5.2-NVFP4") model = AutoModelForCausalLM.from_pretrained("lukealonso/GLM-5.2-NVFP4", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lukealonso/GLM-5.2-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lukealonso/GLM-5.2-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": "lukealonso/GLM-5.2-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lukealonso/GLM-5.2-NVFP4
- SGLang
How to use lukealonso/GLM-5.2-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 "lukealonso/GLM-5.2-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": "lukealonso/GLM-5.2-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 "lukealonso/GLM-5.2-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": "lukealonso/GLM-5.2-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use lukealonso/GLM-5.2-NVFP4 with Docker Model Runner:
docker model run hf.co/lukealonso/GLM-5.2-NVFP4
launch failed with EAGLE
Using this model, we can launch successfully without MTP, but when using MTP, crash occurs:
[2026-06-22 17:21:25 TP2] model.decoder.mlp.experts.w13_input_scale not found in params_dict.
[2026-06-22 17:21:25 TP2] model.decoder.mlp.experts.w13_input_scale not found in params_dict.
[2026-06-22 17:21:25 TP2] model.decoder.mlp.experts.w2_input_scale not found in params_dict.
[2026-06-22 17:21:25 TP2] model.decoder.mlp.experts.w13_input_scale not found in params_dict.
[2026-06-22 17:21:25 TP2] model.decoder.mlp.experts.w13_input_scale not found in params_dict.
[2026-06-22 17:21:25 TP1] Scheduler hit an exception: Traceback (most recent call last):
File "/sgl-workspace/sglang/python/sglang/srt/managers/scheduler.py", line 4060, in run_scheduler_process
scheduler = Scheduler(
^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/managers/scheduler.py", line 427, in init
self.init_model_worker()
File "/sgl-workspace/sglang/python/sglang/srt/managers/scheduler.py", line 818, in init_model_worker
self.maybe_init_draft_worker()
File "/sgl-workspace/sglang/python/sglang/srt/managers/scheduler.py", line 802, in maybe_init_draft_worker
self.draft_worker = DraftWorkerClass(**draft_worker_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/speculative/eagle_worker_v2.py", line 860, in init
self._draft_worker = EagleDraftWorker(
^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/speculative/eagle_worker_v2.py", line 171, in init
self.draft_worker = TpModelWorker(
^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/managers/tp_worker.py", line 262, in init
self._init_model_runner()
File "/sgl-workspace/sglang/python/sglang/srt/managers/tp_worker.py", line 347, in _init_model_runner
self._model_runner = ModelRunner(
^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/model_executor/model_runner.py", line 571, in init
self.initialize(pre_model_load_memory)
File "/sgl-workspace/sglang/python/sglang/srt/model_executor/model_runner.py", line 679, in initialize
self.load_model()
File "/sgl-workspace/sglang/python/sglang/srt/model_executor/model_runner.py", line 1364, in load_model
self.model = self.loader.load_model(
^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/model_loader/loader.py", line 2737, in load_model
return super().load_model(
^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/model_loader/loader.py", line 743, in load_model
self.load_weights_and_postprocess(
File "/sgl-workspace/sglang/python/sglang/srt/model_loader/loader.py", line 763, in load_weights_and_postprocess
model.load_weights(weights)
File "/sgl-workspace/sglang/python/sglang/srt/models/deepseek_nextn.py", line 356, in load_weights
super().load_weights(weights, is_nextn=True)
File "/sgl-workspace/sglang/python/sglang/srt/models/deepseek_v2.py", line 2719, in load_weights
self.do_load_weights(weights, is_nextn)
File "/sgl-workspace/sglang/python/sglang/srt/models/deepseek_common/deepseek_weight_loader.py", line 373, in do_load_weights
future.result()
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/srt/layers/moe/fused_moe_triton/layer.py", line 667, in weight_loader
self._weight_loader_physical(
File "/sgl-workspace/sglang/python/sglang/srt/layers/moe/fused_moe_triton/layer.py", line 697, in _weight_loader_physical
self._weight_loader_impl(
File "/sgl-workspace/sglang/python/sglang/srt/layers/moe/fused_moe_triton/layer.py", line 955, in _weight_loader_impl
self._load_model_weight_or_group_weight_scale(
File "/sgl-workspace/sglang/python/sglang/srt/layers/moe/fused_moe_triton/layer.py", line 399, in _load_model_weight_or_group_weight_scale
self._load_w13(
File "/sgl-workspace/sglang/python/sglang/srt/layers/moe/fused_moe_triton/layer.py", line 490, in load_w13
expert_data.copy(loaded_weight)
RuntimeError: The size of tensor a (6144) must match the size of tensor b (3072) at non-singleton dimension 1
Worked for me with vLLM. seems like it is related to how sglang reads it?
Worked for me with tutelgroup/deepseek-671b