diff --git a/installer.py b/installer.py index 4d57520a7..4558af027 100644 --- a/installer.py +++ b/installer.py @@ -514,7 +514,7 @@ def install_rocm_zluda(): del args.device_id try: zluda_installer.load(zluda_path) - torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.3.0 torchvision --index-url https://download.pytorch.org/whl/cu118') + torch_command = os.environ.get('TORCH_COMMAND', f'torch=={zluda_installer.get_default_torch_version(hip_default_device)} torchvision --index-url https://download.pytorch.org/whl/cu118') log.info(f'Using ZLUDA in {zluda_path}') except Exception as e: error = e diff --git a/modules/zluda_installer.py b/modules/zluda_installer.py index cd8d5798c..f1cefbd8c 100644 --- a/modules/zluda_installer.py +++ b/modules/zluda_installer.py @@ -4,6 +4,7 @@ import ctypes import shutil import zipfile import urllib.request +from typing import Optional from modules import rocm @@ -71,3 +72,12 @@ def load(zluda_path: os.PathLike) -> None: return os.path.join(cpp_extension.ROCM_HOME, *paths) cpp_extension._join_rocm_home = _join_rocm_home # pylint: disable=protected-access rocm.conceal = conceal + + +def get_default_torch_version(agent: Optional[rocm.Agent]) -> str: + if agent is not None: + if agent.is_navi3x or agent.is_navi2x or agent.is_navi1x: + return "2.3.1" + elif agent.is_gcn: + return "2.2.1" + return "2.3.1"