facebookresearch / xformers

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

xformers support nightly torch #773

Open lucasjinreal opened 1 year ago

lucasjinreal commented 1 year ago

currently will forcely uninstall users nightly torch version

danthe3rd commented 1 year ago

Hi, To use pytorch nightly, you will need to first install pytorch, and then build xformers from source

lucasjinreal commented 1 year ago

@danthe3rd I installed nightly and installed xformers from source, but there are some im,port errrors. Might need further investigate.

danthe3rd commented 1 year ago

Please report the errors so we can look into that. You might also want to copy-paste the output of "python -m xformers.info"

sa-shiro commented 1 year ago

You still have issues with this? I managed to sucessfully install xformers with pytorch 2.1 cuda 12.1 you first have to install pytorch nightly

first of all, on windows, fix long paths error by opening a admin cmd and pasting the following:

git config --system core.longpaths true

then:

pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121

after that you can install xformers from source:

# (Optional) Makes the build much faster
pip install ninja
# Set TORCH_CUDA_ARCH_LIST if running and building on different GPU types
pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers
# (this can take dozens of minutes)

result:

python -m xformers.info

# xFormers 0.0.21+ba5b449.d20230817
# build.cuda_version:                               1202
# build.torch_version:                               2.1.0.dev20230816+cu121
# pytorch.version:                                     2.1.0.dev20230816+cu121
copi143 commented 1 year ago

I attempted to run the command:

pip install -v -U git+https://github.com/facebookresearch/xformers.git@main

It consumed all of my memory and caused my desktop environment to crash. Therefore, I would appreciate it if you could provide a binary version suitable for PyTorch nightly builds. Thank you.

danthe3rd commented 1 year ago

Hi, you have to set MAX_JOBS=2 for example to limit parallelism and use less memory

copi143 commented 1 year ago

Hi, you have to set MAX_JOBS=2 for example to limit parallelism and use less memory

I successfully installed xformers from the source code using the method you recommended. Thank you.