ColabでStable Diffusion Videosを動かすv3

ただでさえGoogle Driveは同期が遅い上に,macOSでfileproviderを使って同期させるようになってからというもの,Google Driveを使っていると頻繁にfileproviderdが落ちるようになった.ColabとStable Diffusion Videosで動画生成を行う場合,バックグラウンドで走らせっぱなしにすることにメリットがあるのに,画像を1枚生成するたびにGoogle Driveに吐かれてローカルに流し込まれるのではSSDが消耗するだけなので,動画生成が完全に終わってから動画ファイルのみをDriveに移行するコードを書いた.将来的にはファイル名とプロンプトの組み合わせを保管するGoogle Spreadsheetとの連携なんかも実装するつもりでいる.

Since Google Drive is very slow compared to Dropbox and other services, it is inefficient to synchronize with it to add files locally every time a large number of images are generated on Google Colaboratory (Colab). Thus, this script describes the codes that only video files are moved to Google Drive after the whole video generation process is completed. In the future, we intend to add a feature that automatically saves the combination of a prompt and a filename in conjunction with Google Spreadsheet.

ちなみにここでは最近個人的に面白いと思っているモデルNeverEnding-Dream(https://huggingface.co/Lykon/NeverEnding-Dream)を使っている.

ちなみに,Gistにアップロードした.ipynbファイルをOpen In Colabするためには,
元ファイルのURLをベースに
https://colab.research.google.com/gist/username/hash/filenameといじればいいので,

GistのURL:https://gist.github.com/jniimi/25a1c9b40772ba170a219299dcc5586e
ファイル名:stable-diffusion-videos-on-colab.ipynb
であれば,jniimiとハッシュとファイル名を使って
https://colab.research.google.com/gist/jniimi/25a1c9b40772ba170a219299dcc5586e/stable-diffusion-videos-on-colab.ipynb
となる.