Instructions to use allura-org/GLM4-32B-Neon-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use allura-org/GLM4-32B-Neon-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="allura-org/GLM4-32B-Neon-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("allura-org/GLM4-32B-Neon-v2") model = AutoModelForCausalLM.from_pretrained("allura-org/GLM4-32B-Neon-v2", 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use allura-org/GLM4-32B-Neon-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "allura-org/GLM4-32B-Neon-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "allura-org/GLM4-32B-Neon-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/allura-org/GLM4-32B-Neon-v2
- SGLang
How to use allura-org/GLM4-32B-Neon-v2 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 "allura-org/GLM4-32B-Neon-v2" \ --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": "allura-org/GLM4-32B-Neon-v2", "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 "allura-org/GLM4-32B-Neon-v2" \ --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": "allura-org/GLM4-32B-Neon-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use allura-org/GLM4-32B-Neon-v2 with Docker Model Runner:
docker model run hf.co/allura-org/GLM4-32B-Neon-v2
Model has trouble understanding who it's supposed to talk as.
Not sure if it's because of text completion instead of chat completion. If it wants to respond as user's persona, you can't convince it otherwise. It's like it gets confused and lost in the text.
Give it a shot in chat completion (and if it works, see if switching to text completion but mimicking the sampler settings keeps it fixed.) We suspect there may some fuckery with the GLM4 template.
To debug it - please ensure that you are using the exact template, as shown in the repo, or ST presets if you are using it, check if your backend incorrectly adds BOS (this model doesn't have it, [gMASK]<sop> is not a BOS token config-wise) - some versions of llama.cpp and tabbyAPI add <|endoftext|> as BOS which is incorrect. Also, if you are using KoboldCPP - please try using recent version of llama.cpp server instead.
KoboldCpp actually has fixes for GLM that make it work in text completions making it a better choice than llamacpp server.