Instructions to use handful/fastcello-flux2-klein-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use handful/fastcello-flux2-klein-4b with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("handful/fastcello-flux2-klein-4b") prompt = "Repaint this 3D map render as mgwarm warm pixel-art map, keeping every road, building and tree in place" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
FastCello: warm pixel-art maps in 4 steps (FLUX.2 klein 4B LoRA)
Turns an oblique 3D map render into a warm pixel-art city: warm late-morning light, cool violet shadows, coloured outlines, lush layered tree canopies. It paints with the distilled FLUX.2 klein 4B in 4 steps, about 20 s per 1024 px frame on an RTX 4090. FastCello painted the cities of Mini World: Brasília, Recife, Manaus, Florianópolis, Fortaleza, João Pessoa, Belém, São Luís and São Paulo.
Image-to-image LoRA: 3D render in, painting out. Training log, rounds and scores: marceloeduardo.com/pixel-lora-training.html (FastCello log).
Recife, painted by this LoRA (1:1 pixels).
Use
import torch
from diffusers import Flux2KleinPipeline
from PIL import Image
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", torch_dtype=torch.bfloat16).to("cuda")
pipe.load_lora_weights("handful/fastcello-flux2-klein-4b")
render = Image.open("render.jpg").convert("RGB") # 1024x1024 oblique 3D render
out = pipe(image=render,
prompt="Repaint this 3D map render as mgwarm warm pixel-art map, keeping every road, building and tree in place",
width=1024, height=1024, num_inference_steps=4, guidance_scale=1.0,
generator=torch.Generator("cuda").manual_seed(0)).images[0]
out.save("painted.png")
For whole cities we paint every frame from a 1536 px window of the render mosaic (the frame plus its neighbours) and keep the middle, so neighbouring frames join without seams.
Training
Trained on FLUX.2 klein base 4B with diffusers' klein image-to-image LoRA trainer, then used on the distilled 4-step model: rank 16, 1024 px, random flips, 2,500 steps, on pairs of (oblique 3D render of a map frame → the same frame painted in the warm pixel look by Codex) from Brasília, Recife, Manaus and Florianópolis.
Evaluation
On 16 held-out frames, LPIPS against the Codex paintings (lower is closer): 0.40 on land when painted in 4 steps. Painted the slow way (base model, 28 steps) it is closer still (0.39 overall). A second Codex painting of 12 of the land frames scores 0.34 against the first, which is about the ceiling of this measure. Per-round numbers are on the log page.
Limitations and data
- Water: on open sea and wide rivers the fast model often paints land, fields or small villages instead of water. Our city pipeline replaces painted water with a water layer afterwards. Our later LoRAs fix this inside the model.
- Windows: fine window grids on towers come out less regular than in the Codex paintings.
- Input: works best on renders like the training ones: 1024×1024, about 30–45° oblique, about 3.4–4 px per metre.
- Training data: the 3D inputs are renders of Google Photorealistic 3D Tiles; Google's Map Tiles terms do not allow using their content to train models. This LoRA is shared as a research experiment for personal use; check those terms before any other use. The target paintings were made with Codex (OpenAI image generation).
- Downloads last month
- 836
Model tree for handful/fastcello-flux2-klein-4b
Base model
black-forest-labs/FLUX.2-klein-4B
