tools / run_lora_on_off.py
patrickvonplaten's picture
[Speculative Decoding] Add speculative decoding
d8d872a
#!/usr/bin/env python3
#@title Fuse/unfuse LoRAs sequentially leading to trouble
import torch
from diffusers import StableDiffusionXLPipeline
pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16",
).to("cuda")
pipe.load_lora_weights("Pclanglais/TintinIA")
pipe.fuse_lora()
images = pipe("a mecha robot", num_inference_steps=2)
pipe.unfuse_lora()
pipe.unload_lora_weights()
pipe.load_lora_weights("ProomptEngineer/pe-balloon-diffusion-style")
pipe.fuse_lora()
images = pipe("a mecha robot", num_inference_steps=2)
pipe.unfuse_lora()
pipe.unload_lora_weights()
pipe.load_lora_weights("ostris/crayon_style_lora_sdxl")
pipe.fuse_lora()
images = pipe("a mecha robot", num_inference_steps=2)
pipe.unfuse_lora()
pipe.unload_lora_weights()
pipe.load_lora_weights("joachimsallstrom/aether-cloud-lora-for-sdxl")
pipe.fuse_lora()
images = pipe("a mecha robot", num_inference_steps=2)
pipe.unfuse_lora()
pipe.unload_lora_weights()