This repository is the official PyTorch implementation of LaVie.
LaVie is a Text-to-Video (T2V) generation framework, and main part of video generation system Vchitect. You can also check our fine-tuned Image-to-Video (I2V) model SEINE.
[2024.07.08]: LaVie-2 will be released soon, stay tuned!
lavie2.mp4
conda env create -f environment.yml
conda activate lavie
Download pre-trained LaVie models, Stable Diffusion 1.4, stable-diffusion-x4-upscaler to ./pretrained_models
. You should be able to see the following:
├── pretrained_models
│ ├── lavie_base.pt
│ ├── lavie_interpolation.pt
│ ├── lavie_vsr.pt
│ ├── stable-diffusion-v1-4
│ │ ├── ...
└── └── stable-diffusion-x4-upscaler
├── ...
Gallery:
Feel free to try different prompts, and share with us which one you like the most!
The inference contains Base T2V, Video Interpolation and Video Super-Resolution three steps. We provide several options to generate videos:
Step1 | Step2 | Step3 | Resolution | Length | |
---|---|---|---|---|---|
option1 | ✔ | 320x512 | 16 | ||
option2 | ✔ | ✔ | 320x512 | 61 | |
option3 | ✔ | ✔ | 1280x2048 | 16 | |
option4 | ✔ | ✔ | ✔ | 1280x2048 | 61 |
Feel free to try different options :)
Run following command to generate videos from base T2V model.
cd base
python pipelines/sample.py --config configs/sample.yaml
In configs/sample.yaml, arguments for inference:
-
ckpt_path: Path to the downloaded LaVie base model, default is
../pretrained_models/lavie_base.pt
-
pretrained_models: Path to the downloaded SD1.4, default is
../pretrained_models
-
output_folder: Path to save generated results, default is
../res/base
-
seed: Seed to be used,
None
for random generation -
sample_method: Scheduler to use, default is
ddpm
, options areddpm
,ddim
andeulerdiscrete
-
guidance_scale: CFG scale to use, default is
7.5
-
num_sampling_steps: Denoising steps, default is
50
-
text_prompt: Prompt for generation
Following results were generated with the arguments:
seed: 400
, sample_method: ddpm
, guidance_scale: 7.0
, num_sampling_steps: 50
(you might obtain different results on different device)
Run following command to conduct video interpolation.
cd interpolation
python sample.py --config configs/sample.yaml
The default input video path is ./res/base
, results will be saved under ./res/interpolation
. In configs/sample.yaml
, you could modify default input_folder
with YOUR_INPUT_FOLDER
in configs/sample.yaml
. Input videos should be named as prompt1.mp4
, prompt2.mp4
, ... and put under YOUR_INPUT_FOLDER
. Launching the code will process all the input videos in input_folder
.
Run following command to conduct video super-resolution.
cd vsr
python sample.py --config configs/sample.yaml
The default input video path is ./res/base
and results will be saved under ./res/vsr
. You could modify default input_path
with YOUR_INPUT_FOLDER
in configs/sample.yaml
. Similar to Step2, input videos should be named as prompt1.mp4
, prompt2.mp4
, ... and put under YOUR_INPUT_FOLDER
. Launching the code will process all the input videos in input_folder
.
@article{wang2023lavie,
title={LAVIE: High-Quality Video Generation with Cascaded Latent Diffusion Models},
author={Wang, Yaohui and Chen, Xinyuan and Ma, Xin and Zhou, Shangchen and Huang, Ziqi and Wang, Yi and Yang, Ceyuan and He, Yinan and Yu, Jiashuo and Yang, Peiqing and others},
journal={IJCV},
year={2024}
}
@inproceedings{chen2023seine,
title={Seine: Short-to-long video diffusion model for generative transition and prediction},
author={Chen, Xinyuan and Wang, Yaohui and Zhang, Lingjun and Zhuang, Shaobin and Ma, Xin and Yu, Jiashuo and Wang, Yali and Lin, Dahua and Qiao, Yu and Liu, Ziwei},
booktitle={ICLR},
year={2023}
}
We disclaim responsibility for user-generated content. The model was not trained to realistically represent people or events, so using it to generate such content is beyond the model's capabilities. It is prohibited for pornographic, violent and bloody content generation, and to generate content that is demeaning or harmful to people or their environment, culture, religion, etc. Users are solely liable for their actions. The project contributors are not legally affiliated with, nor accountable for users' behaviors. Use the generative model responsibly, adhering to ethical and legal standards.
Yaohui Wang: [email protected]
Xinyuan Chen: [email protected]
Xin Ma: [email protected]
The code is built upon diffusers and Stable Diffusion, we thank all the contributors for open-sourcing.
The code is licensed under Apache-2.0, model weights are fully open for academic research and also allow free commercial usage. To apply for a commercial license, please contact [email protected].