bump xformers to 0.0.27 (#1740)

* Update requirements.txt

Preserve compatibility with torch 2.3.1. [Reference](https://github.com/facebookresearch/xformers/issues/1052)

* fix setup.py to extract the current xformers dep from requirements for replacement

* xformers 0.0.27 wheels not built for torch 2.3.0

---------

Co-authored-by: Wing Lian <wing.lian@gmail.com>
This commit is contained in:
Akshaya Shanbhogue
2024-07-13 11:04:31 -07:00
committed by GitHub
parent 1e57b4c562
commit 4512738a73
2 changed files with 8 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ flash-attn==2.5.8
sentencepiece sentencepiece
wandb wandb
einops einops
xformers==0.0.26.post1 xformers==0.0.27
optimum==1.16.2 optimum==1.16.2
hf_transfer hf_transfer
colorama colorama

View File

@@ -29,9 +29,10 @@ def parse_requirements():
_install_requires.append(line) _install_requires.append(line)
try: try:
xformers_version = [req for req in _install_requires if "xformers" in req][0]
if "Darwin" in platform.system(): if "Darwin" in platform.system():
# don't install xformers on MacOS # don't install xformers on MacOS
_install_requires.pop(_install_requires.index("xformers==0.0.26.post1")) _install_requires.pop(_install_requires.index(xformers_version))
else: else:
# detect the version of torch already installed # detect the version of torch already installed
# and set it so dependencies don't clobber the torch version # and set it so dependencies don't clobber the torch version
@@ -49,12 +50,14 @@ def parse_requirements():
raise ValueError("Invalid version format") raise ValueError("Invalid version format")
if (major, minor) >= (2, 3): if (major, minor) >= (2, 3):
pass if patch == 0:
_install_requires.pop(_install_requires.index(xformers_version))
_install_requires.append("xformers>=0.0.26.post1")
elif (major, minor) >= (2, 2): elif (major, minor) >= (2, 2):
_install_requires.pop(_install_requires.index("xformers==0.0.26.post1")) _install_requires.pop(_install_requires.index(xformers_version))
_install_requires.append("xformers>=0.0.25.post1") _install_requires.append("xformers>=0.0.25.post1")
else: else:
_install_requires.pop(_install_requires.index("xformers==0.0.26.post1")) _install_requires.pop(_install_requires.index(xformers_version))
_install_requires.append("xformers>=0.0.23.post1") _install_requires.append("xformers>=0.0.23.post1")
except PackageNotFoundError: except PackageNotFoundError: