Files
zen-vl/QUICK_START.md
zeekay f41b6b1d02 Initial commit: Zen VL vision-language models
- Complete training infrastructure for 4B/8B/30B models
- Identity fine-tuning with Zen branding
- Function calling with visual context
- Visual agent capabilities (GUI interaction, parameter extraction)
- Research paper outline and documentation
- Makefile automation for complete pipeline

Models:
- zen-vl-4b-instruct: Base vision-language with identity
- zen-vl-4b-agent: Function calling and tool use
- zen-vl-8b-instruct/agent: General-purpose VL
- zen-vl-30b-instruct/agent: Frontier VL performance

Based on Qwen3-VL architecture with:
- 256Kโ†’1M context window
- OCR in 32 languages
- Video understanding
- Spatial grounding
2025-11-04 08:22:02 -08:00

4.7 KiB

Zen VL - Quick Start Guide

Get started with Zen VL vision-language models in minutes!

๐Ÿš€ Quick Setup

1. Install Dependencies

cd /Users/z/work/zen/zen-vl
make install

Or manually:

pip install -r requirements.txt

2. Download Base Model

# For zen-vl-4b (recommended for getting started)
make download-4b

# For zen-vl-8b
make download-8b

# For zen-vl-30b (requires ~62GB)
make download-30b

3. Train Models

# Train complete pipeline (instruct + agent)
make all SIZE=4b

# Or train individually:
make train-instruct SIZE=4b   # Zen identity (~30 min)
make train-agent SIZE=4b      # Function calling (~45 min)

๐Ÿ“Š What Gets Trained

zen-vl-4b-instruct

  • Purpose: Base vision-language with Zen identity
  • Training: ~150 identity examples
  • Time: ~30 minutes (M1/M2 Mac)
  • Use Cases: Image analysis, OCR, visual Q&A

zen-vl-4b-agent

  • Purpose: Function calling and tool use
  • Training: ~500 function calling examples
  • Time: ~45 minutes
  • Use Cases: GUI automation, visual parameter extraction, structured output

๐Ÿงช Testing

After training:

make test

This will test:

  • โœ… Identity consistency
  • โœ… Visual understanding
  • โœ… Function calling accuracy
  • โœ… Structured output generation

๐Ÿ’ป Using the Models

Basic Inference (Instruct)

from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
from PIL import Image

# Load model
model = Qwen3VLForConditionalGeneration.from_pretrained(
    "/Users/z/work/zen/zen-vl/instruct/finetuned",
    device_map="auto"
)
processor = AutoProcessor.from_pretrained(
    "/Users/z/work/zen/zen-vl/instruct/finetuned"
)

# Process image
image = Image.open("example.jpg")
prompt = "What's in this image?"

messages = [{"role": "user", "content": prompt}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=text, images=image, return_tensors="pt").to(model.device)

# Generate
outputs = model.generate(**inputs, max_new_tokens=256)
response = processor.decode(outputs[0], skip_special_tokens=True)
print(response)

Function Calling (Agent)

# Load agent model
model = Qwen3VLForConditionalGeneration.from_pretrained(
    "/Users/z/work/zen/zen-vl/agent/finetuned",
    device_map="auto"
)

# Define tools
tools = [
    {
        "name": "image_analysis",
        "description": "Analyze image content",
        "parameters": {
            "objects": {"type": "array"},
            "scene": {"type": "string"}
        }
    }
]

# Prompt with image and tools
image = Image.open("beach.jpg")
prompt = f"Analyze this image and call the appropriate tool.\\n\\nTools: {tools}"

# Model will return structured JSON function call

๐Ÿ“‚ Model Locations

After training, your models are at:

  • Instruct: /Users/z/work/zen/zen-vl/instruct/finetuned/
  • Agent: /Users/z/work/zen/zen-vl/agent/finetuned/

๐ŸŽฏ Next Steps

1. Upload to HuggingFace (Coming Soon)

export HF_TOKEN=your_token
make upload

2. Convert to GGUF (Coming Soon)

make gguf

3. Convert to MLX (Coming Soon)

make mlx

4. Work on Paper

cd paper
# Edit sections, run experiments, generate figures

๐Ÿ› Troubleshooting

Issue: Download fails

Solution: Check your HuggingFace token and internet connection

huggingface-cli login

Issue: Out of memory during training

Solution: Reduce batch size in training scripts or use gradient accumulation

Issue: MPS errors on Mac

Solution: Training scripts automatically handle MPS. If issues persist, set:

use_mps = False  # in train_*.py scripts

Issue: Model not loading

Solution: Ensure you have the dev version of transformers:

pip install git+https://github.com/huggingface/transformers

๐Ÿ“š Learn More

  • LLM.md: Technical details and architecture
  • README.md: Full documentation
  • paper/outline.md: Research paper plan
  • scripts/: Training code to modify

๐Ÿ’ก Tips

  1. Start with 4B: Fastest to download and train
  2. Test incrementally: Test after each training stage
  3. Save checkpoints: Training scripts auto-save every 20-25 steps
  4. Monitor logs: Check {model}/training/logs/ for progress
  5. Use examples: See examples/ directory for usage patterns

๐ŸŽ‰ Success Indicators

You know it's working when:

  • โœ… Model responds "I'm Zen VL..." to "Who are you?"
  • โœ… Returns valid JSON for function calls
  • โœ… Extracts parameters from images correctly
  • โœ… Maintains identity across text and visual prompts

Ready to build? Start with make download-4b and make all SIZE=4b!