【ControlVideo】新しい動画生成モデルが公開されいたので試してみましたがVRAM不足で実行できませんでした。

注意

github.com
github.com
ControlVideoというGitHubリポジトリは二つ存在します。
全く別物のようです。
この記事は上のリポジトリについての記事になります。

下のリポジトリについての記事はこちらになります。

エラー内容

ValueError: fp16 mixed precision requires a GPU

どうしてGPUが認識されないのか数日悩みました。

結果的にはVRAM不足ということでした。

それならそういうエラー出力をしてくれれば良いのに。

数日を無駄にしてしまいました。

なぜGPUが認識されなかったのか

「mian.py」の2、3行目に答えがありました。

from util import available_devices, format_devices
device = available_devices(threshold=20000, n_devices=1)

この2行でVRAM 20GB以上のGPUを検索しています。

自分のGPUはVRAM 16GBなので「ない」ものとされていました。

threshold=16000に変更して実行すると上記エラーは回避できますが、よく見るOOM(out of memory)のエラーが出ました。

RuntimeError: CUDA out of memory. Tried to allocate 80.00 MiB (GPU 0; 16.00 GiB total capacity; 14.94 GiB already allocated; 0 bytes free; 15.18 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

結論

RTX 3090あるいはRTX 4090を買うしかないか。

環境構築

conda create -n controlvideo python=3.9
conda activate controlvideo
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
conda install xformers -c xformers/label/dev
pip install -U --pre triton
pip install accelerate==0.12.0 timm==0.4.9 absl-py ml_collections einops wandb ftfy==6.1.1 transformers==4.23.1 scipy
pip install diffusers==0.11.1
pip install imageio
pip install imageio-ffmpeg
pip install omegaconf
pip install opencv-python
pip install decord
pip install jsonlines
pip install matplotlib
pip install scikit-image
pip install basicsr

つづき

RTX 4090で動かした時の記録が以下です。
touch-sp.hatenablog.com




このエントリーをはてなブックマークに追加