見出し画像

WSL2でComfyUI+ComfyUI-AnimateDiff-Evolvedを試してみる

未来の私のために、備忘録。

AnimateDiff MotionDirectorで学習させたデータを試したいがためだけに、AnimateDiff ComfyUI-AnimateDiff-Evolvedを試します。

※AnimateDiff MotionDirectorでの学習データの作り方は以下を参照ください。

使用するPCはドスパラさんの「GALLERIA UL9C-R49」。スペックは
・CPU: Intel® Core™ i9-13900HX Processor
・Mem: 64 GB
・GPU: NVIDIA® GeForce RTX™ 4090 Laptop GPU(16GB)
・GPU: NVIDIA® GeForce RTX™ 4090 (24GB)
・OS: Ubuntu22.04 on WSL2(Windows 11)
です。


1. 準備

今回セットアップするのは、ComfyUIとカスタマノードであるComfyUI-AnimateDiff-EvolvedとComfyUI-VideoHelperSuiteの2つです。

環境構築

venv環境構築。

python3 -m venv comfyui
cd $_
source bin/activate

まずはComfyUIから。

git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI
pip install -r requirements.txt

続いてComfyUI-AnimateDiff-Evolved。

cd custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved

最後にComfyUI-VideoHelperSuite。

git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite
cd ComfyUI-VideoHelperSuite
pip install -r requirements.txt
cd ../..

2. モデルの配置

ComfyUIの適切なディレクトリにモデルやらLoRAやらをダウンロード&配置していきます。

./models/checkpoints

SDv1.5を配置します。

git clone https://huggingface.co/runwayml/stable-diffusion-v1-5 models/checkpoints/stable-diffusion-v1-5

./models/vae

SDv1.5のものをしようしてもいいのですが、なんとなく。

wget https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors

./models/loras

AnimateDiff MotionDirectorで学習させた&ダウンロードしたLoRAを配置します。まずは、学習データのコピーです。

# spatial
cp -p /path/to/AnimateDiff-MotionDirector/outputs/2024-02-10/man_running_my_video-13-59-57/lora/spatial/*.safetensors \
    models/loras
# temporal
cp -p /path/to/AnimateDiff-MotionDirector/outputs/2024-02-10/man_running_my_video-13-59-57/lora/temporal/*.safetensors \
    models/loras

つづいて、realisticVisionV60B1_v51VAE.safetensorsも配置します。

wget https://civitai.com/api/download/models/130072 -P models/loras/ --content-disposition --no-check-certificate

これはAnimationDiff Motion Directorですと、./models/DreamBooth_LoRAに配置されていたファイルです。

./custom_nodes/ComfyUI-AnimateDiff-Evolved/models

これは必須。

cd ./custom_nodes/ComfyUI-AnimateDiff-Evolved/models
wget https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v14.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15_v2.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v3_sd15_mm.ckpt
cd ../../..

これはAnimationDiff Motion Directorですと、./models/Motion_Moduleに配置されていたファイルです。

./custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora

これは任意です。

cd ./custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_PanLeft.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_PanRight.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_RollingAnticlockwise.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_RollingClockwise.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_TiltDown.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_TiltUp.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_ZoomIn.ckpt
wget https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_ZoomOut.ckpt
cd ../../..

こちらで配置完了です。

3. 試してみる

作成したWorkflowはこちら。

見た目こんな感じ。電子回路みたいでかっこいいですね。

で、肝心の生成された動画はこちら。

a highly realistic video of batman running in a mystic forest, depth of field, epic lights, high quality, trending on artstation
a highly realistic video of batman running in a mystic forest, depth of field, epic lights, high quality, trending on artstation

この記事が気に入ったらサポートをしてみませんか?