Trout / index.html
FrameXlabs's picture
static landing page
60e80db verified
Raw History Blame Contribute Delete
10.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Trout · 16×16 pixel-art diffusion language model</title>
<style>
:root {
--ink: #101828; --sub: #475467; --line: #e4e7ec;
--bg: #f8f9fc; --card: #ffffff; --accent: #2563eb; --accent2: #0e7490;
--chip: #eef2ff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.65 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px 80px; }
header { padding: 64px 0 8px; text-align: center; }
.fish { font-size: 52px; }
h1 { margin: 8px 0 6px; font-size: 40px; letter-spacing: -1px; }
.tag { color: var(--sub); max-width: 720px; margin: 0 auto; }
.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.badge { background: var(--chip); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
section { margin-top: 44px; }
h2 { font-size: 22px; margin: 0 0 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td:first-child { color: var(--sub); white-space: nowrap; width: 34%; }
tr:last-child td { border-bottom: 0; }
.metric { font-variant-numeric: tabular-nums; }
img.showcase { width: 100%; image-rendering: pixelated; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 12px 16px; font-size: 14.5px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre { background: #0f172a; color: #dbeafe; padding: 16px 18px; border-radius: 10px; overflow: auto; font-size: 13px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
#pal { display: grid; grid-template-columns: repeat(64, 1fr); gap: 1px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#pal div { aspect-ratio: 1; }
footer { margin-top: 60px; color: var(--sub); font-size: 13.5px; text-align: center; border-top: 1px solid var(--line); padding-top: 20px; }
.pill-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-size: 13.5px; background: #fff; }
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="fish">🐟</div>
<h1>Trout</h1>
<p class="tag">A <b>47.6M-parameter diffusion language model</b> for 16×16 pixel art.
Each sprite is a 256-token “sentence” over a learned 512-color palette; a
bidirectional hourglass transformer unmasks every pixel <b>in parallel over ~16 steps</b>,
conditioned on a frozen CLIP text tower. No VAE, no latent space, no autoregression.</p>
<div class="badges">
<span class="badge">from scratch</span>
<span class="badge">absorbing-state masked diffusion</span>
<span class="badge">47,597,568 params</span>
<span class="badge">Pixel Art Atlas 1.4M · CC0</span>
<span class="badge">Apache-2.0</span>
</div>
</header>
<section>
<h2>Samples — 16 prompts × 4 sprites (steps 16, CFG 3.0)</h2>
<div class="card">
<img class="showcase" src="showcase.png" alt="Trout sample grid">
<p style="color:var(--sub); font-size:14px; margin: 10px 4px 0;">
Prompts: red health potion bottle · golden crown with blue gems · green slime monster ·
iron sword with a leather hilt · wooden treasure chest · pink cherry blossom tree ·
blue magic spellbook · orange fox head · glowing purple crystal · cheeseburger ·
skull with a candle · rocket ship · brown leather boots · yellow rubber duck ·
ice cream cone · black cat.</p>
</div>
</section>
<section>
<h2>How it works</h2>
<div class="grid2">
<div class="card">
<table>
<tr><td>Architecture</td><td>joint text+pixel bidirectional transformer, hourglass 2+8+2 blocks (2×2 patch-merged core), width 512, 8 heads, QK-RMSNorm, 2D axial RoPE, Conv-SwiGLU, adaLN-single, 4 registers, self-conditioning</td></tr>
<tr><td>Vocabulary</td><td>512 palette tokens (frequency-weighted OKLab k-means, mean ΔE 0.0099) + <code>&lt;MASK&gt;</code></td></tr>
<tr><td>Objective</td><td>absorbing-state masked diffusion, cosine schedule, stratified t, blob masks, perceptual OKLab label smoothing, CFG dropout</td></tr>
<tr><td>Sampler</td><td>parallel confidence-ordered unmasking + CFG, Gumbel-annealed choice, spatial NMS, self-conditioning</td></tr>
<tr><td>Text encoder</td><td>frozen CLIP ViT-B/32 text tower (24 tokens)</td></tr>
<tr><td>Optimizer</td><td>Muon (hidden matrices) + AdamW, Warmup-Stable-Decay, EMA</td></tr>
</table>
</div>
<div class="card">
<table>
<tr><td>Training data</td><td class="metric">Pixel Art Atlas 1.4M (Angais, CC0), 60k-sprite subset</td></tr>
<tr><td>Steps × batch</td><td class="metric">2,400 × 8 sprites (CPU fp32, 2 vCPU / 4 GB)</td></tr>
<tr><td>Validation NLL</td><td class="metric">2.164 nats / pixel (perplexity 8.81 of 512)</td></tr>
<tr><td>Validation accuracy</td><td class="metric">55.8% of masked pixels</td></tr>
<tr><td>CLIP score (ViT-B/32)</td><td class="metric">0.2285 generated · 0.2556 real</td></tr>
<tr><td>Reference run</td><td class="metric">Tessera-small: 82,342 × 512 (0.859 NLL) on one RTX PRO 6000</td></tr>
</table>
<p style="color:var(--sub); font-size:13.5px; margin: 12px 4px 0;">
This is a genuine budget-limited from-scratch run on a CPU sandbox — roughly
4 orders of magnitude less compute than the reference architecture’s original
training — not a distillation or fine-tune. All numbers come from
<code>metrics.jsonl</code> in the model repo.</p>
</div>
</div>
</section>
<section>
<h2>The learned 512-color palette</h2>
<div class="card" style="padding:14px;">
<div id="pal"></div>
<p style="color:var(--sub); font-size:13.5px; margin: 10px 4px 0;">
Token 0 = transparent (checker); the 511 opaque colors were chosen by
frequency-weighted k-means in OKLab and snapped to real dataset colors.</p>
</div>
</section>
<section>
<h2>Try it</h2>
<div class="card">
<div class="pill-row" style="margin-bottom:14px;">
<span class="pill">📦 <a href="https://huggingface.co/FrameXlabs/Trout">Model weights · FrameXlabs/Trout</a></span>
<span class="pill">🧩 <a href="https://huggingface.co/datasets/Angais/pixel-art-atlas-1.4m">Dataset · Pixel Art Atlas 1.4M</a></span>
<span class="pill">✨ <a href="https://huggingface.co/thejagstudio/tessera-small">Architecture reference · Tessera-small</a></span>
</div>
<pre># pip install torch transformers huggingface_hub pillow
from huggingface_hub import hf_hub_download
from trout import load_model_from_checkpoint, FrozenTextEncoder, sample, tokens_to_images, make_grid
ckpt = hf_hub_download("FrameXlabs/Trout", "trout-fp16.pt")
model, palette, meta = load_model_from_checkpoint(ckpt, device="cpu")
enc = FrozenTextEncoder(meta["text_encoder"], model.cfg.text_len, "cpu")
states, pooled = enc.encode(["golden crown with blue gems"] * 4)
toks = sample(model, states, pooled, steps=16, cfg_scale=3.0,
generator=torch.Generator().manual_seed(0))
images = tokens_to_images(toks, palette)
make_grid(images, ncols=4).save("crowns.png")</pre>
<div class="note" style="margin-top:14px;">
This Space is a <b>static</b> page (free hosting). A complete interactive
<b>Gradio demo</b> (prompt → sprites, with CFG/steps/temperature controls) is included
in this Space’s repo (<code>app.py</code>, <code>trout.py</code>,
<code>requirements.txt</code>) and in the model repo. Hugging Face currently
requires a PRO subscription to host Gradio Spaces on free cpu-basic hardware;
once available, pointing the Space SDK at Gradio makes the demo live unchanged.
</div>
</div>
</section>
<section>
<h2>Sources</h2>
<div class="card" style="font-size:14.5px;">
<ul style="margin:0; padding-left:20px;">
<li>Tessera-small by Jagrat Patel (TheJagStudio) — the published architecture this from-scratch model implements.</li>
<li>Pixel Art Atlas 1.4M by Angais — training data (CC0).</li>
<li>Sahoo et al., <i>Simple and Effective Masked Diffusion Language Models</i>, NeurIPS 2024 (arXiv:2406.07524).</li>
<li>Shi et al., <i>Simplified and Generalized Masked Diffusion for Discrete Data</i>, NeurIPS 2024 (arXiv:2406.04329).</li>
<li>Chang et al., <i>MaskGIT</i>, CVPR 2022 (arXiv:2202.04200) — parallel confidence-ordered decoding.</li>
<li>Blecher et al., <i>Nougat</i> (arXiv:2308.13418) — hourglass transformer.</li>
<li>Peebles &amp; Xie, <i>DiT</i> (arXiv:2212.09748); PixArt-α — adaLN-single.</li>
<li>Darcet et al., <i>Vision Transformers Need Registers</i>, ICLR 2024.</li>
<li>Chen, <i>Analog Bits</i> (arXiv:2208.04202) — self-conditioning.</li>
<li>Jordan et al., <i>Muon</i> (arXiv:2502.16982); Moonshot <i>Muon is Scalable</i> (arXiv:2508.02535).</li>
<li>Ottosson, <i>OKLab</i> perceptual color space (2020).</li>
</ul>
</div>
</section>
<footer>
Trout · built and trained from scratch for <b>FrameXlabs</b> · Apache-2.0 ·
CLIP text tower (OpenAI, MIT) conditions inference but is not redistributed with the weights.
</footer>
</div>
<script src="palette.js"></script>
<script>
(function () {
const pal = document.getElementById("pal");
const cells = [];
for (let i = 0; i < PALETTE.length; i++) {
const d = document.createElement("div");
const c = PALETTE[i];
if (i === 0) {
d.style.background = "repeating-conic-gradient(#c8c8c8 0% 25%, #e6e6e6 0% 50%) 0 0 / 25% 25%";
} else {
d.style.background = "rgb(" + c[0] + "," + c[1] + "," + c[2] + ")";
}
d.title = i === 0 ? "0 · transparent" : i + " · rgb(" + c.join(",") + ")";
pal.appendChild(d);
}
})();
</script>
</body>
</html>