Text Generation
Transformers
Safetensors
glm4_moe_lite
Mixture of Experts
mixture-of-experts
glm
glm-4.7-flash
code
coder
nvfp4
conversational
8-bit precision
modelopt
Instructions to use cleyesode/GLM-4.7-Flash-Coder-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cleyesode/GLM-4.7-Flash-Coder-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cleyesode/GLM-4.7-Flash-Coder-NVFP4") 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("cleyesode/GLM-4.7-Flash-Coder-NVFP4") model = AutoModelForCausalLM.from_pretrained("cleyesode/GLM-4.7-Flash-Coder-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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cleyesode/GLM-4.7-Flash-Coder-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cleyesode/GLM-4.7-Flash-Coder-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": "cleyesode/GLM-4.7-Flash-Coder-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cleyesode/GLM-4.7-Flash-Coder-NVFP4
- SGLang
How to use cleyesode/GLM-4.7-Flash-Coder-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 "cleyesode/GLM-4.7-Flash-Coder-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": "cleyesode/GLM-4.7-Flash-Coder-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 "cleyesode/GLM-4.7-Flash-Coder-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": "cleyesode/GLM-4.7-Flash-Coder-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cleyesode/GLM-4.7-Flash-Coder-NVFP4 with Docker Model Runner:
docker model run hf.co/cleyesode/GLM-4.7-Flash-Coder-NVFP4
Download config.json from cleyesode/GLM-4.7-Flash-Coder-NVFP4: direct link, hf CLI and curl.
- Browser
- Download file 8.92 kB
-
https://huggingface.co/cleyesode/GLM-4.7-Flash-Coder-NVFP4/resolve/main/config.json
- Command line
-
hf download hf://cleyesode/GLM-4.7-Flash-Coder-NVFP4/config.json
-
curl -L -o config.json https://huggingface.co/cleyesode/GLM-4.7-Flash-Coder-NVFP4/resolve/main/config.json
8.92 kB
| { | |
| "architectures": [ | |
| "Glm4MoeLiteForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "pad_token_id": 154820, | |
| "eos_token_id": [ | |
| 154820, | |
| 154827, | |
| 154829 | |
| ], | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "intermediate_size": 10240, | |
| "max_position_embeddings": 202752, | |
| "model_type": "glm4_moe_lite", | |
| "moe_intermediate_size": 1536, | |
| "topk_method": "noaux_tc", | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 20, | |
| "n_group": 1, | |
| "topk_group": 1, | |
| "n_routed_experts": 64, | |
| "n_shared_experts": 1, | |
| "routed_scaling_factor": 1.8, | |
| "num_experts_per_tok": 4, | |
| "first_k_dense_replace": 1, | |
| "num_hidden_layers": 47, | |
| "num_key_value_heads": 20, | |
| "num_nextn_predict_layers": 1, | |
| "partial_rotary_factor": 1.0, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": null, | |
| "rope_theta": 1000000, | |
| "tie_word_embeddings": false, | |
| "dtype": "bfloat16", | |
| "transformers_version": "5.0.0rc0", | |
| "q_lora_rank": 768, | |
| "kv_lora_rank": 512, | |
| "qk_nope_head_dim": 192, | |
| "qk_rope_head_dim": 64, | |
| "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": [ | |
| "model.layers.1.mlp.experts", | |
| "model.layers.2.mlp.experts", | |
| "model.layers.3.mlp.experts", | |
| "model.layers.4.mlp.experts", | |
| "model.layers.5.mlp.experts", | |
| "model.layers.6.mlp.experts", | |
| "model.layers.7.mlp.experts", | |
| "model.layers.8.mlp.experts", | |
| "model.layers.9.mlp.experts", | |
| "model.layers.10.mlp.experts", | |
| "model.layers.11.mlp.experts", | |
| "model.layers.12.mlp.experts", | |
| "model.layers.13.mlp.experts", | |
| "model.layers.14.mlp.experts", | |
| "model.layers.15.mlp.experts", | |
| "model.layers.16.mlp.experts", | |
| "model.layers.17.mlp.experts", | |
| "model.layers.18.mlp.experts", | |
| "model.layers.19.mlp.experts", | |
| "model.layers.20.mlp.experts", | |
| "model.layers.21.mlp.experts", | |
| "model.layers.22.mlp.experts", | |
| "model.layers.23.mlp.experts", | |
| "model.layers.24.mlp.experts", | |
| "model.layers.25.mlp.experts", | |
| "model.layers.26.mlp.experts", | |
| "model.layers.27.mlp.experts", | |
| "model.layers.28.mlp.experts", | |
| "model.layers.29.mlp.experts", | |
| "model.layers.30.mlp.experts", | |
| "model.layers.31.mlp.experts", | |
| "model.layers.32.mlp.experts", | |
| "model.layers.33.mlp.experts", | |
| "model.layers.34.mlp.experts", | |
| "model.layers.35.mlp.experts", | |
| "model.layers.36.mlp.experts", | |
| "model.layers.37.mlp.experts", | |
| "model.layers.38.mlp.experts", | |
| "model.layers.39.mlp.experts", | |
| "model.layers.40.mlp.experts", | |
| "model.layers.41.mlp.experts", | |
| "model.layers.42.mlp.experts", | |
| "model.layers.43.mlp.experts", | |
| "model.layers.44.mlp.experts", | |
| "model.layers.45.mlp.experts", | |
| "model.layers.46.mlp.experts" | |
| ] | |
| } | |
| }, | |
| "ignore": [ | |
| "lm_head", | |
| "model.embed_tokens", | |
| "model.layers.*.mlp.down_proj", | |
| "model.layers.*.mlp.gate", | |
| "model.layers.*.mlp.gate_proj", | |
| "model.layers.*.mlp.shared_experts.down_proj", | |
| "model.layers.*.mlp.shared_experts.gate_proj", | |
| "model.layers.*.mlp.shared_experts.up_proj", | |
| "model.layers.*.mlp.up_proj", | |
| "model.layers.*.self_attn.kv_a_proj_with_mqa", | |
| "model.layers.*.self_attn.kv_b_proj", | |
| "model.layers.*.self_attn.o_proj", | |
| "model.layers.*.self_attn.q_a_proj", | |
| "model.layers.*.self_attn.q_b_proj" | |
| ], | |
| "quant_algo": "MIXED_PRECISION", | |
| "producer": { | |
| "name": "modelopt", | |
| "version": "0.47.0rc1.dev129+g333ace1bc" | |
| }, | |
| "quant_method": "modelopt", | |
| "quantized_layers": { | |
| "model.layers.1.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.10.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.11.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.12.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.13.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.14.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.15.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.16.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.17.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.18.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.19.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.2.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.20.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.21.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.22.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.23.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.24.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.25.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.26.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.27.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.28.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.29.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.3.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.30.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.31.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.32.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.33.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.34.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.35.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.36.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.37.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.38.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.39.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.4.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.40.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.41.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.42.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.43.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.44.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.45.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.46.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.5.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.6.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.7.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.8.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| }, | |
| "model.layers.9.mlp.experts": { | |
| "quant_algo": "NVFP4", | |
| "group_size": 16 | |
| } | |
| } | |
| } | |
| } |