【驚異の10万字越え!】AI美女を作成するためのノウハウを大公開
AIツール

AnimateLCMを使ってAI美女の動画を生成する方法とは?

▶︎動画でも話してるので、文章読むのが面倒な方はこちらをみてもらえればと思います。

今回はAnimateLCMを使って動画を生成する方法について解説します。

AnimateLCMを使って動画を生成する方法について

AnimateLCMは、動画を早く綺麗に作るための技術で、従来のものより進化したモデルです。

この動画では、Google Colabを利用してAnimateLCMをComfyUIを使って動作させていきます。

Google Colabへのリンク及びComfyUIやGoogle Colabに関する解説記事のリンクを以下に貼っておきます。

Google Colabのサイトにアクセス

ここからの流れは下記に詳細リンクを貼っておきますので、そちらからご参照ください。

これで、Google Colabでコードを実行するための準備が整いました。

Google Colabでコードを実行

下記に貼ってあるテキストをコピーします。

!apt -y install -qq aria2
!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 -q xformers==0.0.20 triton==2.0.0 gradio_client==0.2.7 -U
!pip install torchsde controlnet-aux==0.0.7 onnxruntime-gpu insightface segment_anything watchdog omegaconf piexif

%cd /content
!git clone https://github.com/comfyanonymous/ComfyUI

%cd /content/ComfyUI
!pip install -r requirements.txt

# ComfyUI Managerのインストール
%cd /content/ComfyUI/custom_nodes
!git clone https://github.com/ltdrdata/ComfyUI-Manager.git
!git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite


# ---------------- AnimateDiff-Evolvedの設定開始 ---------------------
%cd /content/ComfyUI/custom_nodes
!git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved

# 備考: 今回のWorkflowで利用しないファイルをコメントアウト

# ComfyUI-AnimateDiff-Evolved/Checkpoint:($WORKSPACE/models/custom_nodes/ComfyUI-AnimateDiff-Evolved/models)
!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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -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/v3_sd15_mm.ckpt -d /content/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -o v3_sd15_mm.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/CiaraRowles/TemporalDiff/resolve/main/temporaldiff-v1-animatediff.ckpt -d /content/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -o temporaldiff-v1-animatediff.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/wangfuyun/AnimateLCM/resolve/main/sd15_t2v_beta.ckpt -d /content/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models -o sd15_t2v_beta.ckpt


# ComfyUI-AnimateDiff-Evolved/MotionLoRA:($WORKSPACE/models/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora)
!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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -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/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_lora -o v2_lora_ZoomOut.ckpt

# LoRA:($WORKSPACE/models/loras)
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/guoyww/animatediff/resolve/main/v3_sd15_adapter.ckpt -d /content/ComfyUI/models/loras -o v3_sd15_adapter.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/wangfuyun/AnimateLCM/resolve/main/sd15_lora_beta.safetensors -d /content/ComfyUI/models/loras -o sd15_lora_beta.safetensors

# ControlNet:($WORKSPACE/models/controlnet)
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/guoyww/animatediff/resolve/main/v3_sd15_sparsectrl_rgb.ckpt -d /content/ComfyUI/models/controlnet -o v3_sd15_sparsectrl_rgb.ckpt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/guoyww/animatediff/resolve/main/v3_sd15_sparsectrl_scribble.ckpt -d /content/ComfyUI/models/controlnet -o v3_sd15_sparsectrl_scribble.ckpt
# ---------------- AnimateDiff-Evolvedの設定終了 ---------------------


# Checkpointをダウンロード
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors -d /content/ComfyUI/models/checkpoints -o v1-5-pruned-emaonly.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/252914 -d /content/ComfyUI/models/checkpoints -o DreamShaper8LCM.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/128713 -d /content/ComfyUI/models/checkpoints -o DreamShaper8.safetensors

# VAEをダウンロード
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -d /content/ComfyUI/models/vae -o vae-ft-mse-840000-ema-pruned.safetensors

# Negative Promptをダウンロード
!git clone https://huggingface.co/embed/negative /content/ComfyUI/models/embeddings/negative
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/77169 -d /content/ComfyUI/models/embeddings -o BadDream.pt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/77173 -d /content/ComfyUI/models/embeddings -o UnrealisticDream.pt
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/25820 -d /content/ComfyUI/models/embeddings -o verybadimagenegative_v1.3.pt

# LoRAをダウンロード
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/wangfuyun/AnimateLCM/resolve/main/sd15_lora_beta.safetensors -o sd15_lora_beta.safetensors



# Upscalerをダウンロード
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/uwg/upscaler/resolve/main/ESRGAN/4x-UltraSharp.pth -d /content/ComfyUI/models/upscale_models -o 4x-UltraSharp.pth

!wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
!dpkg -i cloudflared-linux-amd64.deb

import subprocess
import threading
import time
import socket

def iframe_thread(port):
    while True:
        time.sleep(0.5)
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        result = sock.connect_ex(('127.0.0.1', port))
        if result == 0:
            break
        sock.close()

    print("\nComfyUI finished loading, trying to launch cloudflared (if it gets stuck here cloudflared is having issues)\n")
    p = subprocess.Popen(["cloudflared", "tunnel", "--url", f"http://127.0.0.1:{port}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    for line in p.stderr:
        l = line.decode()
        if "trycloudflare.com " in l:
            print("This is the URL to access ComfyUI:", l[l.find("http"):], end='')

%cd /content/ComfyUI

# スレッドの開始
threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()

# ComfyUIの実行
!python main.py --dont-print-server

 

テキストをコピーしたら、Google Colabの画面に戻り、テキストボックスに先ほどコピーしたテキストを貼り付け、再生ボタンを押します。

これで貼り付けたテキストの内容が実行されます。

この処理には5分以上かかると思います。

しばらく待っていると、このようなリンクが表示されます。

このリンクをクリックします。

そうすると、ComfyUIの画面が表示されます。

設定ファイルを読み込み

この解説では、あらかじめComfyUIの設定ファイルを用意していますので、そちらをご利用ください。

以下に貼ってあるページを表示します。

このページを表示したら、利用ファイルと書かれているタイトルの下にあるZIPファイルをクリックします。

そうするとZIPファイルがダウンロードされるので解凍します。

ダウンロードしたファイルを解凍したら、このようなファイルが表示されると思います。

この中にあるworkflow.JSONと書かれているファイルをComfyUIの画面にドラッグ&ドロップします。

ファイルは何も表示されていない場所にドラッグ&ドロップするようにしてください。

これでworkflow.JSONの設定ファイルが読み込まれます。

設定ファイルが読み込まれたら、早速動画を生成していきましょう

「Queue Prompt」と書かれているボタンをクリックします。

これで画像の生成処理が開始されます。

生成処理の状況はブロックの表示で確認できます。

緑色で囲まれているブロックが現在実行されている処理です。

処理が完了すると、囲んでいる緑色の表示が移動します。

生成される動画は、一番右側のブロックに表示されます。

画像の生成には数分程度かかります。

しばらく待っていると、このような画像が生成されました。

生成された動画を保存するには、動画の部分を右クリックします。

そして、表示されたメニューの中から「セーブプレビュー」を選択します。

これでパソコンに動画ファイルがダウンロードされます。

今回の解説は以上です。

是非お試しください。

【悪用厳禁】AIツールを使ってDeepFake(ディープフェイク)画像生成するノウハウを大公開!
【驚異の10万字越え!】AI美女を作成するためのノウハウを大公開