Instructions to use vladimir94/flux2-klein-4b-stamp-filter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use vladimir94/flux2-klein-4b-stamp-filter with PEFT:
Task type is invalid.
- Diffusers
How to use vladimir94/flux2-klein-4b-stamp-filter 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("unsloth/FLUX.2-klein-4B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("vladimir94/flux2-klein-4b-stamp-filter") prompt = "Turn this cat into a dog" 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] - Notebooks
- Google Colab
- Kaggle
flux2-klein-4b-stamp-filter
LoRA adapter for unsloth/FLUX.2-klein-4B that turns a photo into a grainy, print-textured field-notes illustration on a white background.
This is an image-conditioned (image-to-image) adapter. It was trained on photo โ illustration pairs with the photo fed to the model as reference tokens, so at inference you must pass a condition image โ plain text-to-image with this adapter is not the intended use.
Trigger word: stamp
Example
Input photo (left) and the adapter's output (right), held-out photo, 4 sampling steps.
Usage
import torch
from diffusers import Flux2KleinPipeline
from PIL import Image
pipe = Flux2KleinPipeline.from_pretrained(
"unsloth/FLUX.2-klein-4B", torch_dtype=torch.float16
)
pipe.load_lora_weights("vladimir94/flux2-klein-4b-stamp-filter")
pipe.to("mps") # or "cuda"
cond = Image.open("photo.jpg").convert("RGB")
out = pipe(
image=cond,
prompt="stamp",
num_inference_steps=4, # Klein is step-distilled; 4 steps is enough
guidance_scale=1.0, # ignored by step-distilled models anyway
).images[0]
out.save("stamp.png")
Output size follows the condition image's aspect ratio (training used aspect-preserving resize, no cropping).
Training details
- Base model: unsloth/FLUX.2-klein-4B (Flux2Transformer2DModel)
- Task: paired image-to-image โ condition photo appended as extra latent tokens, loss on target tokens only
- Dataset: 233 photo โ isolated-drawing-on-white pairs, all captioned
stamp - Rank / alpha: 8 / 8, targeting
to_qkv_mlp_proj,to_q,to_k,to_v,to_out.0 - Resolution: up to 768ร768 total area, aspect preserved, downscale-only, no center crop
- Steps: 700 (~3 epochs), lr 1e-4 constant, fp16 (full LoRA, not quantized), batch 1
- Hardware: Apple Silicon (MPS), ~3 hours
- Final mean loss: 0.60
Limitations
- Requires a condition image; without one the output is unpredictable.
- Best on landscape/nature photos similar to the training set (field-notes subjects).
- 4-step sampling only โ the base model is step-distilled; more steps can wash out detail.
Framework versions
- PEFT 0.18.1
- diffusers 0.40.0.dev0
- Downloads last month
- -
Model tree for vladimir94/flux2-klein-4b-stamp-filter
Base model
unsloth/FLUX.2-klein-4B