Skip to content

Instantly share code, notes, and snippets.

@alvarobartt
Last active August 31, 2024 08:42
Show Gist options
  • Save alvarobartt/bdfdc80619592da214ea817dd84ecc0a to your computer and use it in GitHub Desktop.
Save alvarobartt/bdfdc80619592da214ea817dd84ecc0a to your computer and use it in GitHub Desktop.
Run FLUX LoRA with `diffusers` with `alvarobartt/ghibli-characters-flux-lora` adapter weights
import torch
from diffusers import DiffusionPipeline
model_id = "black-forest-labs/FLUX.1-dev"
adapter_id = "alvarobartt/ghibli-characters-flux-lora"
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
pipeline.load_lora_weights(adapter_id)
pipeline.to("cuda")
prompt = (
"Ghibli style futuristic stormtrooper with glossy white armor and a sleek helmet,"
" standing heroically on a lush alien planet, vibrant flowers blooming around, soft"
" sunlight illuminating the scene, a gentle breeze rustling the leaves"
)
image = pipeline(
prompt=prompt,
num_inference_steps=30,
width=1024,
height=768,
guidance_scale=3.5,
lora_scale=1.0,
).images[0]
image.save("ghibli.png", format="PNG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment