インストールコマンド
!apt-get -qq install aria2
import os, shutil, gc, time
%cd /content
!git clone <https://github.com/s9roll7/animatediff-cli-prompt-travel>
%cd animatediff-cli-prompt-travel
!pip install -q torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2+cu118 torchtext==0.15.2 torchdata==0.6.1 --extra-index-url <https://download.pytorch.org/whl/cu118> -U
!pip install einops omegaconf safetensors diffusers[torch]==0.11.1 transformers xformers==0.0.20 triton==2.0.0
!pip install .[stylize,dwpose,stylize_mask]
!pip install mediapipe
!pip install onnxruntime-gpu pandas
# MotionModuleのダウンロード
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v14.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o mm_sd_v14.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o mm_sd_v15.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15_v2.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o mm_sd_v15_v2.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/mm_sdxl_v10_beta.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o mm_sdxl_v10_beta.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_PanLeft.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_PanLeft.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_PanRight.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_PanRight.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_RollingAnticlockwise.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_RollingAnticlockwise.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_RollingClockwise.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_RollingClockwise.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_TiltDown.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_TiltDown.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_TiltUp.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_TiltUp.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_ZoomIn.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_ZoomIn.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://huggingface.co/guoyww/animatediff/resolve/main/v2_lora_ZoomOut.ckpt> -d /content/animatediff-cli-prompt-travel/data/models/motion-module -o v2_lora_ZoomOut.ckpt
# Checkpointファイルをダウンロード
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M <https://civitai.com/api/download/models/102222> -d /content/animatediff-cli-prompt-travel/data/models/sd -o xxmix9realistic_v40.safetensors
# animatediffコマンドで、"openai/clip-vit-large-patch14"が上手くセットアップしれないことがあったので、
# 以下のコードを追加
# ↓↓↓ ここまで ↓↓↓
from PIL import Image
import requests
from transformers import CLIPProcessor, CLIPModel
model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
# ↑↑↑ ここまで ↑↑↑
設定ファイル
sample001.zip
実行コマンド
!animatediff generate -c config/prompts/sample001.json -W 256 -H 384 -L 256 -C 16