Visit ComfyUI Online for ready-to-use ComfyUI environment
Enhances model processing efficiency by selectively swapping transformer blocks for optimized resource usage and improved performance.
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.
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.
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.
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.
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.
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.
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.
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.offload_img_emb
and offload_txt_emb
options to manage memory usage effectively, especially if you are working with limited GPU resources.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.