Instructions to use margin2model/flux2-klein-4b-lora-test with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use margin2model/flux2-klein-4b-lora-test with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-base-4B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("margin2model/flux2-klein-4b-lora-test") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
FLUX.2 [klein] 4B LoRA
This Diffusers LoRA was trained on black-forest-labs/FLUX.2-klein-base-4B using the
facebook/winoground dataset. It can be loaded on the fast distilled
black-forest-labs/FLUX.2-klein-4B pipeline for four-step inference.
import torch
from diffusers import Flux2KleinPipeline
from huggingface_hub import hf_hub_download
lora_path = hf_hub_download(
repo_id="margin2model/flux2-klein-4b-lora-test",
filename="pytorch_lora_weights.safetensors",
)
pipe = Flux2KleinPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein-4B",
torch_dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()
pipe.load_lora_weights(lora_path)
image = pipe(
prompt='A cinematic portrait, detailed, soft studio lighting',
num_inference_steps=4,
guidance_scale=1.0,
height=512,
width=512,
generator=torch.Generator(device="cuda").manual_seed(0),
).images[0]
image.save("image.png")
The adapter is stored as pytorch_lora_weights.safetensors in Diffusers-native FLUX.2
[klein] format.
- Downloads last month
- 7
Model tree for margin2model/flux2-klein-4b-lora-test
Base model
black-forest-labs/FLUX.2-klein-base-4B