CoolFace
Apppublic

anr2me/klein-build-small-starter

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes
App README

FLUX.2 [klein] 4B — Build Small Starter

A starting point for the Build Small Hackathon. One small, open-weights image model that does three things you can build a whole project on:

  • —Text → Image — type a prompt, get an image.
  • —Image → Image — drop a photo, restyle or edit it.
  • —Your LoRA — load a .safetensors you trained and compare base vs your fine-tune.

The model is `FLUX.2-klein-4B`: 4 billion parameters, Apache 2.0, runs in ~13 GB VRAM, generates in about a second on a single GPU. It is well under the hackathon's 32B ceiling, the Space loads the open weights and runs them on its own GPU, and there's nothing to set up — no token, no gating. (klein also comes in a 9B and in 50-step base training variants — see "The klein family" below and the Train a LoRA tab.)

Use it

Just want to play? Open the tabs above.

Building a project? Click ⋮ → Duplicate this Space, pick a GPU (ZeroGPU works), and you have a running base to fork. Everything you need is in the Files tab — including how to train your own LoRA.

Why this fits "Build Small"

Hackathon rule / badgeHow this Space gives it to you
Models ≤ 32Bklein 4B is 4B params, Apache 2.0.
Built on Gradio + SpacesThis is a Gradio Space — fork it.
🔌 Off the Grid (no cloud APIs)Open weights run locally on the Space GPU.
🎨 Off-Brand (custom frontend)Three tabs already built; restyle freely.
🎯 Well-Tuned (use a fine-tuned model)TRAIN_A_LORA.md → a LoRA in ~30 min, then the Your LoRA tab.

What's in the Files tab

FileWhat it's for
app.pyThis Space. Read it — it's ~250 lines and commented.
TRAIN_A_LORA.mdTrain a klein LoRA on a $0.50 GPU in ~30 min, with a ready config.
configs/my_lora_klein_4b.yamlDrop-in AI Toolkit config. Change the trigger word and dataset path.
STARTER_IDEAS.mdThree forkable project briefs, one per track + bonus badges.
PROMPTING.mdThe do's and don'ts that separate good klein output from mush.

The klein family

This Space runs klein 4B distilled. For reference, the full family is a 2×2: size (4B / 9B) × variant (distilled / base).

ModelUse whenStepsLicense
FLUX.2-klein-4B (distilled)What this Space runs4Apache 2.0
FLUX.2-klein-base-4BTraining 4B LoRAs (the target)50Apache 2.0
FLUX.2-klein-9B (distilled)Higher fidelity, if you need it4FLUX non-commercial
FLUX.2-klein-base-9BTraining 9B LoRAs50FLUX non-commercial

All four load with the same Flux2KleinPipeline — switching is a one-line model ID change. We kept this starter to the single 4B distilled model on purpose: it's the smallest, fastest, Apache-2.0, zero-setup option, which is exactly the "Build Small" thesis. The base checkpoints are LoRA-training targets (see Train a LoRA); the 9B models are gated on the Hub and need an HF_TOKEN.

Footgun worth knowing

In the editing call, image is the first positional argument and prompt is the second. Always pass both by keyword — pipe(prompt=…, image=…) — or your prompt silently binds to image. app.py already does this.


Links: [FLUX.2 [klein]](https://huggingface.co/black-forest-labs/FLUX.2-klein-4B) · GitHub (official inference code) · Docs · Build Small Hackathon

Built by Black Forest Labs for Build Small. Questions → docs.bfl.ai.