SLAM
Collection
Sub-path Linear Approximation Model (SLAM)
•
3 items
•
Updated
•
1
Paper: https://arxiv.org/abs/2404.13903
Project Page: https://subpath-linear-approx-model.github.io/
The checkpoint is a distilled from stabilityai/stable-diffusion-xl-base-1.0 with our proposed Sub-path Linear Approximation Model, which reduces the number of inference steps to only between 2-4 steps.
First, install the latest version of the Diffusers library as well as peft, accelerate and transformers.
pip install --upgrade pip
pip install --upgrade diffusers transformers accelerate peft
We implement SLAM to be compatible with LCMScheduler. You can use SLAM-LoRA just like you use LCM-LoRA.
import torch
from diffusers import LCMScheduler, AutoPipelineForText2Image
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
adapter_id = "alimama-creative/slam-lora-sdxl"
pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")
# load and fuse lcm lora
pipe.load_lora_weights(adapter_id)
pipe.fuse_lora()
prompt = "A brown teddy bear holding a glass vase in front of a grave."
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=1.0).images[0]
Compare with latent-consistency/lcm-lora-sdxl.
More examples:
Base model
stabilityai/stable-diffusion-xl-base-1.0