pixellock / README.md
solarkyle's picture
Add live-GPU banner + point CPU note to the GPU Space
c5ed891 verified
|
Raw
History Blame Contribute Delete
3.17 kB
metadata
title: PixelLock
emoji: 🎨
colorFrom: purple
colorTo: indigo
sdk: docker
app_port: 7860
pinned: true
license: gemma
short_description: Footprint-locked AI pixel-art retexturing
models:
  - solarkyle/pixellock-gemma-12b-pixelart-gguf
tags:
  - gradio
  - build-small-hackathon
  - track:wood
  - sponsor:modal
  - achievement:offbrand
  - achievement:welltuned
  - achievement:llama
  - achievement:sharing
  - achievement:fieldnotes
  - achievement:offgrid
  - best-demo
  - bonus-quest-champion
  - pixel-art

🎨 PixelLock β€” AI Pixel-Art Retexturing

Upload a sprite, pick a vibe (or write your own), hit Run. PixelLock restyles the colors and shading while keeping the exact silhouette β€” pixel-perfect, guaranteed by construction.

⚠️ This Space runs on CPU (the hackathon org has no dedicated-GPU credits), so live edits won't run here. β–Ά Try it live on GPU β†’ https://huggingface.co/spaces/solarkyle/pixellock (cold-starts ~60s) β€” or watch the 45-second demo video linked below.

πŸ”— Links

The idea: the wrong model on purpose

PixelLock does not use an image generator. It uses a fine-tuned text LLM (Gemma-4-12B). The sprite is serialized to a tiny text wire β€” a PALETTE block plus a GRID of space-separated cells β€” and the model rewrites that text in a new style. The trick is a per-sprite GBNF decoding grammar (llama.cpp): every transparent cell is pinned to a fixed literal, so the model is physically incapable of moving a pixel. The footprint and transparency are preserved by construction, not by luck. It's language modeling, not diffusion β€” and that's exactly why the shape can never break.

In a benchmark, no model could emit a correct 32Γ—32 grid unconstrained (~0/150 attempts); the grammar takes validity from 0% β†’ 100% at every size (16Γ—16 β†’ 128Γ—128, incl. 2Γ— upscale), footprint-perfect every time.

The tech

  • Fine-tuned model β€” QLoRA fine-tune of Gemma-4-12B (trained on Modal, A100-80GB) on a curated corpus of palette-indexed pixel-art sprites (≀64px); completion-only loss, step-checkpointing, final eval loss 0.378. Exported to GGUF (q4_k_m).
  • Grammar-constrained decoding β€” a per-sprite GBNF grammar compiled from the input footprint; the silhouette is locked in the decoder, not post-filtered.
  • Custom Gradio UI β€” a heavily themed gr.Blocks interface (Off-Brand) that builds the grammar per upload, footprint-checks the output, and shows you the raw text the model wrote.
  • Serving β€” Docker GPU Space running llama.cpp llama-server (CUDA) with the per-request grammar; auto-sleeps when idle.

Built for the Build Small hackathon Β· Thousand Token Wood track.