Text-to-Image
Diffusers
alimamacv commited on
Commit
ecf0368
1 Parent(s): eb2a5e0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ sdxl_cmp.png filter=lfs diff=lfs merge=lfs -text
37
+ slam-lora-sdxl.jpg filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,50 @@
1
  ---
 
 
 
 
2
  license: apache-2.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: diffusers
3
+ base_model: stabilityai/stable-diffusion-xl-base-1.0
4
+ tags:
5
+ - text-to-image
6
  license: apache-2.0
7
+ inference: false
8
  ---
9
+ # Sub-path Linear Approximation Model (SLAM) LoRA: SDXL
10
+ Paper: [https://arxiv.org/abs/2404.13903](https://arxiv.org/abs/2404.13903)<br/>
11
+ Project Page: [https://subpath-linear-approx-model.github.io/](https://subpath-linear-approx-model.github.io/)<br/>
12
+ The checkpoint is a distilled from [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/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.
13
+ ## Usage
14
+ First, install the latest version of the Diffusers library as well as peft, accelerate and transformers.
15
+ ```bash
16
+ pip install --upgrade pip
17
+ pip install --upgrade diffusers transformers accelerate peft
18
+ ```
19
+ We implement SLAM to be compatible with [LCMScheduler](https://huggingface.co/docs/diffusers/v0.22.3/en/api/schedulers/lcm#diffusers.LCMScheduler). You can use SLAM-LoRA just like you use LCM-LoRA.
20
+ ```python
21
+ import torch
22
+ from diffusers import LCMScheduler, AutoPipelineForText2Image
23
+
24
+ model_id = "stabilityai/stable-diffusion-xl-base-1.0"
25
+ adapter_id = "alimama-creative/slam-lora-sdxl"
26
+
27
+ pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16")
28
+ pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
29
+ pipe.to("cuda")
30
+
31
+ # load and fuse lcm lora
32
+ pipe.load_lora_weights(adapter_id)
33
+ pipe.fuse_lora()
34
+
35
+ prompt = "A brown teddy bear holding a glass vase in front of a grave."
36
+
37
+ image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=1.0).images[0]
38
+
39
+ ```
40
+
41
+
42
+ Compare with latent-consistency/lcm-lora-sdxl.
43
+ <img src='https://huggingface.co/alimama-creative/slam-lora-sdxl/resolve/main/sdxl_cmp.jpg'>
44
+
45
+ ---
46
+
47
+ <img src='https://huggingface.co/alimama-creative/slam-lora-sdxl/resolve/main/slam-lora-sdxl.jpg'>
48
+
49
+
50
+
pytorch_lora_weights.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22569a946b0db645aa3b8eb782c674c8e726a7cc0d655887c21fecf6dfe6ad91
3
+ size 393854592
sdxl_cmp.jpg ADDED
slam-lora-sdxl.jpg ADDED

Git LFS Details

  • SHA256: 1e906c4e426b11876e2b7a08d9bdcc535bbf39e26b85465b251456904bc24a5d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.06 MB