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 设备