Don't install xformers for AMD on Linux; changelog

This commit is contained in:
cmdr2
2023-04-20 16:48:38 +05:30
parent 534bb2dd84
commit 6c148f1791
3 changed files with 15 additions and 7 deletions

View File

@ -35,7 +35,7 @@ def version(module_name: str) -> str:
def install(module_name: str, module_version: str):
if module_name == "xformers" and os_name == "Darwin": # xformers is not available on mac
if module_name == "xformers" and (os_name == "Darwin" or is_amd_on_linux()):
return
index_url = None
@ -87,11 +87,8 @@ def apply_torch_install_overrides(module_version: str):
if os_name == "Windows":
module_version += "+cu117"
index_url = "https://download.pytorch.org/whl/cu117"
elif os_name == "Linux":
with open("/proc/bus/pci/devices", "r") as f:
device_info = f.read()
if "amdgpu" in device_info and "nvidia" not in device_info:
index_url = "https://download.pytorch.org/whl/rocm5.4.2"
elif is_amd_on_linux():
index_url = "https://download.pytorch.org/whl/rocm5.4.2"
return module_version, index_url
@ -107,6 +104,16 @@ def include_cuda_versions(module_versions: tuple) -> tuple:
return allowed_versions
def is_amd_on_linux():
if os_name == "Linux":
with open("/proc/bus/pci/devices", "r") as f:
device_info = f.read()
if "amdgpu" in device_info and "nvidia" not in device_info:
return True
return False
def fail(module_name):
print(
f"""Error installing {module_name}. Sorry about that, please try to: