Views
No views yet
1import torch
2from diffusers import DiffusionPipeline
3from PIL import Image
4
5pipe = DiffusionPipeline.from_pretrained(
6 "krea/Krea-2-Turbo",
7 custom_pipeline="ostris/Krea2OstrisEdit",
8 torch_dtype=torch.bfloat16,
9)
10pipe.enable_model_cpu_offload() # or pipe.to("cuda") with ~40+ GB of VRAM
11
12# An AI-Toolkit Krea 2 LoRA, e.g. the style reference LoRA
13pipe.load_lora_weights(
14 "ostris/krea2_turbo_style_reference", weight_name="krea2_style_reference.safetensors"
15)
16
17image = pipe(
18 "a white yeti with horns reading a book",
19 image=Image.open("style_reference.png"), # one reference image or a list of them
20).images[0]
21image.save("output.png")