GLM-4.7-Flash
Deploy GLM-4.7-Flash (30B MoE) by Zhipu AI on Clore.ai — efficient language model with 59.2% SWE-bench performance
Last updated
Was this helpful?
Was this helpful?
pip install vllm>=0.6.0
# or latest
pip install git+https://github.com/vllm-project/vllm.gitvllm serve THUDM/glm-4-flash \
--model THUDM/glm-4-flash \
--tensor-parallel-size 1 \
--dtype float16 \
--max-model-len 32768 \
--served-model-name glm-4.7-flash \
--trust-remote-codefrom openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="EMPTY"
)
response = client.chat.completions.create(
model="glm-4.7-flash",
messages=[
{"role": "system", "content": "You are an expert Python developer."},
{"role": "user", "content": "Write a FastAPI app with async SQLAlchemy and JWT auth"}
],
max_tokens=2048,
temperature=0.7
)
print(response.choices[0].message.content)pip install "sglang[all]>=0.3.0"
# Launch server
python -m sglang.launch_server \
--model-path THUDM/glm-4-flash \
--port 30000 \
--host 0.0.0.0 \
--dtype float16 \
--tp-size 1 \
--context-length 32768# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull model (will download ~18GB)
ollama pull glm4:7b-chat
# Run interactively
ollama run glm4:7b-chat
# API mode
ollama serveimport requests
response = requests.post('http://localhost:11434/api/generate',
json={
'model': 'glm4:7b-chat',
'prompt': 'Explain the MoE architecture in GLM-4.7-Flash',
'stream': False
}
)
print(response.json()['response'])FROM nvidia/cuda:12.1-devel-ubuntu22.04
# Install Python 3.10
RUN apt-get update && apt-get install -y python3.10 python3-pip curl
# Install vLLM
RUN pip install vllm>=0.6.0 transformers
# Pre-download model (optional)
# RUN python3 -c "from transformers import AutoModel; AutoModel.from_pretrained('THUDM/glm-4-flash', trust_remote_code=True)"
EXPOSE 8000
CMD ["vllm", "serve", "THUDM/glm-4-flash", \
"--host", "0.0.0.0", \
"--port", "8000", \
"--tensor-parallel-size", "1", \
"--dtype", "float16", \
"--trust-remote-code"]docker build -t glm-4.7-flash .
docker run --gpus all -p 8000:8000 glm-4.7-flashfrom openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="glm-4.7-flash",
messages=[
{"role": "user",
"content": """Create a Python class for a rate limiter with:
- Token bucket algorithm
- Async/await support
- Redis backend
- Decorator for function rate limiting
- Proper error handling"""}
],
max_tokens=2048,
temperature=0.3
)
print(response.choices[0].message.content)