このリポジトリは、Tune-A-Video の公式実装です。
Tune-A-Video:テキストからビデオへの生成のための画像拡散モデルのワンショットチューニング ジェイ・チャンジエ・ウー、イーシャオ・ゲ、シンタオ・ワン、スタン・ウェイシアン・レイ、ユーチャオ・グ、ウィン・スー、イン・シャン、シャオフ・チー、マイク・チェン・ショウ
pip install -r requirements.txt
GPUの効率と速度を高めるために、xformersをインストールすることを強くお勧めします。 xformers を有効にするには、(デフォルト) を設定します。
enable_xformers_memory_efficient_attention=True
事前学習済みの安定拡散モデルをダウンロードできます (例:安定拡散v1-4):
git lfs install
git clone https://huggingface.co/CompVis/stable-diffusion-v1-4
または、パーソナライズされたドリームブースモデル(例:mr-potato-head)を使用することもできます。
git lfs install
git clone https://huggingface.co/sd-dreambooth-library/mr-potato-head
テキストからビデオへの生成のテキストから画像への拡散モデルを微調整するには、次のコマンドを実行します。
accelerate launch train_tuneavideo.py --config="configs/man-surfing.yaml"
トレーニングが完了したら、推論を実行します。
from tuneavideo.pipelines.pipeline_tuneavideo import TuneAVideoPipeline
from tuneavideo.models.unet import UNet3DConditionModel
from tuneavideo.util import save_videos_grid
import torch
model_id = "path-to-your-trained-model"
unet = UNet3DConditionModel.from_pretrained(model_id, subfolder='unet', torch_dtype=torch.float16).to('cuda')
pipe = TuneAVideoPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", unet=unet, torch_dtype=torch.float16).to("cuda")
prompt = "a panda is surfing"
video = pipe(prompt, video_length=8, height=512, width=512, num_inference_steps=50, guidance_scale=7.5).videos
save_videos_grid(video, f"{prompt}.gif")
[トレーニング]男性がサーフィンをしています。 | パンダがサーフィンをしています。 | アイアンマンは砂漠でサーフィンをしています。 | アライグマはサーフィン、漫画スタイルです。 |
SKSミスターポテトヘッド。 | ピンクの帽子をかぶったSKSミスターポテトヘッドがサーフィンをしています。 | サングラスをかけたSKSミスターポテトヘッドはサーフィンをしています。 | SKSミスターポテトヘッドは森の中でサーフィンをしています。 |
@article{wu2022tuneavideo, title={Tune-A-Video: One-Shot Tuning of Image Diffusion Models for Text-to-Video Generation}, author={Wu, Jay Zhangjie and Ge, Yixiao and Wang, Xintao and Lei, Stan Weixian and Gu, Yuchao and Hsu, Wynne and Shan, Ying and Qie, Xiaohu and Shou, Mike Zheng}, journal={arXiv preprint arXiv:2212.11565}, year={2022} }