fix: suppress remaining console popups on Windows, patch torch.distributed.is_initialized for ROCm #5301
This commit is contained in:
parent
ba6b279e61
commit
1707169680
2 changed files with 13 additions and 0 deletions
|
|
@ -1084,6 +1084,17 @@ def run_training_process(
|
|||
'Install for better performance: pip install "triton-windows<3.7"'
|
||||
)
|
||||
|
||||
# ── 1d. Ensure torch.distributed.is_initialized exists before ML libs load ──
|
||||
# The ROCm Windows wheel (2.9.0+rocmsdk*) does not expose is_initialized on
|
||||
# the torch.distributed module object until it is explicitly imported.
|
||||
# transformers and trl access it before that happens, causing AttributeError.
|
||||
try:
|
||||
import torch.distributed as _td # noqa: F401 -- forces full module load
|
||||
if not hasattr(_td, "is_initialized"):
|
||||
_td.is_initialized = lambda: False
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ── 2. Now import ML libraries (fresh in this clean process) ──
|
||||
try:
|
||||
_send_status(event_queue, "Importing Unsloth...")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import urllib.request
|
|||
from typing import Callable
|
||||
|
||||
from utils.native_path_leases import child_env_without_native_path_secret
|
||||
from utils.subprocess_compat import windows_hidden_subprocess_kwargs
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -62,6 +63,7 @@ def probe_torch_wheel_env(*, timeout: int | None = None) -> dict[str, str] | Non
|
|||
text = True,
|
||||
timeout = timeout,
|
||||
env = child_env_without_native_path_secret(),
|
||||
**windows_hidden_subprocess_kwargs(),
|
||||
)
|
||||
except subprocess.TimeoutExpired:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue