From 30c8ebe6506e81aba556d1c2dab7bfd7a9af7b14 Mon Sep 17 00:00:00 2001 From: AI_Architect Date: Mon, 29 Jun 2026 03:46:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E5=9D=97=EF=BC=8C?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=BA0=E5=88=99=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodes_blockswap.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nodes_blockswap.py b/nodes_blockswap.py index 88dbf07..7dad77c 100644 --- a/nodes_blockswap.py +++ b/nodes_blockswap.py @@ -82,6 +82,11 @@ class XB_UNetBlockSwap: if is_dynamic_vram_active(): return (unet_model,) + # ── blocks_to_swap=0 等同于关闭,直接穿透 ── + if blocks_to_swap == 0: + print("\033[96m[XB UNet Block Swap]\033[0m: 分块数量为 0,节点穿透(无操作)") + return (unet_model,) + def swap_blocks(model_patcher: ModelPatcher, device_to, lowvram_model_memory, force_patch_weights, full_load): base_model = model_patcher.model # 🛡️ 动态获取 ComfyUI 分配的 GPU 设备,绝不写死 'cuda:0' @@ -159,6 +164,11 @@ class XB_CheckpointBlockSwap: if is_dynamic_vram_active(): return (checkpoint_model,) + # ── blocks_to_swap=0 等同于关闭,直接穿透 ── + if blocks_to_swap == 0: + print("\033[96m[XB Checkpoint Block Swap]\033[0m: 分块数量为 0,节点穿透(无操作)") + return (checkpoint_model,) + def swap_blocks(model_patcher: ModelPatcher, device_to, lowvram_model_memory, force_patch_weights, full_load): base_model = model_patcher.model # 🛡️ 动态获取 ComfyUI 分配的 GPU 设备