facebookresearch / xformers

Hackable and optimized Transformers building blocks, supporting a composable construction.
https://facebookresearch.github.io/xformers/
Other
8.66k stars 614 forks source link

xFormes没有加载CUDA,无法使用CUDA #899

Open xiahongyu939 opened 1 year ago

xiahongyu939 commented 1 year ago

在运行CUDA时报告: WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.1.0+cu118 with CUDA 1106 (you have 2.0.1+cu118) Python 3.9.16 (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 请尽快解决问题

JanineCHEN commented 1 year ago

I'm also having similar errors:

WARNING:xformers:WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
    PyTorch 2.1.0+cu121 with CUDA 1201 (you have 2.1.0+cu118)
    Python  3.10.13 (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
danthe3rd commented 1 year ago

Hey

@xiahongyu939 how did you install xformers and pytorch? There is something wrong in your setup... @JanineCHEN Can you try with xformers with cuda 12.1? pip install -U --pre xformers

JanineCHEN commented 1 year ago

Hey

@xiahongyu939 how did you install xformers and pytorch? There is something wrong in your setup... @JanineCHEN Can you try with xformers with cuda 12.1? pip install -U --pre xformers

Hi @danthe3rd , thank you for the prompt reply, I'm using colab, adding these two lines at the beginning works for me:

!pip uninstall torch torchvision torchaudio -y
!pip install torch torchvision torchaudio

Now the default pytorch version in colab is 2.1.0+cu118, upgrading it to 2.1.0+cu121 solves the problem for me.

danthe3rd commented 1 year ago

Actually you should be able to install the cu118 version directly with:

pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu118
hcorn82 commented 11 months ago

Actually you should be able to install the cu118 version directly with:

I was having this problem but now I get:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.0.2+cu118 requires torch==2.0.1, but you have torch 2.1.0+cu118 which is incompatible.
torchvision 0.15.2+cu118 requires torch==2.0.1, but you have torch 2.1.0+cu118 which is incompatible.`