CoolFace
Apppublic

hugging-apps/bonsai-image-ternary-4b-litert

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
App README

Bonsai Image 4B — LiteRT

A ternary-weight diffusion transformer (FLUX.2-klein-4B architecture) converted to LiteRT for on-device text-to-image. The entire pipeline runs in three fixed-shape .tflite graphs on CPU — no torch, no diffusers.

Model: `litert-community/Bonsai-Image-ternary-4B`

How it works

  1. 1.Text encoder (Qwen3-4B, int4) — tokenizes the prompt and produces embeddings
  2. 2.DiT (Flux2Transformer2DModel, int4 block-32, 3.88B params) — FlowMatch-Euler sampling loop
  3. 3.VAE decoder (fp32) — decodes latents to a 512×512 RGB image

The host loop handles tokenization, the FlowMatch-Euler sigma schedule, and latent unpatchify — all in numpy. Output is fixed at 512×512, 256 prompt tokens, 4 sampling steps by default (the model is step-distilled; more steps also work).

License

Apache-2.0, following the upstream prism-ml/bonsai-image-ternary-4B release.