Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions for installing xFormers on linux #2360

Merged
merged 5 commits into from
Jan 20, 2023

Conversation

lstein
Copy link
Collaborator

@lstein lstein commented Jan 18, 2023

I've written up the install procedure for xFormers on Linux systems.

I need help with the Windows install; I don't know what the build dependencies (compiler, etc) are. This section of the docs is currently empty.

Please see docs/installation/070_INSTALL_XFORMERS.md

@snake-4
Copy link

snake-4 commented Jan 18, 2023

xFormers has precompiled wheels available for Windows/Linux that work with PyTorch 1.13.1 which can be installed with this command: pip install xformers==0.0.16rc425
Wouldn't it be easier for users to simply install this package as opposed to building it themselves?
I've tested the version I've mentioned above and it works fine with diffusers 0.11.1 and with this repo.

@hipsterusername
Copy link
Member

xFormers has precompiled wheels available for Windows/Linux that work with PyTorch 1.13.1 which can be installed with this command: pip install xformers==0.0.16rc425
Wouldn't it be easier for users to simply install this package as opposed to building it themselves?
I've tested the version I've mentioned above and it works fine with diffusers 0.11.1 and with this repo.

This certainly would - thanks for sharing! I’ll give it a test on 2.3 tonight and see if it “just works” ™️

@mickr777
Copy link
Contributor

mickr777 commented Jan 19, 2023

xFormers has precompiled wheels available for Windows/Linux that work with PyTorch 1.13.1 which can be installed with this command: pip install xformers==0.0.16rc425
Wouldn't it be easier for users to simply install this package as opposed to building it themselves?
I've tested the version I've mentioned above and it works fine with diffusers 0.11.1 and with this repo.

I can confirm on installing on ubuntu 22.04 with main branch:
pip install xformers==0.0.16rc425
pip install triton

python -m xformers.inf output

memory_efficient_attention.cutlassB:               available
memory_efficient_attention.flshattF:               available
memory_efficient_attention.flshattB:               available
memory_efficient_attention.smallkF:                available
memory_efficient_attention.smallkB:                available
memory_efficient_attention.tritonflashattF:        available
memory_efficient_attention.tritonflashattB:        available
swiglu.fused.p.cpp:                                available
is_triton_available:                               True
is_functorch_available:                            False
pytorch.version:                                   1.13.1+cu116
pytorch.cuda:                                      available
gpu.compute_capability:                            8.6
gpu.name:                                          NVIDIA GeForce RTX 3060
build.info:                                        available
build.cuda_version:                                1107
build.python_version:                              3.10.9
build.torch_version:                               1.13.1+cu117
build.env.TORCH_CUDA_ARCH_LIST:                    5.0+PTX 6.0 6.1 7.0 7.5 8.0 8.6
build.env.XFORMERS_BUILD_TYPE:                     Release
build.env.XFORMERS_ENABLE_DEBUG_ASSERTIONS:        None
build.env.NVCC_FLAGS:                              None
build.env.XFORMERS_PACKAGE_FROM:                   wheel-v0.0.16rc425
source.privacy:                                    open source

side note: also makes SD 2.1 float16 no longer output black screen

Copy link
Member

@ebr ebr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed working on Ubuntu 22.04 with pip install, but keeping the instructions would also be valuable.

@hipsterusername
Copy link
Member

Blessed highlighted that my ability to use the pip install was only because I have WSL - It won't work by default on Windows. I'll need to investigate manual build options further

@lstein
Copy link
Collaborator Author

lstein commented Jan 20, 2023

I'm light of the very welcome news that you can easily pip install on Linux, I'm going to rewrite the doc a bit. So there's no wheel install for Windows?

@snake-4
Copy link

snake-4 commented Jan 20, 2023

There is a Windows wheel, I'm using it at this very moment. It is also listed here: https://pypi.org/project/xformers/0.0.16rc425/#files

@lstein
Copy link
Collaborator Author

lstein commented Jan 20, 2023 via email

@snake-4
Copy link

snake-4 commented Jan 20, 2023

Do you have any tips or tricks for using the Windows wheel or was it a smooth experience?

The only requirement is that the VC++ 2015-2022 redistributable must be installed, as it's compiled with Visual C++ 2019
This shouldn't be a problem as torch requires the same redist too.

@lstein
Copy link
Collaborator Author

lstein commented Jan 20, 2023

pip install xformers==0.0.16rc425 pip install triton

python -m xformers.inf output

I've added the pip install instructions. Thanks very much for this! I wish I'd known that there were pip wheels available, cause that would have saved me a lot of hair-tearing a few days ago.

@lstein lstein enabled auto-merge January 20, 2023 22:29
@lstein lstein merged commit f00f709 into main Jan 20, 2023
@lstein lstein deleted the lstein/xformers-instructions branch January 20, 2023 22:57
@AbdBarho
Copy link
Contributor

AbdBarho commented Jan 22, 2023

I just wanted to comment that pinning xformers==0.0.16rc425 is not a viable solution because rc versions WILL be deleted from pypi when the storage starts to get full.
(which is often if every wheel is 50MB and you build 20 different version).

Installing the latest available rc version can be done by

pip install -U --pre xformers

This will make sure the installation does not break, as long as 0.0.16 is not officially released yet, then we can pin to 0.0.16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants