Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
zen4
zenlm
hanzo
frontier-ai
open-weight
conversational
Instructions to use zenlm/zen4-mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zenlm/zen4-mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zenlm/zen4-mini") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("zenlm/zen4-mini") model = AutoModelForImageTextToText.from_pretrained("zenlm/zen4-mini") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zenlm/zen4-mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zenlm/zen4-mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zenlm/zen4-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zenlm/zen4-mini
- SGLang
How to use zenlm/zen4-mini 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 "zenlm/zen4-mini" \ --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": "zenlm/zen4-mini", "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 "zenlm/zen4-mini" \ --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": "zenlm/zen4-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zenlm/zen4-mini with Docker Model Runner:
docker model run hf.co/zenlm/zen4-mini
| license: apache-2.0 | |
| language: | |
| - en | |
| - zh | |
| - ja | |
| - ko | |
| - fr | |
| - de | |
| - es | |
| - pt | |
| - ru | |
| - ar | |
| tags: | |
| - zen4 | |
| - zenlm | |
| - hanzo | |
| - frontier-ai | |
| - open-weight | |
| base_model: Qwen/Qwen3.5-4B | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| # Zen4 Mini | |
| **Zen4 Mini** is a 4B parameter language model from the [Zen4 family](https://zenlm.org) by [Zen LM](https://huggingface.co/zenlm) and [Hanzo AI](https://hanzo.ai). | |
| Built on open-weight weights with Zen4 Frontier architecture for unrestricted, open-ended AI assistance. | |
| ## Model Details | |
| | Property | Value | | |
| |----------|-------| | |
| | **Parameters** | 4B total, 4B active | | |
| | **Architecture** | Zen4 Frontier | | |
| | **Context** | 262K tokens | | |
| | **License** | APACHE-2.0 | | |
| | **Family** | Zen4 | | |
| | **Tier** | Small | | |
| | **Creator** | Zen LM / Hanzo AI | | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained("zenlm/zen4-mini", torch_dtype="auto") | |
| tokenizer = AutoTokenizer.from_pretrained("zenlm/zen4-mini") | |
| messages = [{"role": "user", "content": "Hello, who are you?"}] | |
| text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) | |
| inputs = tokenizer(text, return_tensors="pt").to(model.device) | |
| outputs = model.generate(**inputs, max_new_tokens=512) | |
| print(tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)) | |
| ``` | |
| ## Zen4 Family | |
| | Model | Parameters | Context | HuggingFace | | |
| |-------|-----------|---------|-------------| | |
| | Zen4 Nano | 0.8B | 262K | [zenlm/zen4-nano](https://huggingface.co/zenlm/zen4-nano) | | |
| | Zen4 Micro | 2B | 262K | [zenlm/zen4-micro](https://huggingface.co/zenlm/zen4-micro) | | |
| | **Zen4 Mini** | **4B** | **262K** | [zenlm/zen4-mini](https://huggingface.co/zenlm/zen4-mini) | | |
| | Zen4 | 9B | 262K | [zenlm/zen4](https://huggingface.co/zenlm/zen4) | | |
| | Zen4 Pro | 27B | 262K | [zenlm/zen4-pro](https://huggingface.co/zenlm/zen4-pro) | | |
| | Zen4 Max | 35B MoE (3B active) | 262K | [zenlm/zen4-max](https://huggingface.co/zenlm/zen4-max) | | |
| | Zen4 Coder Flash | 31B MoE (3B active) | 131K | [zenlm/zen4-coder-flash](https://huggingface.co/zenlm/zen4-coder-flash) | | |
| | Zen4 Pro Max | 80B MoE (3B active) | 256K | [zenlm/zen4-pro-max](https://huggingface.co/zenlm/zen4-pro-max) | | |
| | Zen4 Coder | 80B MoE (3B active) | 256K | [zenlm/zen4-coder](https://huggingface.co/zenlm/zen4-coder) | | |
| | Zen4 Mega | 122B MoE (10B active) | 262K | [zenlm/zen4-mega](https://huggingface.co/zenlm/zen4-mega) | | |
| | Zen4 Thunder | 230B MoE (10B active) | 1M | [zenlm/zen4-thunder](https://huggingface.co/zenlm/zen4-thunder) | | |
| | Zen4 Storm | 456B MoE (45B active) | 1M | [zenlm/zen4-storm](https://huggingface.co/zenlm/zen4-storm) | | |
| | Zen4 Titan | 744B MoE (40B active) | 128K | [zenlm/zen4-titan](https://huggingface.co/zenlm/zen4-titan) | | |
| | Zen4 Ultra | 1.04T MoE (32B active) | 256K | [zenlm/zen4-ultra](https://huggingface.co/zenlm/zen4-ultra) | | |
| | Zen4 Ultra Max | 1T MoE (50B active) | 128K | [zenlm/zen4-ultra-max](https://huggingface.co/zenlm/zen4-ultra-max) | | |
| ## Links | |
| - [Zen LM](https://zenlm.org) | [Hanzo AI](https://hanzo.ai) | [Hanzo Chat](https://hanzo.chat) | |
| - [All Zen Models](https://huggingface.co/zenlm) | |
| --- | |
| *Zen AI: Clarity Through Intelligence* | |