2025-03-23 /
@syui
comfyui
comfyui + cosmosで動画生成
今回は、comfyui + cosmosで動画生成してみます。
生成する動画は、ollamaでpromptを書き、ue5で作ったゲームプレイ動画を参照してみても面白いかもしれないと思いました。
comfyuiのinstall
installはgit clone
から構築したほうがいいです。windowsで構築します。
https://github.com/comfyanonymous/comfyui
$ winget install nvidia.cuda
$ winget install python.python.3.12
$ git clone https://github.com/comfyanonymous/comfyui
$ cd comfyui
$ python -m venv venv
$ Set-ExecutionPolicy RemoteSigned -Scope Process
$ venv\Scripts\activate
$ pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
$ python -m pip install --upgrade pip
$ pip install -r requirements.txt
$ python main.py
http://localhost:8188
comfyuiはnodeで書きますがworkflow
と呼ぶようです。jsonで保存されます。簡単にimportできます。
https://comfyanonymous.github.io/ComfyUI_examples/
基本構造としては、以下のとおりです。
./comfyui
├── main.py
├── custom_nodes # ここにpluginを入れる
│ └── comfyui-manager
└── models
└── checkpoints # ここにmodelを入れる
└── model.safetensors
cosmosで動画生成
https://comfyanonymous.github.io/ComfyUI_examples/cosmos/
こちらを見て必要なものを必要な箇所に置きます。
[comfyui/models/text_encoders/]
oldt5_xxl_fp8_e4m3fn_scaled.safetensors
[comfyui/models/vae/]
cosmos_cv8x8x8_1.0.safetensors
[comfyui/models/diffusion_models/]
Cosmos-1_0-Diffusion-7B-Text2World.safetensors
Cosmos-1_0-Diffusion-7B-Video2World.safetensors
jsonをworkflowにimportします。
$ winget install curl.curl
$ curl -sLO https://comfyanonymous.github.io/ComfyUI_examples/cosmos/image_to_video_cosmos_7B.json

ollamaでpromptを書く
show text
のcustom nodeを使用するにはComfyUI-Custom-Scripts
が必要です。