Text Generation
Transformers
Safetensors
TensorRT
glm_moe_dsa
nvfp4
fp4
quantization
modelopt
Mixture of Experts
glm
sglang
conversational
8-bit precision
Instructions to use Mapika/GLM-5.2-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mapika/GLM-5.2-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mapika/GLM-5.2-NVFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("Mapika/GLM-5.2-NVFP4") model = AutoModelForMultimodalLM.from_pretrained("Mapika/GLM-5.2-NVFP4") 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]:])) - TensorRT
How to use Mapika/GLM-5.2-NVFP4 with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mapika/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 "Mapika/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": "Mapika/GLM-5.2-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mapika/GLM-5.2-NVFP4
- SGLang
How to use Mapika/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 "Mapika/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": "Mapika/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 "Mapika/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": "Mapika/GLM-5.2-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Mapika/GLM-5.2-NVFP4 with Docker Model Runner:
docker model run hf.co/Mapika/GLM-5.2-NVFP4
| { | |
| "architectures": [ | |
| "GlmMoeDsaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "dtype": "bfloat16", | |
| "eos_token_id": [ | |
| 154820, | |
| 154827, | |
| 154829 | |
| ], | |
| "ep_size": 1, | |
| "first_k_dense_replace": 3, | |
| "head_dim": 192, | |
| "hidden_act": "silu", | |
| "hidden_size": 6144, | |
| "index_head_dim": 128, | |
| "index_n_heads": 32, | |
| "index_share_for_mtp_iteration": true, | |
| "index_skip_topk_offset": 3, | |
| "index_topk": 2048, | |
| "index_topk_freq": 4, | |
| "index_topk_pattern": null, | |
| "indexer_rope_interleave": true, | |
| "indexer_types": [ | |
| "full", | |
| "full", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared", | |
| "full", | |
| "shared", | |
| "shared", | |
| "shared" | |
| ], | |
| "initializer_range": 0.02, | |
| "intermediate_size": 12288, | |
| "kv_lora_rank": 512, | |
| "max_position_embeddings": 1048576, | |
| "mlp_layer_types": [ | |
| "dense", | |
| "dense", | |
| "dense", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse", | |
| "sparse" | |
| ], | |
| "model_type": "glm_moe_dsa", | |
| "moe_intermediate_size": 2048, | |
| "moe_layer_freq": 1, | |
| "n_group": 1, | |
| "n_routed_experts": 256, | |
| "n_shared_experts": 1, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 64, | |
| "num_experts_per_tok": 8, | |
| "num_hidden_layers": 78, | |
| "num_key_value_heads": 64, | |
| "num_nextn_predict_layers": 1, | |
| "pad_token_id": 154820, | |
| "pretraining_tp": 1, | |
| "q_lora_rank": 2048, | |
| "qk_head_dim": 256, | |
| "qk_nope_head_dim": 192, | |
| "qk_rope_head_dim": 64, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleave": true, | |
| "rope_parameters": { | |
| "rope_theta": 8000000, | |
| "rope_type": "default" | |
| }, | |
| "routed_scaling_factor": 2.5, | |
| "scoring_func": "sigmoid", | |
| "tie_word_embeddings": false, | |
| "topk_group": 1, | |
| "topk_method": "noaux_tc", | |
| "transformers_version": "5.12.0", | |
| "use_cache": true, | |
| "v_head_dim": 256, | |
| "vocab_size": 154880, | |
| "quantization_config": { | |
| "config_groups": { | |
| "group_0": { | |
| "input_activations": { | |
| "dynamic": false, | |
| "num_bits": 4, | |
| "type": "float", | |
| "group_size": 16 | |
| }, | |
| "weights": { | |
| "dynamic": false, | |
| "num_bits": 4, | |
| "type": "float", | |
| "group_size": 16 | |
| }, | |
| "targets": [ | |
| "Linear" | |
| ] | |
| } | |
| }, | |
| "ignore": [ | |
| "lm_head", | |
| "model.layers.0.self_attn*", | |
| "model.layers.1.self_attn*", | |
| "model.layers.10.self_attn*", | |
| "model.layers.11.self_attn*", | |
| "model.layers.12.self_attn*", | |
| "model.layers.13.self_attn*", | |
| "model.layers.14.self_attn*", | |
| "model.layers.15.self_attn*", | |
| "model.layers.16.self_attn*", | |
| "model.layers.17.self_attn*", | |
| "model.layers.18.self_attn*", | |
| "model.layers.19.self_attn*", | |
| "model.layers.2.self_attn*", | |
| "model.layers.20.self_attn*", | |
| "model.layers.21.self_attn*", | |
| "model.layers.22.self_attn*", | |
| "model.layers.23.self_attn*", | |
| "model.layers.24.self_attn*", | |
| "model.layers.25.self_attn*", | |
| "model.layers.26.self_attn*", | |
| "model.layers.27.self_attn*", | |
| "model.layers.28.self_attn*", | |
| "model.layers.29.self_attn*", | |
| "model.layers.3.self_attn*", | |
| "model.layers.30.self_attn*", | |
| "model.layers.31.self_attn*", | |
| "model.layers.32.self_attn*", | |
| "model.layers.33.self_attn*", | |
| "model.layers.34.self_attn*", | |
| "model.layers.35.self_attn*", | |
| "model.layers.36.self_attn*", | |
| "model.layers.37.self_attn*", | |
| "model.layers.38.self_attn*", | |
| "model.layers.39.self_attn*", | |
| "model.layers.4.self_attn*", | |
| "model.layers.40.self_attn*", | |
| "model.layers.41.self_attn*", | |
| "model.layers.42.self_attn*", | |
| "model.layers.43.self_attn*", | |
| "model.layers.44.self_attn*", | |
| "model.layers.45.self_attn*", | |
| "model.layers.46.self_attn*", | |
| "model.layers.47.self_attn*", | |
| "model.layers.48.self_attn*", | |
| "model.layers.49.self_attn*", | |
| "model.layers.5.self_attn*", | |
| "model.layers.50.self_attn*", | |
| "model.layers.51.self_attn*", | |
| "model.layers.52.self_attn*", | |
| "model.layers.53.self_attn*", | |
| "model.layers.54.self_attn*", | |
| "model.layers.55.self_attn*", | |
| "model.layers.56.self_attn*", | |
| "model.layers.57.self_attn*", | |
| "model.layers.58.self_attn*", | |
| "model.layers.59.self_attn*", | |
| "model.layers.6.self_attn*", | |
| "model.layers.60.self_attn*", | |
| "model.layers.61.self_attn*", | |
| "model.layers.62.self_attn*", | |
| "model.layers.63.self_attn*", | |
| "model.layers.64.self_attn*", | |
| "model.layers.65.self_attn*", | |
| "model.layers.66.self_attn*", | |
| "model.layers.67.self_attn*", | |
| "model.layers.68.self_attn*", | |
| "model.layers.69.self_attn*", | |
| "model.layers.7.self_attn*", | |
| "model.layers.70.self_attn*", | |
| "model.layers.71.self_attn*", | |
| "model.layers.72.self_attn*", | |
| "model.layers.73.self_attn*", | |
| "model.layers.74.self_attn*", | |
| "model.layers.75.self_attn*", | |
| "model.layers.76.self_attn*", | |
| "model.layers.77.self_attn*", | |
| "model.layers.8.self_attn*", | |
| "model.layers.9.self_attn*" | |
| ], | |
| "quant_algo": "NVFP4", | |
| "producer": { | |
| "name": "modelopt", | |
| "version": "0.44.0" | |
| }, | |
| "quant_method": "modelopt" | |
| } | |
| } |