Spaces:
Runtime error
Runtime error
FritsLyneborg
commited on
Commit
•
632fa50
1
Parent(s):
990f2cd
Deres filer
Browse files- .gitattributes +8 -20
- README.md +267 -8
.gitattributes
CHANGED
@@ -1,28 +1,16 @@
|
|
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 |
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.
|
6 |
-
*.
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
26 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
1 |
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
4 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
11 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
|
|
12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
14 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
15 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
16 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
@@ -1,12 +1,271 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: streamlit
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
---
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: DALL·E mini
|
3 |
+
emoji: 🥑
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: green
|
6 |
sdk: streamlit
|
7 |
+
app_file: app/streamlit/app.py
|
8 |
+
pinned: True
|
9 |
+
license: apache-2.0
|
10 |
---
|
11 |
|
12 |
+
# DALL·E Mini
|
13 |
+
|
14 |
+
[![Join us on Discord](https://img.shields.io/discord/823813159592001537?color=5865F2&logo=discord&logoColor=white)](https://discord.gg/xBPBXfcFHd)
|
15 |
+
|
16 |
+
_Generate images from a text prompt_
|
17 |
+
|
18 |
+
<img src="https://github.com/borisdayma/dalle-mini/raw/main/img/logo.png" width="200">
|
19 |
+
|
20 |
+
Our logo was generated with DALL·E mini using the prompt "logo of an armchair in the shape of an avocado".
|
21 |
+
|
22 |
+
You can create your own pictures with [the demo](https://huggingface.co/spaces/flax-community/dalle-mini).
|
23 |
+
|
24 |
+
## How does it work?
|
25 |
+
|
26 |
+
Refer to [our report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini--Vmlldzo4NjIxODA).
|
27 |
+
|
28 |
+
## Inference Pipeline
|
29 |
+
|
30 |
+
To generate sample predictions and understand the inference pipeline step by step, refer to [`tools/inference/inference_pipeline.ipynb`](tools/inference/inference_pipeline.ipynb).
|
31 |
+
|
32 |
+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/borisdayma/dalle-mini/blob/main/tools/inference/inference_pipeline.ipynb)
|
33 |
+
|
34 |
+
## Contributing
|
35 |
+
|
36 |
+
Join the community on the [DALLE-Pytorch Discord](https://discord.gg/xBPBXfcFHd).
|
37 |
+
Any contribution is welcome, from reporting issues to proposing fixes/improvements or testing the model with cool prompts!
|
38 |
+
|
39 |
+
## Development
|
40 |
+
|
41 |
+
### Dependencies Installation
|
42 |
+
|
43 |
+
For inference only, use `pip install git+https://github.com/borisdayma/dalle-mini.git`.
|
44 |
+
|
45 |
+
For development, clone the repo and use `pip install -e ".[dev]"`.
|
46 |
+
Before making a PR, check style with `make style`.
|
47 |
+
|
48 |
+
### Image Encoder
|
49 |
+
|
50 |
+
We use a VQGAN from [taming-transformers](https://github.com/CompVis/taming-transformers), which can also be fine-tuned.
|
51 |
+
|
52 |
+
Use [patil-suraj/vqgan-jax](https://github.com/patil-suraj/vqgan-jax) if you want to convert a checkpoint to JAX (does not support Gumbel).
|
53 |
+
|
54 |
+
Any image encoder that turns an image into a fixed sequence of tokens can be used.
|
55 |
+
|
56 |
+
### Training of DALL·E mini
|
57 |
+
|
58 |
+
Use [`tools/train/train.py`](tools/train/train.py).
|
59 |
+
|
60 |
+
You can also adjust the [sweep configuration file](https://docs.wandb.ai/guides/sweeps) if you need to perform a hyperparameter search.
|
61 |
+
|
62 |
+
## FAQ
|
63 |
+
|
64 |
+
### Where to find the latest models?
|
65 |
+
|
66 |
+
Trained models are on 🤗 Model Hub:
|
67 |
+
|
68 |
+
- [VQGAN-f16-16384](https://huggingface.co/dalle-mini/vqgan_imagenet_f16_16384) for encoding/decoding images
|
69 |
+
- [DALL·E mini](https://huggingface.co/flax-community/dalle-mini) for generating images from a text prompt
|
70 |
+
|
71 |
+
### Where does the logo come from?
|
72 |
+
|
73 |
+
The "armchair in the shape of an avocado" was used by OpenAI when releasing DALL·E to illustrate the model's capabilities. Having successful predictions on this prompt represents a big milestone to us.
|
74 |
+
|
75 |
+
## Acknowledgements
|
76 |
+
|
77 |
+
- 🤗 Hugging Face for organizing [the FLAX/JAX community week](https://github.com/huggingface/transformers/tree/master/examples/research_projects/jax-projects)
|
78 |
+
- Google [TPU Research Cloud (TRC) program](https://sites.research.google/trc/) for providing computing resources
|
79 |
+
- [Weights & Biases](https://wandb.com/) for providing the infrastructure for experiment tracking and model management
|
80 |
+
|
81 |
+
## Authors & Contributors
|
82 |
+
|
83 |
+
DALL·E mini was initially developed by:
|
84 |
+
|
85 |
+
- [Boris Dayma](https://github.com/borisdayma)
|
86 |
+
- [Suraj Patil](https://github.com/patil-suraj)
|
87 |
+
- [Pedro Cuenca](https://github.com/pcuenca)
|
88 |
+
- [Khalid Saifullah](https://github.com/khalidsaifullaah)
|
89 |
+
- [Tanishq Abraham](https://github.com/tmabraham)
|
90 |
+
- [Phúc Lê Khắc](https://github.com/lkhphuc)
|
91 |
+
- [Luke Melas](https://github.com/lukemelas)
|
92 |
+
- [Ritobrata Ghosh](https://github.com/ghosh-r)
|
93 |
+
|
94 |
+
Many thanks to the people who helped make it better:
|
95 |
+
|
96 |
+
- the [DALLE-Pytorch](https://discord.gg/xBPBXfcFHd) and [EleutherAI](https://www.eleuther.ai/) communities for testing and exchanging cool ideas
|
97 |
+
- [Rohan Anil](https://github.com/rohan-anil) for adding Distributed Shampoo optimizer
|
98 |
+
- [Phil Wang](https://github.com/lucidrains) has provided a lot of cool implementations of transformer variants and gives interesting insights with [x-transformers](https://github.com/lucidrains/x-transformers)
|
99 |
+
- [Katherine Crowson](https://github.com/crowsonkb) for [super conditioning](https://twitter.com/RiversHaveWings/status/1478093658716966912)
|
100 |
+
|
101 |
+
## Citing DALL·E mini
|
102 |
+
|
103 |
+
If you find DALL·E mini useful in your research or wish to refer, please use the following BibTeX entry.
|
104 |
+
|
105 |
+
```text
|
106 |
+
@misc{Dayma_DALL·E_Mini_2021,
|
107 |
+
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},
|
108 |
+
doi = {10.5281/zenodo.5146400},
|
109 |
+
month = {7},
|
110 |
+
title = {DALL·E Mini},
|
111 |
+
url = {https://github.com/borisdayma/dalle-mini},
|
112 |
+
year = {2021}
|
113 |
+
}
|
114 |
+
```
|
115 |
+
|
116 |
+
## References
|
117 |
+
|
118 |
+
Original DALL·E from "[Zero-Shot Text-to-Image Generation](https://arxiv.org/abs/2102.12092)" with image quantization from "[Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020)".
|
119 |
+
|
120 |
+
Image encoder from "[Taming Transformers for High-Resolution Image Synthesis](https://arxiv.org/abs/2012.09841v2)".
|
121 |
+
|
122 |
+
Sequence to sequence model based on "[BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461v1)" with implementation of a few variants:
|
123 |
+
|
124 |
+
- "[GLU Variants Improve Transformer](https://arxiv.org/abs/2002.05202)"
|
125 |
+
- "[Deepnet: Scaling Transformers to 1,000 Layers](https://arxiv.org/abs/2203.00555)"
|
126 |
+
- "[NormFormer: Improved Transformer Pretraining with Extra Normalization](https://arxiv.org/abs/2110.09456)"
|
127 |
+
- "[Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030)"
|
128 |
+
- "[CogView: Mastering Text-to-Image Generation via Transformers](https://arxiv.org/abs/2105.13290v2)"
|
129 |
+
- "[Root Mean Square Layer Normalization](https://arxiv.org/abs/1910.07467)"
|
130 |
+
- "[Sinkformers: Transformers with Doubly Stochastic Attention](https://arxiv.org/abs/2110.11773)"
|
131 |
+
|
132 |
+
Main optimizer (Distributed Shampoo) from "[Scalable Second Order Optimization for Deep Learning](https://arxiv.org/abs/2002.09018)".
|
133 |
+
|
134 |
+
### Citations
|
135 |
+
|
136 |
+
```text
|
137 |
+
@misc{
|
138 |
+
title={Zero-Shot Text-to-Image Generation},
|
139 |
+
author={Aditya Ramesh and Mikhail Pavlov and Gabriel Goh and Scott Gray and Chelsea Voss and Alec Radford and Mark Chen and Ilya Sutskever},
|
140 |
+
year={2021},
|
141 |
+
eprint={2102.12092},
|
142 |
+
archivePrefix={arXiv},
|
143 |
+
primaryClass={cs.CV}
|
144 |
+
}
|
145 |
+
```
|
146 |
+
|
147 |
+
```text
|
148 |
+
@misc{
|
149 |
+
title={Learning Transferable Visual Models From Natural Language Supervision},
|
150 |
+
author={Alec Radford and Jong Wook Kim and Chris Hallacy and Aditya Ramesh and Gabriel Goh and Sandhini Agarwal and Girish Sastry and Amanda Askell and Pamela Mishkin and Jack Clark and Gretchen Krueger and Ilya Sutskever},
|
151 |
+
year={2021},
|
152 |
+
eprint={2103.00020},
|
153 |
+
archivePrefix={arXiv},
|
154 |
+
primaryClass={cs.CV}
|
155 |
+
}
|
156 |
+
```
|
157 |
+
|
158 |
+
```text
|
159 |
+
@misc{
|
160 |
+
title={Taming Transformers for High-Resolution Image Synthesis},
|
161 |
+
author={Patrick Esser and Robin Rombach and Björn Ommer},
|
162 |
+
year={2021},
|
163 |
+
eprint={2012.09841},
|
164 |
+
archivePrefix={arXiv},
|
165 |
+
primaryClass={cs.CV}
|
166 |
+
}
|
167 |
+
```
|
168 |
+
|
169 |
+
```text
|
170 |
+
@misc{
|
171 |
+
title={BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension},
|
172 |
+
author={Mike Lewis and Yinhan Liu and Naman Goyal and Marjan Ghazvininejad and Abdelrahman Mohamed and Omer Levy and Ves Stoyanov and Luke Zettlemoyer},
|
173 |
+
year={2019},
|
174 |
+
eprint={1910.13461},
|
175 |
+
archivePrefix={arXiv},
|
176 |
+
primaryClass={cs.CL}
|
177 |
+
}
|
178 |
+
```
|
179 |
+
|
180 |
+
```text
|
181 |
+
@misc{
|
182 |
+
title={Scalable Second Order Optimization for Deep Learning},
|
183 |
+
author={Rohan Anil and Vineet Gupta and Tomer Koren and Kevin Regan and Yoram Singer},
|
184 |
+
year={2021},
|
185 |
+
eprint={2002.09018},
|
186 |
+
archivePrefix={arXiv},
|
187 |
+
primaryClass={cs.LG}
|
188 |
+
}
|
189 |
+
```
|
190 |
+
|
191 |
+
```text
|
192 |
+
@misc{
|
193 |
+
title={GLU Variants Improve Transformer},
|
194 |
+
author={Noam Shazeer},
|
195 |
+
year={2020},
|
196 |
+
url={https://arxiv.org/abs/2002.05202}
|
197 |
+
}
|
198 |
+
```
|
199 |
+
|
200 |
+
```text
|
201 |
+
@misc{
|
202 |
+
title={DeepNet: Scaling transformers to 1,000 layers},
|
203 |
+
author={Wang, Hongyu and Ma, Shuming and Dong, Li and Huang, Shaohan and Zhang, Dongdong and Wei, Furu},
|
204 |
+
year={2022},
|
205 |
+
eprint={2203.00555}
|
206 |
+
archivePrefix={arXiv},
|
207 |
+
primaryClass={cs.LG}
|
208 |
+
}
|
209 |
+
```
|
210 |
+
|
211 |
+
```text
|
212 |
+
@misc{
|
213 |
+
title={NormFormer: Improved Transformer Pretraining with Extra Normalization},
|
214 |
+
author={Sam Shleifer and Jason Weston and Myle Ott},
|
215 |
+
year={2021},
|
216 |
+
eprint={2110.09456},
|
217 |
+
archivePrefix={arXiv},
|
218 |
+
primaryClass={cs.CL}
|
219 |
+
}
|
220 |
+
```
|
221 |
+
|
222 |
+
```text
|
223 |
+
@inproceedings{
|
224 |
+
title={Swin Transformer V2: Scaling Up Capacity and Resolution},
|
225 |
+
author={Ze Liu and Han Hu and Yutong Lin and Zhuliang Yao and Zhenda Xie and Yixuan Wei and Jia Ning and Yue Cao and Zheng Zhang and Li Dong and Furu Wei and Baining Guo},
|
226 |
+
booktitle={International Conference on Computer Vision and Pattern Recognition (CVPR)},
|
227 |
+
year={2022}
|
228 |
+
}
|
229 |
+
```
|
230 |
+
|
231 |
+
```text
|
232 |
+
@misc{
|
233 |
+
title = {CogView: Mastering Text-to-Image Generation via Transformers},
|
234 |
+
author = {Ming Ding and Zhuoyi Yang and Wenyi Hong and Wendi Zheng and Chang Zhou and Da Yin and Junyang Lin and Xu Zou and Zhou Shao and Hongxia Yang and Jie Tang},
|
235 |
+
year = {2021},
|
236 |
+
eprint = {2105.13290},
|
237 |
+
archivePrefix = {arXiv},
|
238 |
+
primaryClass = {cs.CV}
|
239 |
+
}
|
240 |
+
```
|
241 |
+
|
242 |
+
```text
|
243 |
+
@misc{
|
244 |
+
title = {Root Mean Square Layer Normalization},
|
245 |
+
author = {Biao Zhang and Rico Sennrich},
|
246 |
+
year = {2019},
|
247 |
+
eprint = {1910.07467},
|
248 |
+
archivePrefix = {arXiv},
|
249 |
+
primaryClass = {cs.LG}
|
250 |
+
}
|
251 |
+
```
|
252 |
+
|
253 |
+
```text
|
254 |
+
@misc{
|
255 |
+
title = {Sinkformers: Transformers with Doubly Stochastic Attention},
|
256 |
+
url = {https://arxiv.org/abs/2110.11773},
|
257 |
+
author = {Sander, Michael E. and Ablin, Pierre and Blondel, Mathieu and Peyré, Gabriel},
|
258 |
+
publisher = {arXiv},
|
259 |
+
year = {2021},
|
260 |
+
}
|
261 |
+
```
|
262 |
+
|
263 |
+
```text
|
264 |
+
@misc{
|
265 |
+
title = {Smooth activations and reproducibility in deep networks},
|
266 |
+
url = {https://arxiv.org/abs/2010.09931},
|
267 |
+
author = {Shamir, Gil I. and Lin, Dong and Coviello, Lorenzo},
|
268 |
+
publisher = {arXiv},
|
269 |
+
year = {2020},
|
270 |
+
}
|
271 |
+
```
|