facebookresearch / xformers

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

xformers `Version: 0.0.26.post1` is clashing with torch 2.3.1 #1052

Open MoezGholami opened 1 month ago

MoezGholami commented 1 month ago

🐛 Bug

installing xformers pip install xformers (which at the moment points to 0.0.26.post1 uninstalls torch and triton 2.3.1 and replaces it with 2.3.0. This is causing conflict with the packages that do require 2.3.1 such as "torchvision 0.18.1+cu121" and "torchaudio 2.3.1+cu121".

Command

To Reproduce

$ pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
[skipped output]
$ pip install xformers==0.0.26.post1 # (currently equivalent to pip install xformers)
[...]
Collecting xformers
  Using cached xformers-0.0.26.post1-cp310-cp310-manylinux2014_x86_64.whl (222.7 MB)
Collecting torch==2.3.0
  Using cached torch-2.3.0-cp310-cp310-manylinux1_x86_64.whl (779.1 MB)
[...]
  Attempting uninstall: triton
    Found existing installation: triton 2.3.1
    Uninstalling triton-2.3.1:
      Successfully uninstalled triton-2.3.1
      [...]
  Attempting uninstall: torch
    Found existing installation: torch 2.3.1+cu121
    Uninstalling torch-2.3.1+cu121:
[...]
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.
torchvision 0.18.1+cu121 requires torch==2.3.1, but you have torch 2.3.0 which is incompatible.
torchaudio 2.3.1+cu121 requires torch==2.3.1, but you have torch 2.3.0 which is incompatible.

Expected behavior

xformers working with latest version of torch.

ashleykleynhans commented 1 month ago

I also need xformers to be compatible with torch 2.3.1 but I would say that this is a feature request rather than a bug.

comaniac commented 1 month ago

Second on this issue.

dmaljovec commented 2 weeks ago

This is not as simple as changing this line to:

            for torch_version in ['2.3.0', '2.3.1']:

Is it? If I understand the tests correctly, my guess is this is already tested with a later version given the use of the nightly channel from Pytorch used here.

dmaljovec commented 2 weeks ago

FWIW, I am experimenting with using the "install from source" directions and it is at least able to resolve an environment. I have yet to test that everything works together, but I am at least able to generate a lockfile with uv combining xformers@git+https://github.com/facebookresearch/xformers.git@main#egg=xformers and torch>=2.3.1.

comtest99 commented 1 week ago

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. xformers 0.0.26.post1 requires torch==2.3.0, but you have torch 2.3.1+cu121 which is incompatible.

danthe3rd commented 1 week ago

Hi, We don't have a release for 2.3.1, we will make a release for 2.3.2 tho or 2.4.0. In the meantime, you can either downgrade pytorch, or install xFormers from source (long).

youkaichao commented 6 days ago

From what I heard from @albanD , they will not release 2.3.2 . Does this mean we need to wait for 2.4.0?

danthe3rd commented 5 days ago

Good point - in that case we will try to add a release for 2.3.1 then

chi0tzp commented 4 days ago

Good point - in that case we will try to add a release for 2.3.1 then

Thanks @danthe3rd, much appreciated! Any ETA for the 2.3.1 build? Cheers!

danthe3rd commented 2 days ago

We'll try to get dev wheels/conda packages early next week, and hopefully soon after that some stables for 2.3.1

chi0tzp commented 2 days ago

Cheers @danthe3rd!