patrickvonplaten commited on
Commit
72b584c
1 Parent(s): 412dbda

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -176
README.md CHANGED
@@ -6,8 +6,8 @@ tags:
6
  inference: false
7
  ---
8
 
9
- # Stable Diffusion v1 Model Card
10
- This model card focuses on the model associated with the Stable Diffusion model, available [here](https://github.com/CompVis/stable-diffusion).
11
 
12
  ## Model Details
13
  - **Developed by:** Robin Rombach, Patrick Esser
@@ -29,11 +29,14 @@ This model card focuses on the model associated with the Stable Diffusion model,
29
 
30
  ## Examples
31
 
 
 
32
  ```bash
33
  pip install --upgrade diffusers transformers scipy
34
  ```
35
 
36
  Run this command to log in with your HF Hub token if you haven't before:
 
37
  ```bash
38
  huggingface-cli login
39
  ```
@@ -63,10 +66,11 @@ To swap out the noise scheduler, pass it to `from_pretrained`:
63
  ```python
64
  from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
65
 
66
- model_id = "CompVis/stable-diffusion-v1-3-diffusers"
67
  # Use the K-LMS scheduler here instead
68
  scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)
69
- pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, use_auth_token=True).to("cuda")
 
70
  ```
71
 
72
  # Uses
@@ -88,115 +92,10 @@ _Note: This section is taken from the [DALLE-MINI model card](https://huggingfac
88
 
89
 
90
  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.
91
- #### Out-of-Scope Use
92
- 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.
93
- #### Misuse and Malicious Use
94
- Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
95
-
96
- - Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
97
- - Intentionally promoting or propagating discriminatory content or harmful stereotypes.
98
- - Impersonating individuals without their consent.
99
- - Sexual content without consent of the people who might see it.
100
- - Mis- and disinformation
101
- - Representations of egregious violence and gore
102
- - Sharing of copyrighted or licensed material in violation of its terms of use.
103
- - Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
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 res---
151
- license: other
152
- tags:
153
- - stable-diffusion
154
- - text-to-image
155
- inference: false
156
- ---
157
-
158
- # Stable Diffusion v1 Model Card
159
- This model card focuses on the model associated with the Stable Diffusion model, available [here](https://github.com/CompVis/stable-diffusion).
160
-
161
- ## Model Details
162
- - **Developed by:** Robin Rombach, Patrick Esser
163
- - **Model type:** Diffusion-based text-to-image generation model
164
- - **Language(s):** English
165
- - **License:** [Proprietary](LICENSE)
166
- - **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).
167
- - **Resources for more information:** [GitHub Repository](https://github.com/CompVis/stable-diffusion), [Paper](https://arxiv.org/abs/2112.10752).
168
- - **Cite as:**
169
-
170
- @InProceedings{Rombach_2022_CVPR,
171
- author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
172
- title = {High-Resolution Image Synthesis With Latent Diffusion Models},
173
- booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
174
- month = {June},
175
- year = {2022},
176
- pages = {10684-10695}
177
- }
178
-
179
- # Uses
180
-
181
- ## Direct Use
182
- The model is intended for research purposes only. Possible research areas and
183
- tasks include
184
-
185
- - Safe deployment of models which have the potential to generate harmful content.
186
- - Probing and understanding the limitations and biases of generative models.
187
- - Generation of artworks and use in design and other artistic processes.
188
- - Applications in educational or creative tools.
189
- - Research on generative models.
190
-
191
- Excluded uses are described below.
192
-
193
- ### Misuse, Malicious Use, and Out-of-Scope Use
194
- _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_.
195
-
196
-
197
- 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.
198
  #### Out-of-Scope Use
199
  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.
 
200
  #### Misuse and Malicious Use
201
  Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
202
 
@@ -225,6 +124,7 @@ Using the model to generate content that is cruel to individuals is a misuse of
225
  considerations.
226
 
227
  ### Bias
 
228
  While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
229
  Stable Diffusion v1 was trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),
230
  which consists of images that are primarily limited to English descriptions.
@@ -241,24 +141,27 @@ The model developers used the following dataset for training the model:
241
  - LAION-2B (en) and subsets thereof (see next section)
242
 
243
  **Training Procedure**
244
- 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,
245
 
246
  - 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
247
  - Text prompts are encoded through a ViT-L/14 text-encoder.
248
  - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
249
  - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
250
 
251
- We currently provide three checkpoints, `sd-v1-1.ckpt`, `sd-v1-2.ckpt` and `sd-v1-3.ckpt`,
252
- which were trained as follows,
253
-
254
- - `sd-v1-1.ckpt`: 237k steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
255
- 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`).
256
- - `sd-v1-2.ckpt`: Resumed from `sd-v1-1.ckpt`.
257
- 515k steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
 
 
 
 
258
  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)).
259
- - `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).
260
- - `sd-v1-4.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).
261
-
262
 
263
  - **Hardware:** 32 x 8 x A100 GPUs
264
  - **Optimizer:** AdamW
@@ -285,33 +188,6 @@ Based on that information, we estimate the following CO2 emissions using the [Ma
285
  - **Compute Region:** US-east
286
  - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
287
 
288
- ## Usage
289
-
290
- ### Setup
291
-
292
- - Install `diffusers` with
293
-
294
- `pip install -U git+https://github.com/huggingface/diffusers.git`
295
- - Install `transformers` with
296
-
297
- `pip install transformers`
298
-
299
- ```python
300
- import torch
301
- from diffusers import StableDiffusionPipeline
302
-
303
- pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-3-diffusers")
304
-
305
- prompt = "19th Century wooden engraving of Elon musk"
306
-
307
- seed = torch.manual_seed(1024)
308
- images = pipe([prompt], num_inference_steps=50, guidance_scale=7.5, generator=seed)["sample"]
309
-
310
- # save images
311
- for idx, image in enumerate(images):
312
- image.save(f"image-{idx}.png")
313
- ```
314
-
315
 
316
  ## Citation
317
 
@@ -346,6 +222,7 @@ steps show the relative improvements of the checkpoints:
346
  ![pareto](v1-variants-scores.jpg)
347
 
348
  Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.
 
349
  ## Environmental Impact
350
 
351
  **Stable Diffusion v1** **Estimated Emissions**
@@ -357,34 +234,6 @@ Based on that information, we estimate the following CO2 emissions using the [Ma
357
  - **Compute Region:** US-east
358
  - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
359
 
360
- ## Usage
361
-
362
- ### Setup
363
-
364
- - Install `diffusers` with
365
-
366
- `pip install -U git+https://github.com/huggingface/diffusers.git`
367
- - Install `transformers` with
368
-
369
- `pip install transformers`
370
-
371
- ```python
372
- import torch
373
- from diffusers import StableDiffusionPipeline
374
-
375
- pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-3-diffusers")
376
-
377
- prompt = "19th Century wooden engraving of Elon musk"
378
-
379
- seed = torch.manual_seed(1024)
380
- images = pipe([prompt], num_inference_steps=50, guidance_scale=7.5, generator=seed)["sample"]
381
-
382
- # save images
383
- for idx, image in enumerate(images):
384
- image.save(f"image-{idx}.png")
385
- ```
386
-
387
-
388
  ## Citation
389
 
390
  ```bibtex
 
6
  inference: false
7
  ---
8
 
9
+ # Stable Diffusion v1-4 Model Card
10
+ This model card focuses on the model associated with the [Stable Diffusion model](https://stability.ai/blog/stable-diffusion-announcement).
11
 
12
  ## Model Details
13
  - **Developed by:** Robin Rombach, Patrick Esser
 
29
 
30
  ## Examples
31
 
32
+ We recommend using [🤗's Diffusers library](https://github.com/huggingface/diffusers) to run Stable Diffusion.
33
+
34
  ```bash
35
  pip install --upgrade diffusers transformers scipy
36
  ```
37
 
38
  Run this command to log in with your HF Hub token if you haven't before:
39
+
40
  ```bash
41
  huggingface-cli login
42
  ```
 
66
  ```python
67
  from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
68
 
69
+ model_id = "CompVis/stable-diffusion-v1-4"
70
  # Use the K-LMS scheduler here instead
71
  scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)
72
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, use_auth_token=True)
73
+ pipe = pipe.to("cuda")
74
  ```
75
 
76
  # Uses
 
92
 
93
 
94
  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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  #### Out-of-Scope Use
97
  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.
98
+
99
  #### Misuse and Malicious Use
100
  Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
101
 
 
124
  considerations.
125
 
126
  ### Bias
127
+
128
  While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
129
  Stable Diffusion v1 was trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),
130
  which consists of images that are primarily limited to English descriptions.
 
141
  - LAION-2B (en) and subsets thereof (see next section)
142
 
143
  **Training Procedure**
144
+ Stable Diffusion v1-4 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,
145
 
146
  - 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
147
  - Text prompts are encoded through a ViT-L/14 text-encoder.
148
  - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
149
  - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
150
 
151
+ We currently provide four checkpoints,
152
+ - [`stable-diffusion-v1-1`](https://huggingface.co/CompVis/stable-diffusion-v1-1),
153
+ - [`stable-diffusion-v1-2`](https://huggingface.co/CompVis/stable-diffusion-v1-2),
154
+ - [`stable-diffusion-v1-3`](https://huggingface.co/CompVis/stable-diffusion-v1-3), and
155
+ - [`stable-diffusion-v1-4`](https://huggingface.co/CompVis/stable-diffusion-v1-4).
156
+
157
+ The checkpoints were trained as follows:
158
+ - `stable-diffusion-v1-1`: 237,000 steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
159
+ 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`).
160
+ - `stable-diffusion-v1-2`: Resumed from `stable-diffusion-v1-1`.
161
+ 515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
162
  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)).
163
+ - `stable-diffusion-v1-3`: Resumed 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)
164
+ - *`stable-diffusion-v1-4`*: ...
 
165
 
166
  - **Hardware:** 32 x 8 x A100 GPUs
167
  - **Optimizer:** AdamW
 
188
  - **Compute Region:** US-east
189
  - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
  ## Citation
193
 
 
222
  ![pareto](v1-variants-scores.jpg)
223
 
224
  Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.
225
+
226
  ## Environmental Impact
227
 
228
  **Stable Diffusion v1** **Estimated Emissions**
 
234
  - **Compute Region:** US-east
235
  - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  ## Citation
238
 
239
  ```bibtex