fix: hoist global declaration to top of _ensure_rocm_torch
Python requires the global statement to appear before any assignment to the variable within a function. Moving it to the function top fixes the SyntaxError on line 354.
This commit is contained in:
parent
9439657ee8
commit
4b2f7fb8e2
1 changed files with 1 additions and 2 deletions
|
|
@ -285,6 +285,7 @@ def _ensure_rocm_torch() -> None:
|
|||
already links against HIP.
|
||||
Uses pip_install() to respect uv, constraints, and --python targeting.
|
||||
"""
|
||||
global _rocm_windows_torch_installed
|
||||
if IS_MACOS:
|
||||
return
|
||||
|
||||
|
|
@ -317,7 +318,6 @@ def _ensure_rocm_torch() -> None:
|
|||
timeout = 30,
|
||||
)
|
||||
if probe.returncode == 0 and probe.stdout.decode().strip() == "yes":
|
||||
global _rocm_windows_torch_installed
|
||||
_rocm_windows_torch_installed = True
|
||||
return # already ROCm torch
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
|
|
@ -351,7 +351,6 @@ def _ensure_rocm_torch() -> None:
|
|||
*wheel_urls,
|
||||
constrain = False,
|
||||
)
|
||||
global _rocm_windows_torch_installed
|
||||
_rocm_windows_torch_installed = True
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue