FLUX.2 Klein
FLUX.2 Klein — Clore.ai GPUs पर sub-second image generation
अंतिम अपडेट
क्या यह उपयोगी था?
क्या यह उपयोगी था?
import torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein",
torch_dtype=torch.bfloat16
)
pipe.to("cuda")
# < 0.5 सेकंड में इमेज जनरेट करें!
image = pipe(
prompt="a cyberpunk GPU mining rig in a neon-lit server room, photorealistic",
height=1024,
width=1024,
num_inference_steps=4, # Klein को सिर्फ 4 चरण चाहिए!
guidance_scale=3.5,
).images[0]
image.save("output.png")pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein",
torch_dtype=torch.bfloat16
)
pipe.enable_model_cpu_offload() # 16GB में फिट होता है
pipe.vae.enable_tiling() # ~2GB बचाता है
image = pipe("a mountain landscape at sunset", num_inference_steps=4).images[0]# ComfyUI के लिए मॉडल डाउनलोड करें
cd ComfyUI/models/diffusion_models/
wget https://huggingface.co/black-forest-labs/FLUX.2-klein/resolve/main/flux2-klein.safetensorsimport torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein", torch_dtype=torch.bfloat16
).to("cuda")
prompts = [
"a red sports car on a mountain road, cinematic",
"a cozy coffee shop interior, warm lighting",
"an astronaut floating above Earth, hyperrealistic",
"a medieval castle in autumn, fantasy art",
# ... सैकड़ों और जोड़ें
]
for i, prompt in enumerate(prompts):
image = pipe(prompt, num_inference_steps=4, guidance_scale=3.5).images[0]
image.save(f"batch_{i:04d}.png")
print(f"Generated {i+1}/{len(prompts)}")
# RTX 4090 पर: ~100 इमेज एक मिनट से कम में!pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein", torch_dtype=torch.bfloat16
).to("cuda")
# FLUX आर्किटेक्चर पर प्रशिक्षित LoRA लोड करें
pipe.load_lora_weights("your-lora/flux2-style-lora", weight_name="lora.safetensors")
pipe.fuse_lora(lora_scale=0.8)
image = pipe("a portrait in the trained style", num_inference_steps=4).images[0]