local Lora not loading

#7
by LolaRoseHB - opened

My local Lora is not loading. Here's the code :

from diffusers import StableDiffusion3Pipeline
import torch

model_id = "stabilityai/stable-diffusion-3.5-medium"

pipe = StableDiffusion3Pipeline.from_pretrained(
model_id,
low_cpu_mem_usage=False,
text_encoder_3=None,
tokenizer_3=None,
torch_dtype=torch.float32,
use_safetensors=True
)

lora = "my_sd35_lora"

pipe.load_lora_weights(
"/path/to/lora",
weight_name="my_sd35_lora.safetensors",
adapter_name=lora
)

pipe.set_adapters([lora], adapter_weights=[1.0])
pipe.fuse_lora()

image = pipe(
prompt="this is a prompt",
num_inference_steps=30
).images[0]

image.save("my_image.png", format="PNG")

Sign up or log in to comment