Instructions to use Maxtimer97/GLM2NSA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Maxtimer97/GLM2NSA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Maxtimer97/GLM2NSA", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Maxtimer97/GLM2NSA", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Maxtimer97/GLM2NSA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Maxtimer97/GLM2NSA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Maxtimer97/GLM2NSA", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Maxtimer97/GLM2NSA
- SGLang
How to use Maxtimer97/GLM2NSA 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 "Maxtimer97/GLM2NSA" \ --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": "Maxtimer97/GLM2NSA", "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 "Maxtimer97/GLM2NSA" \ --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": "Maxtimer97/GLM2NSA", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Maxtimer97/GLM2NSA with Docker Model Runner:
docker model run hf.co/Maxtimer97/GLM2NSA
| { | |
| "add_bias_linear": false, | |
| "add_qkv_bias": true, | |
| "apply_query_key_layer_scaling": true, | |
| "apply_residual_connection_post_layernorm": false, | |
| "architectures": [ | |
| "ChatGLM2NSAForCausalLM" | |
| ], | |
| "attention_dropout": 0.0, | |
| "attention_softmax_in_fp32": true, | |
| "attn_implementation": "nsa", | |
| "auto_map": { | |
| "AutoConfig": "configuration_chatglm.ChatGLMConfig", | |
| "AutoModel": "modeling_chatglm.ChatGLMForConditionalGeneration", | |
| "AutoModelForCausalLM": "modeling_chatglm.ChatGLMForConditionalGeneration", | |
| "AutoModelForSeq2SeqLM": "modeling_chatglm.ChatGLMForConditionalGeneration", | |
| "AutoModelForSequenceClassification": "modeling_chatglm.ChatGLMForSequenceClassification" | |
| }, | |
| "bias_dropout_fusion": true, | |
| "block_size": 64, | |
| "classifier_dropout": null, | |
| "dtype": "bfloat16", | |
| "eos_token_id": [ | |
| 151329, | |
| 151336, | |
| 151338 | |
| ], | |
| "ffn_hidden_size": 13696, | |
| "fp32_residual_connection": false, | |
| "hidden_dropout": 0.0, | |
| "hidden_size": 4096, | |
| "init_blocks": 1, | |
| "kernel_size": 64, | |
| "kernel_stride": 64, | |
| "kv_channels": 128, | |
| "layernorm_epsilon": 1.5625e-07, | |
| "local_blocks": 2, | |
| "model_type": "chatglm", | |
| "multi_query_attention": true, | |
| "multi_query_group_num": 2, | |
| "num_attention_heads": 32, | |
| "num_hidden_layers": 40, | |
| "num_layers": 40, | |
| "original_rope": true, | |
| "pad_token_id": 151329, | |
| "padded_vocab_size": 151552, | |
| "post_layer_norm": true, | |
| "rmsnorm": true, | |
| "rope_ratio": 500, | |
| "seq_length": 131072, | |
| "tie_word_embeddings": false, | |
| "topk": 16, | |
| "transformers_version": "4.56.1", | |
| "use_cache": true, | |
| "vocab_size": 151552, | |
| "window_size": 512 | |
| } | |