[Error]2024/03/14起きているエラー対処法[Colab]

AI

こんにちは。古河 英愛です。

本日、Google Colaboratory上で起きているエラーについて。

まず、WebUI側のエラー

■WebUI側
NotimplementedError: No operator found for ‘memory_efficient_attention_forward’
~~

~~は結構長い文章だったので省略してます^^;

■ノートブック側のログ
WARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for:
PyTorch 2.1.0+cu121 with CUDA 1202 (you have 2.2.1+cu121)
Python 3.10.12 (you have 3.10.12)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won’t be available.
Set XFORMERS_MORE_DETAILS=1 for more details

WARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for:
PyTorch 2.1.0+cu121 with CUDA 1202 (you have 2.2.1+cu121)
Python 3.10.12 (you have 3.10.12)

上記に注目すると

PyTorch 2.1.0+cu121 with CUDA 1202 が必要なんだけど、あなたの環境は2.2.1+cu121
Python 3.10.12 (you have 3.10.12) であなたの環境は3.10.12→これは○

で、対処方法ですが、
Connect Google Driveの次に以下のコードを追加します。

#@markdown # Torch ReInstall

!pip install lmdb
!pip install torch==2.1.0+cu121 torchvision==0.16.0+cu121 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu121

これでtorchをインストールし直します。
これだけでも問題無いのですが、上手く実行できなかったら、ここでもエラーが発生しますので
URLが正しいかを確認しましょう。(ググって見つかったものを貼り付けたらURLエラーでしたw)

また、正常に動作した際にバージョンを確認したい方は
次にこのコードを実行してください。
(私は上記コードの次の行に追記しました。)

#@markdown # Torch Version Check
import torch

# PyTorchのバージョンを取得してprint出力する
print("torch Ver:"+torch.__version__)

以上で解決できました。

コメント

タイトルとURLをコピーしました