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
- 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
Commit ·
ce81c56
1
Parent(s): a2f57c7
Added attn_imp in config
Browse files- configuration_chatglm.py +2 -0
configuration_chatglm.py
CHANGED
|
@@ -17,6 +17,7 @@ class ChatGLMConfig(PretrainedConfig):
|
|
| 17 |
kernel_size=64,
|
| 18 |
kernel_stride=64,
|
| 19 |
window_size=512,
|
|
|
|
| 20 |
topk=16,
|
| 21 |
init_blocks=1,
|
| 22 |
local_blocks=2,
|
|
@@ -38,6 +39,7 @@ class ChatGLMConfig(PretrainedConfig):
|
|
| 38 |
fp32_residual_connection=False,
|
| 39 |
**kwargs
|
| 40 |
):
|
|
|
|
| 41 |
self.num_layers = num_layers
|
| 42 |
self.vocab_size = padded_vocab_size
|
| 43 |
self.padded_vocab_size = padded_vocab_size
|
|
|
|
| 17 |
kernel_size=64,
|
| 18 |
kernel_stride=64,
|
| 19 |
window_size=512,
|
| 20 |
+
attn_implementation="nsa",
|
| 21 |
topk=16,
|
| 22 |
init_blocks=1,
|
| 23 |
local_blocks=2,
|
|
|
|
| 39 |
fp32_residual_connection=False,
|
| 40 |
**kwargs
|
| 41 |
):
|
| 42 |
+
self.attn_implementation = attn_implementation
|
| 43 |
self.num_layers = num_layers
|
| 44 |
self.vocab_size = padded_vocab_size
|
| 45 |
self.padded_vocab_size = padded_vocab_size
|