From 1080bd442a7509d29bfe0b29cac9222de406c994 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 28 Feb 2026 19:23:28 -0800 Subject: [PATCH] Disable dynamic vram on wsl. (#12706) --- comfy/model_management.py | 8 ++++++++ main.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index f73613f17..86f840ada 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -180,6 +180,14 @@ def is_ixuca(): return True return False +def is_wsl(): + version = platform.uname().release + if version.endswith("-Microsoft"): + return True + elif version.endswith("microsoft-standard-WSL2"): + return True + return False + def get_torch_device(): global directml_enabled global cpu_state diff --git a/main.py b/main.py index a0545d9b3..af701f8df 100644 --- a/main.py +++ b/main.py @@ -192,7 +192,7 @@ import hook_breaker_ac10a0 import comfy.memory_management import comfy.model_patcher -if enables_dynamic_vram() and comfy.model_management.is_nvidia(): +if enables_dynamic_vram() and comfy.model_management.is_nvidia() and not comfy.model_management.is_wsl(): if comfy.model_management.torch_version_numeric < (2, 8): logging.warning("Unsupported Pytorch detected. DynamicVRAM support requires Pytorch version 2.8 or later. Falling back to legacy ModelPatcher. VRAM estimates may be unreliable especially on Windows") elif comfy_aimdo.control.init_device(comfy.model_management.get_torch_device().index):