h1t commited on
Commit
65d3a5e
1 Parent(s): 9d035b1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: diffusers
3
+ base_model: stabilityai/stable-diffusion-xl-base-1.0
4
+ tags:
5
+ - text-to-image
6
+ license: openrail++
7
+ inference: false
8
+ ---
9
+
10
+ # One More Step
11
+
12
+ One More Step (OMS) module was proposed in [One More Step: A Versatile Plug-and-Play Module for Rectifying Diffusion Schedule Flaws and Enhancing Low-Frequency Controls](https://github.com/mhh0318/OneMoreStep)
13
+ by *Minghui Hu, Jianbin Zheng, Chuanxia Zheng, Tat-Jen Cham et al.*
14
+
15
+
16
+ By **adding one small step** on the top the sampling process, we can address the issues caused by the current schedule flaws of diffusion models **without changing the original model parameters**. This also allows for some control over low-frequency information, such as color.
17
+
18
+ Our model is **versatile** and can be integrated into almost all widely-used Stable Diffusion frameworks. It's compatible with community favorites such as **LoRA, ControlNet, Adapter, and foundational models**.
19
+
20
+
21
+ ## Usage
22
+
23
+ OMS now is supported 🤗 `diffusers` with a customized pipeline [github](https://github.com/mhh0318/OneMoreStep). To run the model (especially with `LCM` variant), first install the latest version of `diffusers` library as well as `accelerate` and `transformers`.
24
+
25
+ ```bash
26
+ pip install --upgrade pip
27
+ pip install --upgrade diffusers transformers accelerate
28
+ ```
29
+
30
+ And then we clone the repo
31
+ ```bash
32
+ git clone https://github.com/mhh0318/OneMoreStep.git
33
+ cd OneMoreStep
34
+ ```
35
+
36
+
37
+ ### SD15 and SD21
38
+
39
+ Due to differences in the *VAE latent space* between SD1.5/SD2.1 and SDXL, the OMS module for SD1.5/SD2.1 cannot be shared with SDXL, **however, SD1.5/SD2.1 can share the same OMS module as well as with models like LCM that are based on SD1.5 or SD2.1.** For more details, please refer to our paper.
40
+
41
+ We have uploaded one OMS module for SD15/21 series at [h1t/oms_b_openclip_15_21](https://huggingface.co/h1t/oms_b_openclip_15_21), which has a base architecture, an OpenCLIP text encoder.
42
+
43
+ We simply put a demo here:
44
+
45
+ ```python
46
+ import torch
47
+ from diffusers import StableDiffusionPipeline, LCMScheduler
48
+
49
+ sd_pipe = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16, variant="fp16", safety_checker=None).to('cuda')
50
+
51
+ pipe = OMSPipeline.from_pretrained('h1t/oms_b_openclip_15_21', sd_pipeline = sd_pipe, torch_dtype=torch.float16, variant="fp16", trust_remote_code=True)
52
+ pipe.to('cuda')
53
+
54
+ generator = torch.Generator(device=pipe.device).manual_seed(100)
55
+
56
+ prompt = "a starry night"
57
+
58
+ image = pipe(prompt, guidance_scale=7.5, num_inference_steps=20, oms_guidance_scale=2., generator=generator)
59
+
60
+ image['images'][0]
61
+ ```
62
+ ![oms_15](sd15_oms.png)
63
+
64
+ and without OMS:
65
+
66
+ ```python
67
+ image = pipe(prompt, guidance_scale=7.5, num_inference_steps=20, oms_guidance_scale=2., generator=generator, oms_flag=False)
68
+
69
+ image['images'][0]
70
+ ```
71
+ ![oms_15](sd15_wo_oms.png)
72
+
73
+ We found that the quality of the generative model has been greatly improved.
74
+ For more models and more functions like diverse prompt, please refer to [OMS Repo](https://github.com/mhh0318/OneMoreStep).
75
+