Repository navigation
Studio on Windows: recommend Repair when an existing home is older than the managed torch / xFormers #19870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Studio on Windows: recommend Repair when an existing home is older than the managed torch / xFormers #19870
Changes from 1 commit
c49e733
7ceae54
8e2ada6
fb89fd7
df67a70
1aceba7
03c5e73
5a046a6
c55eba0
24cbe58
339128d
84ee157
5e4e149
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…e managed torch install.ps1 installs torch 2.13 only through the cu130 index on x64 with the Python 3.13 venv. Off that route there is no recommendation; a driver that does not support CUDA 13 gets a driver-update-first hint instead, since Repair alone would keep the old torch. [skip ci]
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ | |
|
|
||
| from __future__ import annotations | ||
|
|
||
| import functools | ||
| import platform as _platform | ||
| import re | ||
| import sys | ||
| from typing import Callable, Optional | ||
|
|
@@ -19,6 +21,8 @@ | |
| # The first xFormers whose sm_120 build ships the backward kernels, paired with that torch. | ||
| WINDOWS_MANAGED_XFORMERS_FLOOR = (0, 0, 35) | ||
| _SM120 = 12 | ||
| # The managed torch comes from the cu130 index, which install.ps1 picks only for a driver supporting CUDA 13.0. | ||
| _MANAGED_ROUTE_DRIVER_CUDA = (13, 0) | ||
|
|
||
|
|
||
| def _dist_version(name: str) -> Optional[str]: | ||
|
|
@@ -42,13 +46,44 @@ def _capabilities() -> dict: | |
| return {} | ||
|
|
||
|
|
||
| @functools.lru_cache(maxsize = 1) | ||
| def _driver_cuda_version() -> Optional[tuple[int, int]]: | ||
| """The CUDA version the driver supports, from nvidia-smi's header as install.ps1 reads it; None when | ||
| unreadable. Cached: the driver does not change under a running server.""" | ||
| try: | ||
| from utils.hardware import gpu_query | ||
| from utils.hardware.nvidia import _nvidia_smi_executable | ||
|
|
||
| result = gpu_query.run_nvidia_smi( | ||
| [_nvidia_smi_executable()], | ||
| capture_output = True, | ||
| text = True, | ||
| encoding = "utf-8", | ||
| errors = "replace", | ||
| timeout = 5, | ||
| ) | ||
| match = re.search(r"CUDA Version:\s*(\d+)\.(\d+)", result.stdout or "") | ||
| return (int(match.group(1)), int(match.group(2))) if match else None | ||
| except Exception: # noqa: BLE001 -- unknown driver | ||
| return None | ||
|
|
||
|
|
||
| def _managed_route_host() -> bool: | ||
| """install.ps1's 2.13 route (Test-Cu130Torch213Platform): x64 Windows with the Python 3.13 venv.""" | ||
| return _platform.machine().lower() in ("amd64", "x86_64") and sys.version_info[:2] == (3, 13) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On an x64 Windows installation still using Python 3.11 or 3.12, with an RTX 50-series GPU and a CUDA 13-capable driver, this suppresses the recommendation even though Repair can install the managed pair. The desktop installer sets Useful? React with 👍 / 👎.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 8e2ada6: the route gate now uses the Python a Repair selects, |
||
|
|
||
|
|
||
| def windows_repair_recommendation( | ||
| platform: str = sys.platform, | ||
| dist_version: Callable[[str], Optional[str]] = _dist_version, | ||
| capabilities: Callable[[], dict] = _capabilities, | ||
| managed_route_host: Callable[[], bool] = _managed_route_host, | ||
| driver_cuda_version: Callable[[], Optional[tuple[int, int]]] = _driver_cuda_version, | ||
| ) -> Optional[dict]: | ||
| """``{"reason", "torch", "xformers", "managed_torch", "managed_xformers"}`` when this Windows CUDA install | ||
| has an sm_120+ card and a torch (or an installed xFormers) older than the managed pair; else None.""" | ||
| has an sm_120+ card and a torch (or an installed xFormers) older than the managed pair, and Repair can | ||
| reach that pair; else None. A driver too old for the cu130 route gets ``driver_older_than_managed`` | ||
| instead, since Repair alone would keep the old torch.""" | ||
| if platform != "win32": | ||
| return None | ||
| torch_version = dist_version("torch") | ||
|
|
@@ -66,6 +101,12 @@ def windows_repair_recommendation( | |
| reason = "xformers_older_than_managed" | ||
| else: | ||
| return None | ||
| # Only x64 with the Python 3.13 venv takes the managed torch; elsewhere Repair would not change it. | ||
| if not managed_route_host(): | ||
| return None | ||
| driver = driver_cuda_version() | ||
| if driver is not None and driver < _MANAGED_ROUTE_DRIVER_CUDA: | ||
| reason = "driver_older_than_managed" | ||
| return { | ||
| "reason": reason, | ||
| "torch": torch_version, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a Windows desktop installation with an outdated torch/xFormers pair and an RTX 50-series GPU, the first
/api/systemrequest reaches this probe. Unlikeget_compute_capabilities()inutils/hardware/nvidia.py, this invocation omitswindows_hidden_subprocess_kwargs(), andgpu_query.run_nvidia_smi()forwards the arguments directly tosubprocess.runwithout adding window-suppression flags. Because the desktop backend runs without a console, this creates a visible console window during an otherwise background status request. Pass the existing hidden-subprocess kwargs here as the other NVIDIA probes do.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in df67a70: the probe now passes
windows_hidden_subprocess_kwargs()andchild_env_without_native_path_secret(), asnvidia.py's queries do; the parsing test asserts the hidden-window flags reach the call.