多功能扩散: 文本、图像和变化,全部融合在一个扩散模型中,arXiv 2022 / ICCV 2023
This repo hosts the official implementary of:
Xingqian Xu, Atlas Wang, Eric Zhang, Kai Wang, and Humphrey Shi, Versatile Diffusion: Text, Images and Variations All in One Diffusion Model, Paper arXiv Link.
We built Versatile Diffusion (VD), the first unified multi-flow multimodal diffusion framework, as a step towards Universal Generative AI. Versatile Diffusion can natively support image-to-text, image-variation, text-to-image, and text-variation, and can be further extended to other applications such as semantic-style disentanglement, image-text dual-guided generation, latent image-to-text-to-image editing, and more. Future versions will support more modalities such as speech, music, video and 3D.
One single flow of Versatile Diffusion contains a VAE, a diffuser, and a context encoder, and thus handles one task (e.g., text-to-image) under one data type (e.g., image) and one context type (e.g., text). The multi-flow structure of Versatile Diffusion shows in the following diagram:
According to Versatile Diffusion, we further proposed a generalized multi-flow multimodal framework with VAEs, context encoders, and diffusers containing three layers (i.e., global, data, and context layers). To involve a new multimodal task in this framework, we bring out the following requirements:
We use Laion2B-en with customized data filters as our main dataset. Since Laion2B is very large and typical training is less than one epoch, we usually do not need to download the complete dataset for training. Same story for VDs.
Directory of Laion2B for our code:
├── data
│ └── laion2b
│ └── data
│ └── 00000.tar
│ └── 00000.parquet
│ └── 00000_stats.jsom_
│ └── 00001.tar
│ └── ...
These compressed data are generated with img2dataset API official github link.
conda create -n versatile-diffusion python=3.8
conda activate versatile-diffusion
conda install pytorch==1.12.1 torchvision=0.13.1 -c pytorch
[Alternatively] pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install -r requirements.txt
All pretrained models can be downloaded from Hugging Face link. The pretrained folder should include the following files:
├── pretrained
│ └── kl-f8.pth
│ └── optimus-vae.pth
│ └── vd-four-flow-v1-0.pth
│ └── vd-four-flow-v1-0-fp16.pth
Model named with -fp16 are models with float16 parameters, which is half size of the float32 models.
We now provide a convenience WebUI app.py that supports all applications. Start the WebUI with the following command:
python app.py
The WebUI contains the following new features:
The following old features have been temporarily disabled:
Text-to-Image
Image-Variation
Image-Variation with Semantic Focus
Dual-guided
@article{xu2022versatile,
title = {Versatile Diffusion: Text, Images and Variations All in One Diffusion Model},
author = {Xingqian Xu, Zhangyang Wang, Eric Zhang, Kai Wang, Humphrey Shi},
year = 2022,
url = {https://arxiv.org/abs/2211.08332},
eprint = {2211.08332},
archiveprefix = {arXiv},
primaryclass = {cs.CV}
}
Part of the codes reorganizes/reimplements code from the following repositories: LDM official Github, which also oriented from DDPM official Github.
暂无开放 Issues,或尚未同步最近议题。