patrickvonplaten commited on
Commit
02bf629
1 Parent(s): 3d6e1b1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -160
README.md CHANGED
@@ -5,178 +5,43 @@ tags:
5
  - text-to-image
6
  inference: false
7
  ---
 
8
 
 
 
9
 
10
- ___
11
- ## Access to the model
12
- **The Stable Diffusion weights are currently only available to universities, academics, research institutions and independent researchers. Please request access applying to <a href="https://stability.ai/academia-access-form" target="_blank">this</a> form**
13
- ___
14
 
15
- # Stable Diffusion v1 Model Card
16
- This model card focuses on the model associated with the Stable Diffusion model, available [here](https://github.com/CompVis/stable-diffusion).
17
 
18
- ## Model Details
19
- - **Developed by:** Robin Rombach, Patrick Esser
20
- - **Model type:** Diffusion-based text-to-image generation model
21
- - **Language(s):** English
22
- - **License:** [Proprietary](LICENSE)
23
- - **Model Description:** This is a model that can be used to generate and modify images based on text prompts. It is a [Latent Diffusion Model](https://arxiv.org/abs/2112.10752) that uses a fixed, pretrained text encoder ([CLIP ViT-L/14](https://arxiv.org/abs/2103.00020)) as suggested in the [Imagen paper](https://arxiv.org/abs/2205.11487).
24
- - **Resources for more information:** [GitHub Repository](https://github.com/CompVis/stable-diffusion), [Paper](https://arxiv.org/abs/2112.10752).
25
- - **Cite as:**
26
-
27
- @InProceedings{Rombach_2022_CVPR,
28
- author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
29
- title = {High-Resolution Image Synthesis With Latent Diffusion Models},
30
- booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
31
- month = {June},
32
- year = {2022},
33
- pages = {10684-10695}
34
- }
35
-
36
- # Uses
37
-
38
- ## Direct Use
39
- The model is intended for research purposes only. Possible research areas and
40
- tasks include
41
-
42
- - Safe deployment of models which have the potential to generate harmful content.
43
- - Probing and understanding the limitations and biases of generative models.
44
- - Generation of artworks and use in design and other artistic processes.
45
- - Applications in educational or creative tools.
46
- - Research on generative models.
47
-
48
- Excluded uses are described below.
49
-
50
- ### Misuse, Malicious Use, and Out-of-Scope Use
51
- _Note: This section is taken from the [DALLE-MINI model card](https://huggingface.co/dalle-mini/dalle-mini), but applies in the same way to Stable Diffusion v1_.
52
-
53
-
54
- The model should not be used to intentionally create or disseminate images that create hostile or alienating environments for people. This includes generating images that people would foreseeably find disturbing, distressing, or offensive; or content that propagates historical or current stereotypes.
55
- #### Out-of-Scope Use
56
- The model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
57
- #### Misuse and Malicious Use
58
- Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
59
-
60
- - Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
61
- - Intentionally promoting or propagating discriminatory content or harmful stereotypes.
62
- - Impersonating individuals without their consent.
63
- - Sexual content without consent of the people who might see it.
64
- - Mis- and disinformation
65
- - Representations of egregious violence and gore
66
- - Sharing of copyrighted or licensed material in violation of its terms of use.
67
- - Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
68
-
69
- ## Diffusers
70
-
71
- As soon as you have been added to this organization you can use stable diffusion out of the box!
72
-
73
- Example:
74
-
75
- ```
76
- !pip install diffusers==0.2.2
77
- ```
78
-
79
- ```python
80
- # make sure you're logged in with `huggingface-cli login`
81
- from torch import autocast
82
- from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
83
-
84
- lms = LMSDiscreteScheduler(
85
- beta_start=0.00085,
86
- beta_end=0.012,
87
- beta_schedule="scaled_linear"
88
- )
89
-
90
- pipe = StableDiffusionPipeline.from_pretrained(
91
- "CompVis/stable-diffusion-v1-3-diffusers",
92
- scheduler=lms,
93
- use_auth_token=True
94
- )
95
-
96
- prompt = "a photo of an astronaut riding a horse on mars"
97
- with autocast("cuda"):
98
- image = pipe(prompt, width=768, guidance_scale=7)["sample"][0]
99
-
100
- image.save("astronaut_rides_horse.png")
101
- ```
102
-
103
- For more in-detail explanations see [the stable diffusion notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb).
104
-
105
- ## Limitations and Bias
106
-
107
- ### Limitations
108
-
109
- - The model does not achieve perfect photorealism
110
- - The model cannot render legible text
111
- - The model does not perform well on more difficult tasks which involve compositionality, such as rendering an image corresponding to “A red cube on top of a blue sphere”
112
- - Faces and people in general may not be generated properly.
113
- - The model was trained mainly with English captions and will not work as well in other languages.
114
- - The autoencoding part of the model is lossy
115
- - The model was trained on a large-scale dataset
116
- [LAION-5B](https://laion.ai/blog/laion-5b/) which contains adult material
117
- and is not fit for product use without additional safety mechanisms and
118
- considerations.
119
-
120
- ### Bias
121
- While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
122
- Stable Diffusion v1 was trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),
123
- which consists of images that are primarily limited to English descriptions.
124
- Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for.
125
- This affects the overall output of the model, as white and western cultures are often set as the default. Further, the
126
- ability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.
127
-
128
-
129
- ## Training
130
-
131
- **Training Data**
132
- The model developers used the following dataset for training the model:
133
-
134
- - LAION-2B (en) and subsets thereof (see next section)
135
-
136
- **Training Procedure**
137
- Stable Diffusion v1 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,
138
-
139
- - Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4
140
- - Text prompts are encoded through a ViT-L/14 text-encoder.
141
- - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
142
- - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
143
-
144
- We currently provide three checkpoints, `sd-v1-1.ckpt`, `sd-v1-2.ckpt` and `sd-v1-3.ckpt`,
145
- which were trained as follows,
146
-
147
- - `sd-v1-1.ckpt`: 237k steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
148
- 194k steps at resolution `512x512` on [laion-high-resolution](https://huggingface.co/datasets/laion/laion-high-resolution) (170M examples from LAION-5B with resolution `>= 1024x1024`).
149
- - `sd-v1-2.ckpt`: Resumed from `sd-v1-1.ckpt`.
150
- 515k steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
151
  filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an [improved aesthetics estimator](https://github.com/christophschuhmann/improved-aesthetic-predictor)).
152
- - `sd-v1-3.ckpt`: Resumed from `sd-v1-2.ckpt`. 195k steps at resolution `512x512` on "laion-improved-aesthetics" and 10\% dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
153
-
154
 
155
- - **Hardware:** 32 x 8 x A100 GPUs
156
- - **Optimizer:** AdamW
157
- - **Gradient Accumulations**: 2
158
- - **Batch:** 32 x 8 x 2 x 4 = 2048
159
- - **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant
160
 
161
- ## Evaluation Results
162
- Evaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0,
163
- 5.0, 6.0, 7.0, 8.0) and 50 PLMS sampling
164
- steps show the relative improvements of the checkpoints:
165
 
166
- ![pareto](v1-variants-scores.jpg)
167
 
168
- Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.
169
- ## Environmental Impact
170
 
171
- **Stable Diffusion v1** **Estimated Emissions**
172
- Based on that information, we estimate the following CO2 emissions using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.
 
 
173
 
174
- - **Hardware Type:** A100 PCIe 40GB
175
- - **Hours used:** 150000
176
- - **Cloud Provider:** AWS
177
- - **Compute Region:** US-east
178
- - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
179
 
 
 
 
 
180
 
181
  ## Citation
182
 
 
5
  - text-to-image
6
  inference: false
7
  ---
8
+ # Stable Diffusion
9
 
10
+ Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input.
11
+ This model card gives an overview of all available model checkpoints. For more in-detail model cards, please have a look at the model repositories listed under [Model Access](#model-access).
12
 
13
+ ** Stable Diffusion V1**
 
 
 
14
 
15
+ In its first version, 4 model checkpoints are released: **stable-diffusion-v1-1**, **stable-diffusion-v1-2**, **stable-diffusion-v1-3** and **stable-diffusion-v1-4**.
16
+ *Higher* versions have been trained for longer and are thus usually better in terms of image generation quality then *lower* versions. More specifically:
17
 
18
+ - **stable-diffusion-v1-1**: The checkpoint is randomely initialized and has been trained on 237,000 steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
19
+ 194,000 steps at resolution `512x512` on [laion-high-resolution](https://huggingface.co/datasets/laion/laion-high-resolution) (170M examples from LAION-5B with resolution `>= 1024x1024`).
20
+ - **stable-diffusion-v1-2** (https://huggingface.co/CompVis/stable-diffusion-v1-2): The checkpoint is resumed training from `stable-diffusion-v1-1`.
21
+ 515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an [improved aesthetics estimator](https://github.com/christophschuhmann/improved-aesthetic-predictor)).
23
+ - **stable-diffusion-v1-3** (https://huggingface.co/CompVis/stable-diffusion-v1-3): The checkpoint is resumed training from `stable-diffusion-v1-2`. 195,000 steps at resolution `512x512` on "laion-improved-aesthetics" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598)
24
+ - **stable-diffusion-v1-4** (https://huggingface.co/CompVis/stable-diffusion-v1-4) The checkpoint is resumed training.
25
 
26
+ The model can be used both with [🤗's `diffusers` library](https://github.com/huggingface/diffusers) or the original [Stable Diffusion GitHub repository](https://github.com/CompVis/stable-diffusion).
 
 
 
 
27
 
28
+ ## Model access
 
 
 
29
 
30
+ Each checkpoint can be accessed as soon as having *"click-requested"* them on the respective model repositories.
31
 
32
+ **For [🤗's `diffusers`](https://github.com/huggingface/diffusers)**:
 
33
 
34
+ - [`stable-diffusion-v1-1`](https://huggingface.co/CompVis/stable-diffusion-v1-1)
35
+ - [`stable-diffusion-v1-2`](https://huggingface.co/CompVis/stable-diffusion-v1-2)
36
+ - [`stable-diffusion-v1-3`](https://huggingface.co/CompVis/stable-diffusion-v1-3)
37
+ - [`stable-diffusion-v1-4`](https://huggingface.co/CompVis/stable-diffusion-v1-4)
38
 
39
+ **For with the original [Stable Diffusion GitHub repository](https://github.com/CompVis/stable-diffusion)**:
 
 
 
 
40
 
41
+ - [`stable-diffusion-v-1-1-original`](https://huggingface.co/CompVis/stable-diffusion-v-1-1-original)
42
+ - [`stable-diffusion-v-1-2-original`](https://huggingface.co/CompVis/stable-diffusion-v-1-2-original)
43
+ - [`stable-diffusion-v-1-3-original`](https://huggingface.co/CompVis/stable-diffusion-v-1-3-original)
44
+ - [`stable-diffusion-v-1-4-original`](https://huggingface.co/CompVis/stable-diffusion-v-1-4-original)
45
 
46
  ## Citation
47