File size: 651 Bytes
6c27fdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
import torch
from diffusers import StableDiffusionXLPipeline
  
pipe = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16,
).to("cuda")

#Fuse/unfuse first LoRA  
pipe.load_lora_weights("joachimsallstrom/aether-cloud-lora-for-sdxl")
pipe.fuse_lora()
pipe.unload_lora_weights()
pipe.unfuse_lora()

#Now it would be expected that the the LoRA has been unfused and `pipe` in the its original state, however...

#Fuse/unfuse second LoRA
pipe.load_lora_weights("jbilcke-hf/sdxl-zelda64")
pipe.fuse_lora()
pipe.unload_lora_weights()
pipe.unfuse_lora() #errors out