dalle-mini / README.md
boris's picture
feat: add sinkformer + custom final ln + pre-ln (#151)
f139b0b unverified
metadata
title: DALL·E mini
emoji: 🥑
colorFrom: yellow
colorTo: green
sdk: streamlit
app_file: app/streamlit/app.py
pinned: true

DALL·E Mini

Join us on Discord

Generate images from a text prompt

Our logo was generated with DALL·E mini using the prompt "logo of an armchair in the shape of an avocado".

You can create your own pictures with the demo.

How does it work?

Refer to our report.

Inference Pipeline

To generate sample predictions and understand the inference pipeline step by step, refer to tools/inference/inference_pipeline.ipynb.

Open In Colab

Contributing

Join the community on the DALLE-Pytorch Discord. Any contribution is welcome, from reporting issues to proposing fixes/improvements or testing the model with cool prompts!

Development

Dependencies Installation

For inference only, use pip install git+https://github.com/borisdayma/dalle-mini.git.

For development, clone the repo and use pip install -e ".[dev]". Before making a PR, check style with make style.

Image Encoder

We use a VQGAN from taming-transformers, which can also be fine-tuned.

Use patil-suraj/vqgan-jax if you want to convert a checkpoint to JAX (does not support Gumbel).

Any image encoder that turns an image into a fixed sequence of tokens can be used.

Training of DALL·E mini

Use tools/train/train.py.

You can also adjust the sweep configuration file if you need to perform a hyperparameter search.

FAQ

Where to find the latest models?

Trained models are on 🤗 Model Hub:

Where does the logo come from?

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.

Acknowledgements

Authors & Contributors

DALL·E mini was initially developed by:

Many thanks to the people who helped make it better:

Citing DALL·E mini

If you find DALL·E mini useful in your research or wish to refer, please use the following BibTeX entry.

@misc{Dayma_DALL·E_Mini_2021,
      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},
      doi = {10.5281/zenodo.5146400},
      month = {7},
      title = {DALL·E Mini},
      url = {https://github.com/borisdayma/dalle-mini},
      year = {2021}
}

References

Original DALL·E from "Zero-Shot Text-to-Image Generation" with image quantization from "Learning Transferable Visual Models From Natural Language Supervision".

Image encoder from "Taming Transformers for High-Resolution Image Synthesis".

Sequence to sequence model based on "BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension" with implementation of a few variants:

Main optimizer (Distributed Shampoo) from "Scalable Second Order Optimization for Deep Learning".

Citations

@misc{ramesh2021zeroshot,
      title={Zero-Shot Text-to-Image Generation}, 
      author={Aditya Ramesh and Mikhail Pavlov and Gabriel Goh and Scott Gray and Chelsea Voss and Alec Radford and Mark Chen and Ilya Sutskever},
      year={2021},
      eprint={2102.12092},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
@misc{radford2021learning,
      title={Learning Transferable Visual Models From Natural Language Supervision}, 
      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},
      year={2021},
      eprint={2103.00020},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
@misc{esser2021taming,
      title={Taming Transformers for High-Resolution Image Synthesis}, 
      author={Patrick Esser and Robin Rombach and Björn Ommer},
      year={2021},
      eprint={2012.09841},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
@misc{lewis2019bart,
      title={BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension}, 
      author={Mike Lewis and Yinhan Liu and Naman Goyal and Marjan Ghazvininejad and Abdelrahman Mohamed and Omer Levy and Ves Stoyanov and Luke Zettlemoyer},
      year={2019},
      eprint={1910.13461},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
@misc{anil2021scalable,
      title={Scalable Second Order Optimization for Deep Learning},
      author={Rohan Anil and Vineet Gupta and Tomer Koren and Kevin Regan and Yoram Singer},
      year={2021},
      eprint={2002.09018},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}
@misc{shazeer2020glu,
      title={GLU Variants Improve Transformer},
      author={Noam Shazeer},
      year={2020},
      url={https://arxiv.org/abs/2002.05202}    
}
 @misc{wang_ma_dong_huang_zhang_wei_2022,
       title={DeepNet: Scaling transformers to 1,000 layers},
       author={Wang, Hongyu and Ma, Shuming and Dong, Li and Huang, Shaohan and Zhang, Dongdong and Wei, Furu},
       year={2022},
       eprint={2203.00555}
       archivePrefix={arXiv},
       primaryClass={cs.LG}
} 
@misc{shleifer2021normformer,
      title={NormFormer: Improved Transformer Pretraining with Extra Normalization},
      author={Sam Shleifer and Jason Weston and Myle Ott},
      year={2021},
      eprint={2110.09456},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
@inproceedings{liu2021swinv2,
               title={Swin Transformer V2: Scaling Up Capacity and Resolution}, 
               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},
               booktitle={International Conference on Computer Vision and Pattern Recognition (CVPR)},
               year={2022}
}
@misc{ding2021cogview,
      title = {CogView: Mastering Text-to-Image Generation via Transformers},
      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},
      year = {2021},
      eprint = {2105.13290},
      archivePrefix = {arXiv},
      primaryClass = {cs.CV}
}
@misc{zhang2019root,
      title = {Root Mean Square Layer Normalization},
      author = {Biao Zhang and Rico Sennrich},
      year = {2019},
      eprint = {1910.07467},
      archivePrefix = {arXiv},
      primaryClass = {cs.LG}
}
@misc{title = {Sinkformers: Transformers with Doubly Stochastic Attention},
      url = {https://arxiv.org/abs/2110.11773},
      author = {Sander, Michael E. and Ablin, Pierre and Blondel, Mathieu and Peyré, Gabriel},
      publisher = {arXiv},
      year = {2021},
}