模型概述
模型特點
模型能力
使用案例
🚀 VGen
VGen是由阿里巴巴集團通義實驗室開發的開源視頻合成代碼庫,擁有先進的視頻生成模型。該項目能夠根據輸入的文本、圖像、期望的動作、期望的主題,甚至提供的反饋信號,生成高質量的視頻。此外,它還提供了各種常用的視頻生成工具,如可視化、採樣、訓練、推理、圖像和視頻聯合訓練、加速等功能。
🚀 快速開始
準備工作
安裝環境
conda create -n vgen python=3.8
conda activate vgen
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
數據集
我們提供了一個包含圖像和視頻的演示數據集,以及它們的列表,位於data
目錄下。
⚠️ 重要提示:這裡使用的演示圖像僅用於測試,未包含在訓練數據中。
克隆代碼庫
git clone https://github.com/damo-vilab/i2vgen-xl.git
cd i2vgen-xl
訓練文本到視頻模型
執行以下命令即可輕鬆開啟分佈式訓練:
python train_net.py --cfg configs/t2v_train.yaml
在t2v_train.yaml
配置文件中,你可以指定數據、使用frame_lens
調整視頻與圖像的比例,並通過不同的擴散設置驗證你的想法等。
- 訓練前,你可以下載我們的任何開源模型進行初始化。我們的代碼庫支持自定義初始化和
grad_scale
設置,所有這些都包含在yaml文件的Pretrain
項中。 - 訓練期間,你可以在
workspace/experiments/t2v_train
目錄中查看保存的模型和中間推理結果。
訓練完成後,你可以使用以下命令對模型進行推理:
python inference.py --cfg configs/t2v_infer.yaml
然後你可以在workspace/experiments/test_img_01
目錄中找到生成的視頻。有關數據、模型、種子等具體配置,請參考t2v_infer.yaml
文件。
運行I2VGen - XL模型
下載模型和測試數據
!pip install modelscope
from modelscope.hub.snapshot_download import snapshot_download
model_dir = snapshot_download('damo/I2VGen-XL', cache_dir='models/', revision='v1.0.0')
運行推理命令
python inference.py --cfg configs/i2vgen_xl_infer.yaml
幾分鐘後,你可以從workspace/experiments/test_img_01
目錄中獲取你想要創建的高清視頻。目前,由於缺乏相關訓練數據,我們發現當前模型在動漫圖像和黑色背景圖像上的表現不佳,我們正在不斷努力優化。
⚠️ 重要提示:由於我們的視頻質量在GIF格式中被壓縮,請點擊下面的'HERE'查看原始視頻。
其他方法
正在籌備中。
✨ 主要特性
- 可擴展性:便於管理你自己的實驗。
- 完整性:涵蓋了視頻生成的所有常見組件。
- 卓越性能:在多個任務中擁有強大的預訓練模型。
📦 安裝指南
環境安裝
conda create -n vgen python=3.8
conda activate vgen
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
克隆代碼
git clone https://github.com/damo-vilab/i2vgen-xl.git
cd i2vgen-xl
💻 使用示例
基礎用法
訓練文本到視頻模型
# 開啟分佈式訓練
python train_net.py --cfg configs/t2v_train.yaml
# 訓練完成後進行推理
python inference.py --cfg configs/t2v_infer.yaml
運行I2VGen - XL模型
# 下載模型和測試數據
!pip install modelscope
from modelscope.hub.snapshot_download import snapshot_download
model_dir = snapshot_download('damo/I2VGen-XL', cache_dir='models/', revision='v1.0.0')
# 運行推理命令
python inference.py --cfg configs/i2vgen_xl_infer.yaml
高級用法
集成I2VGenXL與 🧨 diffusers
import torch
from diffusers import I2VGenXLPipeline
from diffusers.utils import load_image, export_to_gif
repo_id = "ali-vilab/i2vgen-xl"
pipeline = I2VGenXLPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, variant="fp16").to("cuda")
image_url = "https://github.com/ali-vilab/i2vgen-xl/blob/main/data/test_images/img_0009.png?download=true"
image = load_image(image_url).convert("RGB")
prompt = "Papers were floating in the air on a table in the library"
generator = torch.manual_seed(8888)
frames = pipeline(
prompt=prompt,
image=image,
generator=generator
).frames[0]
print(export_to_gif(frames))
📚 詳細文檔
自定義方法
我們的代碼庫本質上支持視頻生成中所有常用的組件。你可以通過添加相應的註冊類(包括ENGINE, MODEL, DATASETS, EMBEDDER, AUTO_ENCODER, DISTRIBUTION, VISUAL, DIFFUSION, PRETRAIN
)靈活管理你的實驗,並且可以根據自己的需求兼容我們所有的開源算法。如果你有任何問題,請隨時給我們反饋。
I2VGenXL與 🧨 diffusers集成文檔
你可以在這裡找到官方文檔。
示例輸出
使用I2VGenXL的示例輸出:
提示詞 | 輸出示例 |
---|---|
masterpiece, bestquality, sunset. | ![]() |
🔧 技術細節
本項目實現了以下方法:
- I2VGen - XL: High - quality image - to - video synthesis via cascaded diffusion models
- VideoComposer: Compositional Video Synthesis with Motion Controllability
- Hierarchical Spatio - temporal Decoupling for Text - to - Video Generation
- A Recipe for Scaling up Text - to - Video Generation with Text - free Videos
- InstructVideo: Instructing Video Diffusion Models with Human Feedback
- DreamVideo: Composing Your Dream Videos with Customized Subject and Motion
- VideoLCM: Video Latent Consistency Model
- Modelscope text - to - video technical report
📄 許可證
本項目採用MIT許可證。
🔥 最新消息
- [2023.12] 我們發佈了高效視頻生成方法VideoLCM
- [2023.12] 我們發佈了I2VGen - XL和ModelScope T2V的代碼和模型
- [2023.12] 我們發佈了文本到視頻方法HiGen和自定義文本到視頻方法DreamVideo
- [2023.12] 我們為VGen編寫了一份介紹文檔,並將I2VGen - XL與SVD進行了比較
- [2023.11] 我們發佈了高質量的I2VGen - XL模型,請參考網頁
TODO
- [x] 發佈I2VGen - XL的技術論文和網頁
- [x] 發佈可以生成1280x720視頻的代碼和預訓練模型
- [ ] 發佈專門針對人體和麵部優化的模型
- [ ] 更新版本能夠完全保持身份並同時捕捉大而準確的動作
- [ ] 發佈其他方法和相應的模型
BibTeX
如果這個倉庫對你有用,請引用我們相應的技術論文:
@article{2023i2vgenxl,
title={I2VGen-XL: High-Quality Image-to-Video Synthesis via Cascaded Diffusion Models},
author={Zhang, Shiwei and Wang, Jiayu and Zhang, Yingya and Zhao, Kang and Yuan, Hangjie and Qing, Zhiwu and Wang, Xiang and Zhao, Deli and Zhou, Jingren},
booktitle={arXiv preprint arXiv:2311.04145},
year={2023}
}
@article{2023videocomposer,
title={VideoComposer: Compositional Video Synthesis with Motion Controllability},
author={Wang, Xiang and Yuan, Hangjie and Zhang, Shiwei and Chen, Dayou and Wang, Jiuniu, and Zhang, Yingya, and Shen, Yujun, and Zhao, Deli and Zhou, Jingren},
booktitle={arXiv preprint arXiv:2306.02018},
year={2023}
}
@article{wang2023modelscope,
title={Modelscope text-to-video technical report},
author={Wang, Jiuniu and Yuan, Hangjie and Chen, Dayou and Zhang, Yingya and Wang, Xiang and Zhang, Shiwei},
journal={arXiv preprint arXiv:2308.06571},
year={2023}
}
@article{dreamvideo,
title={DreamVideo: Composing Your Dream Videos with Customized Subject and Motion},
author={Wei, Yujie and Zhang, Shiwei and Qing, Zhiwu and Yuan, Hangjie and Liu, Zhiheng and Liu, Yu and Zhang, Yingya and Zhou, Jingren and Shan, Hongming},
journal={arXiv preprint arXiv:2312.04433},
year={2023}
}
@article{qing2023higen,
title={Hierarchical Spatio-temporal Decoupling for Text-to-Video Generation},
author={Qing, Zhiwu and Zhang, Shiwei and Wang, Jiayu and Wang, Xiang and Wei, Yujie and Zhang, Yingya and Gao, Changxin and Sang, Nong },
journal={arXiv preprint arXiv:2312.04483},
year={2023}
}
@article{wang2023videolcm,
title={VideoLCM: Video Latent Consistency Model},
author={Wang, Xiang and Zhang, Shiwei and Zhang, Han and Liu, Yu and Zhang, Yingya and Gao, Changxin and Sang, Nong },
journal={arXiv preprint arXiv:2312.09109},
year={2023}
}
免責聲明
這個開源模型是使用WebVid - 10M和LAION - 400M數據集訓練的,僅用於研究/非商業用途。



