Downloads · 30 days
32
3% of all-time downloads
alimama-creative/slam-lora-sdxl
slam-lora-sdxl is a text-to-image model from alimama-creative. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
Paper: https://arxiv.org/abs/2404.13903<br/ Project Page: https://subpath-linear-approx-model.github.io/<br/ The checkpoint is a distilled from stabilityai/stable-diffusion-xl-base-1.0 with our proposed Sub-path Linea…
Downloads · 30 days
32
3% of all-time downloads
All-time downloads
1.1K
Public
Repo size
403 MB
Likes
10
Public
Click a slice to open those files.
.safetensors394 MB · 100%
From the Hugging Face model README
Paper: https://arxiv.org/abs/2404.13903<br/> Project Page: https://subpath-linear-approx-model.github.io/<br/> 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. <img src='https://huggingface.co/alimama-creative/slam-lora-sdxl/resolve/main/sdxl_cmp.jpg'>
More examples: <img src='https://huggingface.co/alimama-creative/slam-lora-sdxl/resolve/main/slam-lora-sdxl.jpg'>