mirror of https://github.com/vladmandic/automatic
fixes as requested by review
parent
24f4490a59
commit
ee3b141297
|
|
@ -7,8 +7,10 @@ from typing import Dict, Optional
|
|||
import installer
|
||||
from modules.logger import log
|
||||
from modules.json_helpers import readfile, writefile
|
||||
from modules.shared import cmd_opts, opts
|
||||
|
||||
from modules.shared import cmd_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 import rocm_profiles # pylint: disable=no-name-in-module
|
||||
|
||||
|
|
@ -110,7 +112,7 @@ def _resolve_dtype() -> str:
|
|||
pass
|
||||
try:
|
||||
from modules import shared as _sh # pylint: disable=import-outside-toplevel
|
||||
v = getattr(getattr(_sh, 'opts', None), 'cuda_dtype', None)
|
||||
v = getattr(_sh.opts, 'cuda_dtype', None)
|
||||
if v in ('FP16', 'BF16', 'FP32'):
|
||||
return v
|
||||
except Exception:
|
||||
|
|
@ -460,7 +462,7 @@ def info() -> dict:
|
|||
if ufiles:
|
||||
udb["files"] = ufiles
|
||||
|
||||
# User cache (~/.miopen/cache/<version-hash>)
|
||||
# User cache (~/.miopen/cache/<version-hash>)
|
||||
cache_base = Path.home() / ".miopen" / "cache"
|
||||
db_hash = _extract_db_hash(user_db_path) if user_db_path.exists() else ""
|
||||
cache_path = cache_base / db_hash if db_hash else cache_base
|
||||
|
|
@ -481,10 +483,10 @@ def info() -> dict:
|
|||
|
||||
|
||||
# Apply saved config to os.environ at import time (only when ROCm is present)
|
||||
if is_rocm:
|
||||
if has_rocm() and getattr(cmd_opts, 'use_rocm', False) and sys.platform == 'win32':
|
||||
try:
|
||||
apply_env()
|
||||
except Exception as _e:
|
||||
print(f"[rocm_mgr] Warning: failed to apply env at import: {_e}", file=sys.stderr)
|
||||
else:
|
||||
log.debug('ROCm is not installed — skipping rocm_mgr env apply')
|
||||
log.debug('ROCm is not installed - skipping rocm_mgr env apply')
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@ from modules import scripts_manager, shared
|
|||
# rocm_mgr exposes package-internal helpers (prefixed _) that are intentionally called here
|
||||
# pylint: disable=protected-access
|
||||
|
||||
|
||||
class ROCmScript(scripts_manager.Script):
|
||||
def title(self):
|
||||
return "ROCm: Advanced Config"
|
||||
return "Windows ROCm: Advanced Config"
|
||||
|
||||
def show(self, _is_img2img):
|
||||
if shared.cmd_opts.use_rocm or installer.torch_info.get('type') == 'rocm':
|
||||
|
|
@ -75,9 +74,9 @@ class ROCmScript(scripts_manager.Script):
|
|||
rules.append(f"#rocm_var_{v.lower()} {{ opacity: 0.45; pointer-events: none; }}")
|
||||
return f"<style>{' '.join(rules)}</style>" if rules else ""
|
||||
|
||||
with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'):
|
||||
with gr.Accordion('Windows ROCm: Advanced Config', open=False, elem_id='rocm_config'):
|
||||
with gr.Row():
|
||||
gr.HTML("<p>Advanced configuration for ROCm users.</p><br><p>For best performance ensure that cudnn and torch tunable ops are set to default in Backend Settings.</p>")
|
||||
gr.HTML("<p><u>Advanced configuration for Windows ROCm users.</u></p><br><p>This script aims to take the guesswork out of configuring MIOpen and rocBLAS on Windows ROCm, but also to expose the functioning switches of MIOpen for advanced configurations.</p><br><p>For best performance ensure that cuDNN and PyTorch tunable ops are set to <b><i>default</i></b> in Backend Settings.</p>")
|
||||
with gr.Row():
|
||||
btn_info = gr.Button("Refresh Info", variant="primary", elem_id="rocm_btn_info", size="sm")
|
||||
btn_apply = gr.Button("Apply", variant="primary", elem_id="rocm_btn_apply", size="sm")
|
||||
|
|
@ -96,7 +95,7 @@ class ROCmScript(scripts_manager.Script):
|
|||
|
||||
# General vars (dropdowns, textboxes, checkboxes)
|
||||
with gr.Group():
|
||||
gr.HTML("<h3>MIOpen Settings</h3><hr>")
|
||||
gr.HTML("<br><h3>MIOpen Settings</h3><hr>")
|
||||
for name, meta in rocm_vars.GENERAL_VARS.items():
|
||||
comp = _make_component(name, meta, config)
|
||||
var_names.append(name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue