Files changed (1) hide show
  1. README.md +159 -25
README.md CHANGED
@@ -1,40 +1,174 @@
1
- # Model Card: DALL·E Mini
2
 
3
- This model is a reproduction of OpenAI’s DALL·E. Please see [this link](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini-Generate-images-from-any-text-prompt--VmlldzoyMDE4NDAy) for project-specific details. Below, we include the original DALL·E model card available on [the OpenAI github](https://github.com/openai/DALL-E/edit/master/model_card.md).
4
 
5
  ## Model Details
6
 
7
- The dVAE was developed by researchers at OpenAI to reduce the memory footprint of the transformer trained on the
8
- text-to-image generation task. The details involved in training the dVAE are described in [the paper][dalle_paper]. This
9
- model card describes the first version of the model, released in February 2021. The model consists of a convolutional
10
- encoder and decoder whose architectures are described [here](dall_e/encoder.py) and [here](dall_e/decoder.py), respectively.
11
- For questions or comments about the models or the code release, please file a Github issue.
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- ## Model Use
14
 
15
- ### Intended Use
16
 
17
- The model is intended for others to use for training their own generative models.
18
 
19
- ### Out-of-Scope Use Cases
20
 
21
- This model is inappropriate for high-fidelity image processing applications. We also do not recommend its use as a
22
- general-purpose image compressor.
 
 
 
23
 
24
- ## Training Data
25
 
26
- The model was trained on publicly available text-image pairs collected from the internet. This data consists partly of
27
- [Conceptual Captions][cc] and a filtered subset of [YFCC100M][yfcc100m]. We used a subset of the filters described in
28
- [Sharma et al.][cc_paper] to construct this dataset; further details are described in [our paper][dalle_paper]. We will
29
- not be releasing the dataset.
30
 
31
- ## Performance and Limitations
32
 
33
- The heavy compression from the encoding process results in a noticeable loss of detail in the reconstructed images. This
34
- renders it inappropriate for applications that require fine-grained details of the image to be preserved.
35
 
36
- [dalle_paper]: https://arxiv.org/abs/2102.12092
37
- [cc]: https://ai.google.com/research/ConceptualCaptions
38
- [cc_paper]: https://www.aclweb.org/anthology/P18-1238/
39
- [yfcc100m]: http://projects.dfki.uni-kl.de/yfcc100m/
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DALL·E Mini Model Card
2
 
3
+ This model card focuses on the model associated with the DALL·E mini space on Hugging Face, available [here](https://huggingface.co/spaces/dalle-mini/dalle-mini). The app is called “dalle-mini”, but incorporates [DALL·E Mini](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini-Generate-images-from-any-text-prompt--VmlldzoyMDE4NDAy)’’ and “[DALL·E Mega](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mega-Training-Journal--VmlldzoxODMxMDI2)” models (further details on this distinction forthcoming).
4
 
5
  ## Model Details
6
 
7
+ * **Developed by:** Boris Dayma, Suraj Patil, Pedro Cuenca, Khalid Saifullah, Tanishq Abraham, Phúc Lê, Luke, Luke Melas, Ritobrata Ghosh
8
+ * **Model type:** Transformer-based text-to-image generation model
9
+ * **Language(s):** English
10
+ * **License:** Apache 2.0
11
+ * **Model Description:** This is a model that can be used to generate images based on text prompts. As the model developers wrote in the [project report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini-Generate-images-from-any-text-prompt--VmlldzoyMDE4NDAy) about DALL·E mini, “OpenAI had the first impressive model for generating images with [DALL·E](https://openai.com/blog/dall-e/). DALL·E mini is an attempt at reproducing those results with an open-source model.”
12
+ * **Resources for more information:** See OpenAI’s website for more information about [DALL·E](https://openai.com/blog/dall-e/), including the [DALL·E model card](https://github.com/openai/DALL-E/blob/master/model_card.md). See the [project report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini-Generate-images-from-any-text-prompt--VmlldzoyMDE4NDAy) for more information from the model’s developers. To learn more about DALL·E Mega, see the DALL·E Mega [training journal](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mega-Training--VmlldzoxODMxMDI2#training-parameters).
13
+ * **Cite as:**
14
+ ```bib text
15
+ @misc{Dayma_DALL·E_Mini_2021,
16
+ author = {Dayma, Boris and Patil, Suraj and Cuenca, Pedro and Saifullah, Khalid and Abraham, Tanishq and Lê Khắc, Phúc and Melas, Luke and Ghosh, Ritobrata},
17
+ doi = {10.5281/zenodo.5146400},
18
+ month = {7},
19
+ title = {DALL·E Mini},
20
+ url = {https://github.com/borisdayma/dalle-mini},
21
+ year = {2021}
22
+ }
23
+ ```
24
 
25
+ ## Uses
26
 
27
+ ### Direct Use
28
 
29
+ The model is intended to be used to generate images based on text prompts for research and personal consumption. Intended uses include supporting creativity, creating humorous content, and providing generations for people curious about the model’s behavior. Intended uses exclude those described in the [Misuse and Out-of-Scope Use](#misuse-malicious-use-and-out-of-scope-use) section.
30
 
31
+ ### Downstream Use
32
 
33
+ The model could also be used for downstream use cases, including:
34
+ * Research efforts, such as probing and better understanding the limitations and biases of generative models to further improve the state of science
35
+ * Development of educational or creative tools
36
+ * Generation of artwork and use in design and artistic processes.
37
+ * Other uses that are newly discovered by users. This currently includes poetry illustration (give a poem as prompt), fan art (putting a character in various other visual universes), visual puns, fairy tale illustrations (give a fantasy situation as prompt), concept mashups (applying a texture to something completely different), style transfers (portraits in the style of), … We hope you will find your own application!
38
 
39
+ Downstream uses exclude the uses described in [Misuse and Out-of-Scope Use](#misuse-malicious-use-and-out-of-scope-use).
40
 
41
+ ### Misuse, Malicious Use, and Out-of-Scope Use
 
 
 
42
 
43
+ 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.
44
 
45
+ #### Out-of-Scope Use
 
46
 
47
+ 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.
 
 
 
48
 
49
+ #### Misuse and Malicious Use
50
+
51
+ Using the model to generate content that is cruel to individuals is a misuse of this model. This includes:
52
+ * Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
53
+ * Intentionally promoting or propagating discriminatory content or harmful stereotypes.
54
+ * Impersonating individuals without their consent.
55
+ * Sexual content without consent of the people who might see it.
56
+ * Mis- and disinformation
57
+ * Representations of egregious violence and gore
58
+ * Sharing of copyrighted or licensed material in violation of its terms of use.
59
+ * Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
60
+
61
+
62
+ ## Limitations and Bias
63
+
64
+ ### Limitations
65
+
66
+ The model developers discuss the limitations of the model further in the DALL·E Mini [technical report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mini-Explained-with-Demo--Vmlldzo4NjIxODA):
67
+ * Faces and people in general are not generated properly.
68
+ * Animals are usually unrealistic.
69
+ * It is hard to predict where the model excels or falls short…Good prompt engineering will lead to the best results.
70
+ * The model has only been trained with English descriptions and will not perform as well in other languages
71
+
72
+
73
+ ### Bias
74
+
75
+ **CONTENT WARNING: Readers should be aware this section contains content that is disturbing, offensive, and can propagate historical and current stereotypes.**
76
+
77
+ The model was trained on unfiltered data from the Internet, limited to pictures with English descriptions. Text and images from communities and cultures using other languages were not utilized. This affects all output of the model, with white and Western culture asserted as a default, and the model’s ability to generate content using non-English prompts is observably lower quality than prompts in English.
78
+
79
+ While the capabilities of image generation models are impressive, they may also reinforce or exacerbate societal biases. The extent and nature of the biases of DALL·E Mini and DALL·E Mega models have yet to be fully documented, but initial testing demonstrates that they may generate images that contain negative stereotypes against minoritized groups. Work to analyze the nature and extent of the models’ biases and limitations is ongoing.
80
+
81
+ Our current analyses demonstrate that:
82
+ * Images generated by the model can include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
83
+ * When the model generates images with people in them, it tends to output people who we perceive to be white, while people of color are underrepresented.
84
+ * Images generated by the model can contain biased content that depicts power differentials between people of color and people who are white, with white people in positions of privilege.
85
+ * The model is generally only usable for generating images based on text in English, limiting accessibility of the model for non-English speakers and potentially contributing to the biases in images generated by the model.
86
+
87
+ The [technical report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mini-Explained-with-Demo--Vmlldzo4NjIxODA) discusses these issues in more detail, and also highlights potential sources of bias in the model development process.
88
+
89
+
90
+ ### Limitations and Bias Recommendations
91
+
92
+ * Users (both direct and downstream) should be made aware of the biases and limitations.
93
+ * Content that is potentially problematic should be filtered out, e.g., via automated models that detect violence or pornography.
94
+ * Further work on this model should include methods for balanced and just representations of people and cultures, for example, by curating the training dataset to be both diverse and inclusive.
95
+
96
+
97
+ ## Training
98
+
99
+ ### Training Data
100
+
101
+ The model developers used 3 datasets for the model:
102
+ * [Conceptual Captions Dataset](https://aclanthology.org/P18-1238/), which contains 3 million image and caption pairs.
103
+ * [Conceptual 12M](https://arxiv.org/abs/2102.08981), which contains 12 million image and caption pairs.
104
+ * The [OpenAI subset](https://github.com/openai/CLIP/blob/main/data/yfcc100m.md) of [YFCC100M](https://multimediacommons.wordpress.com/yfcc100m-core-dataset/), which contains about 15 million images and that we further sub-sampled to 2 million images due to limitations in storage space. They used both title and description as caption and removed html tags, new lines and extra spaces.
105
+
106
+ For fine-tuning the image encoder, a subset of 2 million images were used.
107
+ All images (about 15 million) were used for training the Seq2Seq model.
108
+
109
+ ### Training Procedure
110
+
111
+ As described further in the [technical report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mini-Explained-with-Demo--Vmlldzo4NjIxODA#our-dall-e-model-architecture) for DALL·E Mini, during training, images and descriptions are both available and pass through the system as follows:
112
+ * Images are encoded through a [VQGAN](https://arxiv.org/abs/2012.09841) encoder, which turns images into a sequence of tokens.
113
+ * Descriptions are encoded through a [BART](https://arxiv.org/abs/1910.13461) encoder.
114
+ * The output of the BART encoder and encoded images are fed through the BART decoder, which is an auto-regressive model whose goal is to predict the next token.
115
+ * Loss is the [softmax cross-entropy](https://wandb.ai/sauravm/Activation-Functions/reports/Activation-Functions-Softmax--VmlldzoxNDU1Njgy#%F0%9F%93%A2-softmax-+-cross-entropy-loss-(caution:-math-alert)) between the model prediction logits and the actual image encodings from the VQGAN.
116
+
117
+ The simplified training procedure for DALL·E Mega is as follows:
118
+
119
+ * **Hardware:** 1 pod TPU v3-256 = 32 nodes of TPU VM v3-8 (8 TPU per node) = 256 TPU v3
120
+ * **Optimizer:** Distributed Shampoo
121
+ * **Model Partition Specificiations:** 8 model parallel x 32 data parallel
122
+ * **Batch:** 44 samples per model x 32 data parallel x 3 gradient accumulation steps = 4224 increasing samples per update
123
+ * **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant until plateau
124
+ * Gradient checkpointing used on each Encoder/Decoder layer (ie, MHA + FFN)
125
+ * Distributed Shampoo + Normformer Optimizations have proved to be effective and efficiently scaling this model.
126
+ * It should also be noted that the learning rate and other parameters are sometimes adjusted on the fly, and batch size increased over time as well.
127
+
128
+ There is more information about the full procedure and technical material in the DALL·E Mega [training journal](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mega-Training--VmlldzoxODMxMDI2#training-parameters).
129
+
130
+
131
+ ## Evaluation Results
132
+
133
+ The model developers discuss their results extensively in their [technical report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-Mini-Explained-with-Demo--Vmlldzo4NjIxODA#the-results-of-our-dall-e-experiment) for DALL·E Mini, which provides comparisons between DALL·E Mini’s results with [DALL·E-pytorch](https://github.com/lucidrains/DALLE-pytorch), OpenAI’s [DALL·E](https://openai.com/blog/dall-e/), and models consisting of a generator coupled with the [CLIP neural network model](https://openai.com/blog/clip/).
134
+
135
+ For evaluation results related to DALL·E Mega, see this [technical report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini-Generate-images-from-any-text-prompt--VmlldzoyMDE4NDAy).
136
+
137
+ ## Environmental Impact
138
+
139
+ ### DALL·E Mini Estimated Emissions
140
+
141
+ *The model is 27 times smaller than the original DALL·E and was trained on a single TPU v3-8 for only 3 days.*
142
+
143
+ 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.
144
+
145
+ * **Hardware Type:** TPU v3-8
146
+ * **Hours used:** 72 (3 days)
147
+ * **Cloud Provider:** GCP (as mentioned in the technical report)
148
+ * **Compute Region:** us-east1 (provided by model developers)
149
+ * **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 7.54 kg CO2 eq.
150
+
151
+ ### DALL·E Mega Estimated Emissions
152
+
153
+ DALL·E Mega is still training. So far, as on June 9, 2022, the model developers report that DALL·E Mega has been training for about 40-45 days on a TPU v3-256. Using those numbers, 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.
154
+
155
+ * **Hardware Type:** TPU v3-256
156
+ * **Hours used:** 960 - 1080 hours (40-45 days)
157
+ * **Cloud Provider:** Unknown
158
+ * **Compute Region:** Unknown
159
+ * **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** Unknown
160
+
161
+ ## Citation
162
+
163
+ ```bibtext
164
+ @misc{Dayma_DALL·E_Mini_2021,
165
+ author = {Dayma, Boris and Patil, Suraj and Cuenca, Pedro and Saifullah, Khalid and Abraham, Tanishq and Lê Khắc, Phúc and Melas, Luke and Ghosh, Ritobrata},
166
+ doi = {10.5281/zenodo.5146400},
167
+ month = {7},
168
+ title = {DALL·E Mini},
169
+ url = {https://github.com/borisdayma/dalle-mini},
170
+ year = {2021}
171
+ }
172
+ ```
173
+
174
+ *This model card was written by: Boris Dayma, Margaret Mitchell, Ezi Ozoani, Marissa Gerchick, Irene Solaiman, Clémentine Fourrier, Sasha Luccioni, Emily Witko, Nazneen Rajani, and Julian Herrera.*