ashllay valhalla commited on
Commit
f91cf6e
·
verified ·
0 Parent(s):

Duplicate from CompVis/stable-diffusion-v-1-2-original

Browse files

Co-authored-by: Suraj Patil <valhalla@users.noreply.huggingface.co>

Files changed (5) hide show
  1. .gitattributes +32 -0
  2. README.md +176 -0
  3. sd-v1-2-full-ema.ckpt +3 -0
  4. sd-v1-2.ckpt +3 -0
  5. v1-variants-scores.jpg +0 -0
.gitattributes ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.npy filter=lfs diff=lfs merge=lfs -text
13
+ *.npz filter=lfs diff=lfs merge=lfs -text
14
+ *.onnx filter=lfs diff=lfs merge=lfs -text
15
+ *.ot filter=lfs diff=lfs merge=lfs -text
16
+ *.parquet filter=lfs diff=lfs merge=lfs -text
17
+ *.pb filter=lfs diff=lfs merge=lfs -text
18
+ *.pickle filter=lfs diff=lfs merge=lfs -text
19
+ *.pkl filter=lfs diff=lfs merge=lfs -text
20
+ *.pt filter=lfs diff=lfs merge=lfs -text
21
+ *.pth filter=lfs diff=lfs merge=lfs -text
22
+ *.rar filter=lfs diff=lfs merge=lfs -text
23
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
24
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
25
+ *.tflite filter=lfs diff=lfs merge=lfs -text
26
+ *.tgz filter=lfs diff=lfs merge=lfs -text
27
+ *.wasm filter=lfs diff=lfs merge=lfs -text
28
+ *.xz filter=lfs diff=lfs merge=lfs -text
29
+ *.zip filter=lfs diff=lfs merge=lfs -text
30
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
31
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
32
+ *.ckpt* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: creativeml-openrail-m
3
+ tags:
4
+ - stable-diffusion
5
+ - text-to-image
6
+ extra_gated_prompt: |-
7
+ This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
8
+ The CreativeML OpenRAIL License specifies:
9
+
10
+ 1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
11
+ 2. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
12
+ 3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
13
+ Please read the full license carefully here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
14
+
15
+ extra_gated_heading: Please read the LICENSE to access this model
16
+ ---
17
+
18
+ # Stable Diffusion v1 Model Card
19
+
20
+ Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input.
21
+
22
+ The **Stable-Diffusion-v-1-2** checkpoint was initialized with the weights of the [Stable-Diffusion-v-1-1](https:/steps/huggingface.co/CompVis/stable-diffusion-v-1-1-original)
23
+ checkpoint and subsequently fine-tuned on 515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
24
+ filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`.
25
+
26
+ For more information, please refer to [Training](#training).
27
+
28
+ #### Download the weights
29
+ - [sd-v1-2.ckpt](https://huggingface.co/CompVis/stable-diffusion-v-1-2-original/resolve/main/sd-v1-2.ckpt)
30
+ - [sd-v1-2-full-ema.ckpt](https://huggingface.co/CompVis/stable-diffusion-v-1-2-original/resolve/main/sd-v1-2-full-ema.ckpt)
31
+
32
+ This weights are intended to be used with the original [CompVis Stable Diffusion codebase](https://github.com/CompVis/stable-diffusion). If you are looking for the model to use with the D🧨iffusers library, [come here](https://huggingface.co/CompVis/stable-diffusion-v1-2).
33
+
34
+ ## Model Details
35
+ - **Developed by:** Robin Rombach, Patrick Esser
36
+ - **Model type:** Diffusion-based text-to-image generation model
37
+ - **Language(s):** English
38
+ - **License:** [The CreativeML OpenRAIL M license](https://huggingface.co/spaces/CompVis/stable-diffusion-license) is an [Open RAIL M license](https://www.licenses.ai/blog/2022/8/18/naming-convention-of-responsible-ai-licenses), adapted from the work that [BigScience](https://bigscience.huggingface.co/) and [the RAIL Initiative](https://www.licenses.ai/) are jointly carrying in the area of responsible AI licensing. See also [the article about the BLOOM Open RAIL license](https://bigscience.huggingface.co/blog/the-bigscience-rail-license) on which our license is based.
39
+ - **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).
40
+ - **Resources for more information:** [GitHub Repository](https://github.com/CompVis/stable-diffusion), [Paper](https://arxiv.org/abs/2112.10752).
41
+ - **Cite as:**
42
+
43
+ @InProceedings{Rombach_2022_CVPR,
44
+ author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
45
+ title = {High-Resolution Image Synthesis With Latent Diffusion Models},
46
+ booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
47
+ month = {June},
48
+ year = {2022},
49
+ pages = {10684-10695}
50
+ }
51
+
52
+ # Uses
53
+
54
+ ## Direct Use
55
+ The model is intended for research purposes only. Possible research areas and
56
+ tasks include
57
+
58
+ - Safe deployment of models which have the potential to generate harmful content.
59
+ - Probing and understanding the limitations and biases of generative models.
60
+ - Generation of artworks and use in design and other artistic processes.
61
+ - Applications in educational or creative tools.
62
+ - Research on generative models.
63
+
64
+ Excluded uses are described below.
65
+
66
+ ### Misuse, Malicious Use, and Out-of-Scope Use
67
+ _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_.
68
+
69
+
70
+ 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.
71
+ #### Out-of-Scope Use
72
+ 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.
73
+ #### Misuse and Malicious Use
74
+ Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
75
+
76
+ - Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
77
+ - Intentionally promoting or propagating discriminatory content or harmful stereotypes.
78
+ - Impersonating individuals without their consent.
79
+ - Sexual content without consent of the people who might see it.
80
+ - Mis- and disinformation
81
+ - Representations of egregious violence and gore
82
+ - Sharing of copyrighted or licensed material in violation of its terms of use.
83
+ - Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
84
+
85
+ ## Limitations and Bias
86
+
87
+ ### Limitations
88
+
89
+ - The model does not achieve perfect photorealism
90
+ - The model cannot render legible text
91
+ - 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”
92
+ - Faces and people in general may not be generated properly.
93
+ - The model was trained mainly with English captions and will not work as well in other languages.
94
+ - The autoencoding part of the model is lossy
95
+ - The model was trained on a large-scale dataset
96
+ [LAION-5B](https://laion.ai/blog/laion-5b/) which contains adult material
97
+ and is not fit for product use without additional safety mechanisms and
98
+ considerations.
99
+ - No additional measures were used to deduplicate the dataset. As a result, we observe some degree of memorization for images that are duplicated in the training data.
100
+ The training data can be searched at [https://rom1504.github.io/clip-retrieval/](https://rom1504.github.io/clip-retrieval/) to possibly assist in the detection of memorized images.
101
+
102
+ ### Bias
103
+ While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
104
+ Stable Diffusion v1 was trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),
105
+ which consists of images that are primarily limited to English descriptions.
106
+ Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for.
107
+ This affects the overall output of the model, as white and western cultures are often set as the default. Further, the
108
+ ability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.
109
+
110
+
111
+ ## Training
112
+
113
+ **Training Data**
114
+ The model developers used the following dataset for training the model:
115
+
116
+ - LAION-2B (en) and subsets thereof (see next section)
117
+
118
+ **Training Procedure**
119
+ 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,
120
+
121
+ - 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
122
+ - Text prompts are encoded through a ViT-L/14 text-encoder.
123
+ - The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
124
+ - The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
125
+
126
+ We currently provide three checkpoints, `sd-v1-1.ckpt`, `sd-v1-2.ckpt` and `sd-v1-3.ckpt`,
127
+ which were trained as follows,
128
+
129
+ - `sd-v1-1.ckpt`: 237k steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
130
+ 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`).
131
+ - `sd-v1-2.ckpt`: Resumed from `sd-v1-1.ckpt`.
132
+ 515k steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
133
+ 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)).
134
+ - `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).
135
+
136
+
137
+ - **Hardware:** 32 x 8 x A100 GPUs
138
+ - **Optimizer:** AdamW
139
+ - **Gradient Accumulations**: 2
140
+ - **Batch:** 32 x 8 x 2 x 4 = 2048
141
+ - **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant
142
+
143
+ ## Evaluation Results
144
+ Evaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0,
145
+ 5.0, 6.0, 7.0, 8.0) and 50 PLMS sampling
146
+ steps show the relative improvements of the checkpoints:
147
+
148
+ ![pareto](https://huggingface.co/CompVis/stable-diffusion/resolve/main/v1-variants-scores.jpg)
149
+
150
+ Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.
151
+ ## Environmental Impact
152
+
153
+ **Stable Diffusion v1** **Estimated Emissions**
154
+ 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.
155
+
156
+ - **Hardware Type:** A100 PCIe 40GB
157
+ - **Hours used:** 150000
158
+ - **Cloud Provider:** AWS
159
+ - **Compute Region:** US-east
160
+ - **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
161
+
162
+
163
+ ## Citation
164
+
165
+ ```bibtex
166
+ @InProceedings{Rombach_2022_CVPR,
167
+ author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
168
+ title = {High-Resolution Image Synthesis With Latent Diffusion Models},
169
+ booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
170
+ month = {June},
171
+ year = {2022},
172
+ pages = {10684-10695}
173
+ }
174
+ ```
175
+
176
+ *This model card was written by: Robin Rombach and Patrick Esser and is based on the [DALL-E Mini model card](https://huggingface.co/dalle-mini/dalle-mini).*
sd-v1-2-full-ema.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc5086a904d7b9d13d2a7bccf38f089824755be7261c7399d92e555e1e9ac69a
3
+ size 7703807346
sd-v1-2.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b87d30facd5bafca1cbed71cfb86648aad75d1c264663c0cc78c7aea8daec0d
3
+ size 4265380512
v1-variants-scores.jpg ADDED