text-to-image · vision · CanvasGPT2 (39.1M) · onnxruntime-web@1.21.0 WASM · fp16 · 80.3 MB · CC-BY-NC-4.0

PixelSprite Canvas v2 — Autoregressive Text-to-Pixel-Sprite Transformer

The first browser-native text-to-image model page on Web AI Showcase: Ihor Umanets' 39.1M-parameter 12-layer CanvasGPT2 autoregressive decoder (ihor-umanets/pixelsprite-canvas-v2, 80.30 MB fp16 on CPU WASM) synthesizes 16×16, 24×24, and 32×32 transparent pixel sprites token-by-token over a 1,024-color OKLab palette with split shape/colour Classifier-Free Guidance and exact silhouette conditioning — running 100% locally in a Web Worker.

At a glance

Verified Hugging Face model card and artifact metadata for ihor-umanets/pixelsprite-canvas-v2
Model repo & revision ihor-umanets/pixelsprite-canvas-v2 · pinned revision 0a29494e9fc020a26feb6f97ec2047fc207ce898
Verified download artifacts onnx/decoder.onnx (527,408 B) + onnx/decoder.f16 (76,635,138 B) + onnx/embeddings.bin (3,117,056 B) + onnx/embeddings.json (1,343 B) + palette.json (15,880 B) = 80,296,825 B (80.30 MB, catalogue 80.3 MB)
Task & architecture text-to-image · CanvasGPT2 (39.1M params, 12 decoder layers, 8 heads, d_model = 512, KV-cached autoregressive next-pixel prediction over 1,024 OKLab palette tokens + empty = 1024 + BOS = 1025)
Quantization & dtype fp16 external weights (onnx/decoder.f16) expanded in-worker via a 65,536-entry LUT to fp32 (decoder.data, ~30 ms) for universal CPU WASM execution
Runtime & caching Raw onnxruntime-web@1.21.0 CPU WASM (no WebGPU required) inside dedicated worker.js; atomic OPFS storage via lib/model-store.mjs with Cache Storage read-through fallback (zero double-storage)
Conditioning & resolutions 384-d paraphrase-multilingual-MiniLM-L12-v2 text embeddings (15 bundled EN/RU/UK Apache-2.0 starter prompts + optional 2-prompt vector blend + unconditional null_cond) · 16×16, 24×24 (windowed in 32×32), and 32×32 sprites
License CC-BY-NC-4.0 (model weights © 2026 Ihor Umanets) · Apache-2.0 (inference code & starter presets)

1. Live Autoregressive Pixel-Sprite Generator

Initialise PixelSprite Canvas v2 above to synthesize a transparent pixel sprite on-device.

Interactive Autoregressive Pixel Grid

Prompt: frost sword · 16×16 Click or arrow-key any pixel cell to inspect its sampled token
1× native
2× crisp
4× crisp

See Inside · Sequence Prefix & 1,024-Color OKLab Tokens

Before pixel (0,0), CanvasGPT2 builds a prefix of 2 + S + 1 tokens (text projection + size embedding + S row-mask vectors + BOS), then decodes each pixel in raster scan order over 1,024 OKLab colors + empty (#1024).

Tokens 0..1 Text Cond (384→512) + Size Emb
Tokens 2..S+1 S Row-Mask Vectors (known/unknown)
Tokens S+2.. BOS + S² Autoregressive Pixels

Selected pixel telemetry (token ID, OKLab coordinates, p(empty), entropy) appears after generation.

Top Sampled OKLab Palette Tokens

Backend & Dtype–
Cache Store–
Grid / Seq–
Latency (Pre + Dec)–
Throughput–
Filled / Colors–
Mean Entropy–
Tensor NaN Count–

Why PixelSprite Canvas v2 matters

Conventional text-to-image diffusion models need gigabytes of VRAM and still struggle to emit clean, single-pixel transparent edges without anti-aliased haloing. PixelSprite Canvas v2 treats pixel art as a discrete 1,024-color OKLab sequence inside a 39.1M-parameter decoder that runs in 80.30 MB on plain CPU WebAssembly:

Use-case ladder

How the API works

Inside worker.js, PixelSprite Canvas v2 expands onnx/decoder.f16 to float32 via a 65,536-entry LUT, loads onnx/decoder.onnx with onnxruntime-web@1.21.0 on CPU WASM, builds the 2 + S + 1 conditioning prefix, and autoregressively decodes each pixel with KV-caching.

Show the code — worker.js: writePrefixTokens() (text cond + size + row-mask prefix tokens)
Show the code — pixelsprite-core.mjs: halfToFloatBytes() (65,536-entry fp16 → fp32 weight LUT)

References