ComfyUI > Nodes > ComfyUI-wanBlockswap > WanVideoBlockSwap

ComfyUI Node: WanVideoBlockSwap

Class Name

wanBlockSwap

Category
ComfyUI-wanBlockswap
Author
orssorbit (Account age: 3351days)
Extension
ComfyUI-wanBlockswap
Latest Updated
2025-03-19
Github Stars
0.04K

How to Install ComfyUI-wanBlockswap

Install this extension via the ComfyUI Manager by searching for ComfyUI-wanBlockswap
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-wanBlockswap 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

WanVideoBlockSwap Description

Enhances model processing efficiency by selectively swapping transformer blocks for optimized resource usage and improved performance.

WanVideoBlockSwap:

The wanBlockSwap node is designed to enhance the flexibility and efficiency of model processing by allowing selective swapping of transformer blocks within a model. This node is particularly useful in scenarios where memory management and processing speed are critical, such as in video processing tasks. By enabling the offloading of specific blocks to different devices, it optimizes resource usage and can significantly improve performance. The node is part of the ComfyUI-wanBlockswap suite, which is tailored for handling large models with numerous transformer blocks, such as the 14B and 1.3B models. Its primary function is to manage the distribution of computational tasks across available hardware, ensuring that the most demanding operations are handled by the most capable devices, thereby reducing bottlenecks and enhancing overall throughput.

WanVideoBlockSwap Input Parameters:

model

This parameter represents the model to be processed. It is the core component that the node will operate on, and its structure and complexity will directly influence the node's behavior and performance.

blocks_to_swap

This integer parameter determines the number of transformer blocks to be swapped. It ranges from 0 to 40, with a default value of 20. The choice of this value impacts how many blocks are offloaded to a different device, which can affect both memory usage and processing speed. For instance, the 14B model has 40 blocks, while the 1.3B model has 30 blocks, so this parameter should be set accordingly to optimize performance.

offload_img_emb

A boolean parameter that, when set to true, offloads the image embedding to a specified offload device. This can help manage memory usage by distributing the load across devices, which is particularly beneficial when dealing with large models or limited GPU memory.

offload_txt_emb

Similar to offload_img_emb, this boolean parameter controls whether the text embedding is offloaded to an offload device. Enabling this option can free up resources on the main device, allowing for more efficient processing of other tasks.

use_non_blocking

This boolean parameter determines whether non-blocking memory transfer is used during offloading. When enabled, it can speed up the offloading process by allowing memory transfers to occur asynchronously, though it may require more RAM. This option is useful for users who need to maximize processing speed and have sufficient memory resources.

WanVideoBlockSwap Output Parameters:

model

The output is the modified model after the block swap operation. This model has been adjusted according to the specified parameters, with certain blocks potentially offloaded to different devices. The output model is optimized for the available hardware configuration, potentially offering improved performance and efficiency in subsequent processing tasks.

WanVideoBlockSwap Usage Tips:

  • Adjust the blocks_to_swap parameter based on the model size you are working with. For larger models like the 14B, consider swapping more blocks to balance the load across devices.
  • Use the offload_img_emb and offload_txt_emb options to manage memory usage effectively, especially if you are working with limited GPU resources.

WanVideoBlockSwap Common Errors and Solutions:

"CUDA out of memory"

  • Explanation: This error occurs when the GPU does not have enough memory to handle the current load.
  • Solution: Try reducing the number of blocks to swap or enable offloading for image and text embeddings to free up GPU memory.

"Invalid device ordinal"

  • Explanation: This error indicates that the specified device for offloading is not available or incorrectly configured.
  • Solution: Ensure that the offload device is correctly specified and available. Check your system's device configuration and adjust the settings accordingly.

WanVideoBlockSwap Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-wanBlockswap
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 Playground, enabling artists to harness the latest AI tools to create incredible art.