# Bonsai Image 4B — Setup Reference

Setup performed 2025-06-05 on debian-ai (Debian 13, RTX 2080 Ti 11GB, CUDA 12.6, driver 550).

## Location

- Repo: `/home/rurouni/Bonsai-Image-Demo/`
- Models: `~/Bonsai-Image-Demo/models/bonsai-image-4B-ternary-gemlite/`
  - Transformer: `transformer-gemlite-int2` (ternary, 1.21 GB)
  - Text encoder: `text_encoder-hqq-4bit`
  - VAE: `vae`
- Outputs: `~/Bonsai-Image-Demo/outputs/`

## Runtime Configuration

- **Backend port**: 8001 (8000 is used by Open Terminal)
- **Frontend port**: 3000
- **Model variant**: ternary-gemlite (1.58-bit, recommended over binary)
- **Inference stack**: Python 3.x + diffusers + gemlite 0.4.7 + HQQ
- **Peak VRAM**: ~5.9 GiB at 512×512, ~6.8 GiB at 1024×1024

## Service

Not running as systemd — started on demand via:
```bash
cd ~/Bonsai-Image-Demo && BACKEND_PORT=8001 bash scripts/serve.sh
```

## Health

- Backend: `http://localhost:8001/backends` → `{"healthy": true, "supported_families": ["bonsai-ternary"]}`
- API docs: `http://localhost:8001/docs`
- Web UI: `http://localhost:3000`

## Generated Test

Test image at `~/Bonsai-Image-Demo/outputs/test_bonsai.png` (512×512, 356 KB).

## Related

- Bonsai-8B text model (Q1_0, llama.cpp) runs via llama-swap as `bonsai-8b` — completely separate stack, no conflict.
