xformers icon indicating copy to clipboard operation
xformers copied to clipboard

Compatibility With CUDA 12

Open MatCorr opened this issue 1 year ago • 9 comments

❓ Questions and Help

Is there a way to install Xformers with CUDA 12?

I'm trying to use Xformers on a Singularity image that employs, as a base, an image from the Nvidia PyTorch catalog, which are all optimized for the GPUs I'm using.

However, the more up-to-date versions of those PyTorch images all come with CUDA 12 installed. Because of that, when I install Xformers, PyTorch is rebuilt with CUDA version 11.7. This, in turn, causes an incompatibility between the versions of NVCC (which remains 12) and the CUDA of PyTorch (which reverts to 11.7), and I suspect some bugs I'm encountering when training models are related to this disparity.

MatCorr avatar Sep 01 '23 10:09 MatCorr

Hi, xFormers is compatible with CUDA 12, but you need to build it from source

danthe3rd avatar Sep 01 '23 12:09 danthe3rd

Oh, I was trying to build it from source with CUDA 12 yesterday and I was bumping into a bizarre obscure error. After a good-old Google search I was led to believe it just wasn't compatible with CUDA 12.

It only seems to appear when I use CUDA 12. With CUDA 11 I don't get this error. Does anyone know what it could be?

ERROR: Could not find a version that satisfies the requirement xformers (unavailable) (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.16rc424, 0.0.16rc425, 0.0.16, 0.0.17rc481, 0.0.17rc482, 0.0.17, 0.0.18, 0.0.19, 0.0.20, 0.0.21, 0.0.22.dev591, 0.0.22.dev594, 0.0.22.dev595, 0.0.22.dev596, 0.0.22.dev597, 0.0.22.dev598) ERROR: No matching distribution found for xformers (unavailable) WARNING: You are using pip version 21.2.4; however, version 23.2.1 is available. You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

MatCorr avatar Sep 01 '23 16:09 MatCorr

Hi, xFormers is compatible with CUDA 12, but you need to build it from source

is there any info out there on how someone might do this? both automatic1111 and sdnext have moved up to cuda 12.1, and although I'm told the performance of sdp is nearly the same as xformers, I would much rather prefer to see it myself.

zethfoxster avatar Sep 16 '23 22:09 zethfoxster

Hi, We have some instructions in the readme to build from source https://github.com/facebookresearch/xformers#installing-xformers

danthe3rd avatar Sep 17 '23 15:09 danthe3rd

Still no luck here.

Has anyone successfully built xformers from source using the Nvidia PyTorch image as a base?

For reference, this is the Dockerfile I'm using:

FROM nvcr.io/nvidia/pytorch:23.05-py3

RUN git config --global http.sslVerify false

RUN pip install ninja
RUN pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers

MatCorr avatar Sep 18 '23 10:09 MatCorr

What is the error you have? Have you tried setting MAX_JOBS=2 for instance?

danthe3rd avatar Sep 18 '23 10:09 danthe3rd

Setting MAX_JOBS didn't solve it.

This is the error.

ERROR: Could not find a version that satisfies the requirement xformers (unavailable) (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.16rc424, 0.0.16rc425, 0.0.16, 0.0.17rc481, 0.0.17rc482, 0.0.17, 0.0.18, 0.0.19, 0.0.20, 0.0.21, 0.0.22.dev591, 0.0.22.dev594, 0.0.22.dev595, 0.0.22.dev596, 0.0.22.dev597, 0.0.22.dev598) ERROR: No matching distribution found for xformers (unavailable) WARNING: You are using pip version 21.2.4; however, version 23.2.1 is available. You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

MatCorr avatar Sep 18 '23 11:09 MatCorr

Hi, We have some instructions in the readme to build from source https://github.com/facebookresearch/xformers#installing-xformers

i see "install from source", nothing on building it for 12.1 cuda

zethfoxster avatar Sep 22 '23 20:09 zethfoxster

just use https://github.com/facebookresearch/xformers/issues/960

soulteary avatar Jan 12 '24 09:01 soulteary

hey bro.i have the same issue,how you solved this problem?

JimWang151 avatar Jul 30 '24 22:07 JimWang151

xFormers now provides official builds for CUDA 12, hence this issue should no longer be relevant.

lw avatar Jul 31 '24 08:07 lw

xFormers now provides official builds for CUDA 12, hence this issue should no longer be relevant.

can tell me where to get the official builds?

Thanks.

JimWang151 avatar Jul 31 '24 12:07 JimWang151

Check out the README: https://github.com/facebookresearch/xformers#installing-xformers

lw avatar Aug 01 '24 12:08 lw