edited if installer.torch_info line 470

pull/4726/head
resonantsky 2026-04-03 11:58:43 +02:00
parent 2177609e54
commit ac9aacac66
1 changed files with 9 additions and 20 deletions

View File

@ -7,24 +7,12 @@ from typing import Dict, Optional
import installer import installer
from modules.logger import log from modules.logger import log
from modules.json_helpers import readfile, writefile from modules.json_helpers import readfile, writefile
from modules.shared import cmd_opts, opts from modules.shared import opts
from modules.devices import has_rocm
from scripts.rocm.rocm_vars import ROCM_ENV_VARS # pylint: disable=no-name-in-module from scripts.rocm.rocm_vars import ROCM_ENV_VARS # pylint: disable=no-name-in-module
from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module
def _check_rocm() -> bool:
if getattr(cmd_opts, 'use_rocm', False):
return True
if installer.torch_info.get('type') == 'rocm':
return True
return has_rocm()
is_rocm = _check_rocm()
CONFIG = Path(os.path.abspath(os.path.join('data', 'rocm.json'))) CONFIG = Path(os.path.abspath(os.path.join('data', 'rocm.json')))
_cache: Optional[Dict[str, str]] = None # loaded once, invalidated on save _cache: Optional[Dict[str, str]] = None # loaded once, invalidated on save
@ -479,10 +467,11 @@ def info() -> dict:
# Apply saved config to os.environ at import time (only when ROCm is present) # Apply saved config to os.environ at import time (only when ROCm is present)
if is_rocm and sys.platform == 'win32': if installer.torch_info.get('type', None) == 'rocm':
try: if sys.platform == 'win32':
apply_env() try:
except Exception as _e: apply_env()
print(f"[rocm_mgr] Warning: failed to apply env at import: {_e}", file=sys.stderr) except Exception as _e:
else: log.debug(f"[rocm_mgr] Warning: failed to apply env at import: {_e}")
log.debug('ROCm is not installed - skipping rocm_mgr env apply') else:
log.debug('Skipping ROCm Environment Manager: Currently only Windows is supported.')