# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("zenlm/zen4-coder")
model = AutoModelForCausalLM.from_pretrained("zenlm/zen4-coder")
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]:]))Quick Links
Zen4 Coder
Zen LM by Hanzo AI — Code-specialized model for generation, review, debugging, and refactoring.
Specs
| Property | Value |
|---|---|
| Parameters | 480B MoE |
| Context | 163K |
| Architecture | Zen MoDE (Mixture of Distilled Experts) |
| Generation | Zen4 |
API Access
curl https://api.hanzo.ai/v1/chat/completions \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "zen4-coder", "messages": [{"role": "user", "content": "Hello"}]}'
Get your API key at console.hanzo.ai — $5 free credit on signup.
License
Apache 2.0
Zen LM is developed by Hanzo AI — Frontier AI infrastructure.
- Downloads last month
- 8
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zenlm/zen4-coder") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)