🚀 開放域文本到視頻合成模型
本模型基於多階段文本到視頻生成擴散模型,輸入描述文本,即可返回與文本描述相匹配的視頻。目前僅支持英文輸入。
我們正在招聘!(工作地點:中國北京/杭州)
如果你正在尋找富有挑戰性的工作,渴望在AIGC和大規模預訓練領域探索前沿技術,那麼我們就是你的理想之選。我們誠邀才華橫溢、積極進取且富有創造力的你加入我們的團隊。如果您感興趣,請將簡歷發送給我們。
郵箱:yingya.zyy@alibaba-inc.com
🚀 快速開始
安裝所需庫
$ pip install diffusers transformers accelerate torch
生成視頻
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import export_to_video
pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
prompt = "Spiderman is surfing"
video_frames = pipe(prompt, num_inference_steps=25).frames
video_path = export_to_video(video_frames)
長視頻生成
你可以通過啟用注意力和VAE切片並使用Torch 2.0來優化內存使用。這樣,在GPU顯存小於16GB的情況下,你也可以生成長達25秒的視頻。
$ pip install git+https://github.com/huggingface/diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import export_to_video
pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
pipe.enable_vae_slicing()
prompt = "Spiderman is surfing. Darth Vader is also surfing and following Spiderman"
video_frames = pipe(prompt, num_inference_steps=25, num_frames=200).frames
video_path = export_to_video(video_frames)
查看結果
上述代碼將顯示輸出視頻的保存路徑,當前編碼格式可使用VLC播放器播放。輸出的mp4文件可通過VLC媒體播放器查看,其他一些媒體播放器可能無法正常查看。
✨ 主要特性
- 本模型基於多階段文本到視頻生成擴散模型,輸入文本描述即可生成匹配的視頻。
- 模型具有廣泛的應用場景,能夠根據任意英文文本描述進行推理並生成視頻。
📚 詳細文檔
模型描述
文本到視頻生成擴散模型由三個子網絡組成:文本特徵提取模型、文本特徵到視頻潛在空間擴散模型以及視頻潛在空間到視頻視覺空間模型。整體模型參數約17億。目前僅支持英文輸入。擴散模型採用UNet3D結構,通過從純高斯噪聲視頻的迭代去噪過程實現視頻生成。
本模型僅用於研究目的,請查看模型侷限性、偏差和濫用情況以及惡意使用和過度使用情況部分。
模型詳情
使用案例
本模型應用廣泛,能夠根據任意英文文本描述進行推理並生成視頻。
模型侷限性和偏差
- 模型基於Webvid等公共數據集進行訓練,生成結果可能與訓練數據的分佈存在偏差。
- 本模型無法實現完美的影視級質量生成。
- 模型無法生成清晰的文本。
- 模型主要使用英文語料進行訓練,目前不支持其他語言。
- 該模型在複雜構圖生成任務上的性能有待提高。
濫用、惡意使用和過度使用
- 模型並非用於真實地呈現人物或事件,因此使用其生成此類內容超出了模型的能力範圍。
- 嚴禁生成對人或其環境、文化、宗教等有貶低或有害的內容。
- 禁止用於色情、暴力和血腥內容的生成。
- 禁止用於錯誤和虛假信息的生成。
訓練數據
訓練數據包括LAION5B、ImageNet、Webvid等公共數據集。在預訓練後,會進行圖像和視頻過濾,如美學評分、水印評分和去重等操作。
引用
@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}
}
@InProceedings{VideoFusion,
author = {Luo, Zhengxiong and Chen, Dayou and Zhang, Yingya and Huang, Yan and Wang, Liang and Shen, Yujun and Zhao, Deli and Zhou, Jingren and Tan, Tieniu},
title = {VideoFusion: Decomposed Diffusion Models for High-Quality Video Generation},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2023}
}
(本模型卡片部分內容取自此處)