Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > XB_ToolBox > XB-BOX - UNet Block Swap

ComfyUI Node: XB-BOX - UNet Block Swap

Class Name

XB_UNetBlockSwap

Category
XB_ToolBox/VRAM_Hacks
Author
WJLUOXIAO (Account age: 324days)
Extension
XB_ToolBox
Latest Updated
2026-05-19
Github Stars
0.04K

How to Install XB_ToolBox

Install this extension via the ComfyUI Manager by searching for XB_ToolBox
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter XB_ToolBox in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

XB-BOX - UNet Block Swap Description

Optimizes UNet model memory usage by dynamically swapping core blocks between GPU and system RAM for efficient VRAM management.

XB-BOX - UNet Block Swap:

The XB_UNetBlockSwap node is designed to optimize the memory usage of UNet models by dynamically swapping core blocks between the GPU and system RAM. This functionality is particularly beneficial for users working with limited VRAM resources, as it allows for more efficient memory management during model execution. By offloading certain blocks to system RAM, the node helps in reducing VRAM consumption, which can be crucial for running complex models on hardware with constrained resources. The node achieves this by identifying and managing the transfer of specific blocks within the UNet architecture, ensuring that the model can still perform effectively while minimizing memory usage. This approach not only aids in handling larger models but also enhances the overall performance of the model by preventing VRAM overflow, thus making it an essential tool for AI artists looking to optimize their workflows.

XB-BOX - UNet Block Swap Input Parameters:

unet_model

This parameter accepts a pure UNet or DiT model input. It is crucial as it specifies the model that will undergo block swapping to optimize VRAM usage. The node checks if the input model is compatible and ready for the block swap process, ensuring that only suitable models are processed.

blocks_to_swap

This integer parameter determines the number of core blocks within the UNet model that will be offloaded to system RAM. The default value is 10, with a minimum of 0 and a maximum of 200. Adjusting this parameter allows you to control the balance between VRAM usage and processing speed. Higher values result in more blocks being offloaded, which saves VRAM but may slow down the model's execution due to increased data transfer between RAM and VRAM.

XB-BOX - UNet Block Swap Output Parameters:

unet_model

The output parameter is the modified UNet model after the block swap process. This model has certain blocks offloaded to system RAM, which helps in reducing VRAM usage. The output model retains its functionality while being optimized for systems with limited VRAM, allowing for continued use in generating AI art without compromising on performance.

XB-BOX - UNet Block Swap Usage Tips:

  • To optimize VRAM usage without significantly impacting performance, start with the default blocks_to_swap value and gradually increase it if you encounter VRAM limitations.
  • Monitor the performance of your model after adjusting the blocks_to_swap parameter to find the optimal balance between speed and memory usage for your specific hardware setup.

XB-BOX - UNet Block Swap Common Errors and Solutions:

"Detected parameter [--enable-dynamic-vram], block swap node auto-sleeping."

  • Explanation: This message indicates that the dynamic VRAM management feature is enabled, which conflicts with the block swap functionality.
  • Solution: Disable the --enable-dynamic-vram parameter to allow the block swap node to function correctly.

"Model input is not a valid UNet/DiT model."

  • Explanation: The input provided to the node is not recognized as a compatible UNet or DiT model.
  • Solution: Ensure that the input model is a pure UNet or DiT model before using it with the XB_UNetBlockSwap node.

XB-BOX - UNet Block Swap Related Nodes

Go back to the extension to check out more related nodes.
XB_ToolBox
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

XB-BOX - UNet Block Swap