Nodes/ComfyUI-TaylorSeer/HidreamBlockSwap
ComfyUI Node

HidreamBlockSwap

The VRAM valve for HiDream's pricey Taylor cache

By philipy1219·Created about a year ago·Updated 7 months ago· 60
HidreamBlockSwap
    • block_swap_args
    double_block_swap0
    single_block_swap0

    HiDream-O1 doesn't make things easy. It's a big pixel-space DiT - no VAE dance, but a fat transformer that already eats VRAM, and when you add TaylorSeer's standard cache on top, the bill gets steep: 5–15GB extra for a 1024² at max_order 0–2. If you're running HiDream through TaylorSeer and the card is crying, HidreamBlockSwap is the trim: it offloads leading transformer blocks to the CPU so the cache fits where it used to.

    The deal is the same as FluxBlockSwap - you swap VRAM for wall-clock time. Offloaded blocks must shuffle between devices, so the 2x TaylorSeer speedup shrinks while blockswap is active. Think of it as the "make it fit, then accept a smaller win" button.

    How it works

    HiDream's backbone uses a two-stream layout: 16 double-stream blocks and 32 single-stream blocks. The node's two integers offload the first N of each:

    • double_block_swap (0–16) - leading double-stream blocks parked off-GPU
    • single_block_swap (0–32) - leading single-stream blocks parked off-GPU

    The freed amount prints to your console as total_offload_memory: xxx MB when the run starts, and blocks return to the GPU when sampling ends. Max values match the architecture exactly: 16 and 32 are the full block counts, so you can't overrun them.

    Like its Flux sibling, this node doesn't touch any blocks itself. It only emits block_swap_args, which you must wire into the optional block_swap_args input of TaylorSeer with model_type set to hidream (or TaylorSeerLite). Solo, it does nothing.

    What to set

    Given HiDream's cache is the priciest in the pack, don't be shy: a few swapped double-stream blocks can mean the difference between OOM and a finished image. Start around 4–6 double blocks, check the total_offload_memory line, and only add single-stream swaps if you're still short. If you find yourself near the 16/32 ceiling just to boot the model, switch to TaylorSeerLite - its cache costs "nearly zero" VRAM and sidesteps this whole negotiation.

    Install

    Same pack, no dependencies, no model downloads:

    cd ComfyUI/custom_nodes
    git clone https://github.com/philipy1219/ComfyUI-TaylorSeer
    

    Restart ComfyUI, or grab it through Manager by searching "ComfyUI-TaylorSeer". Keep ComfyUI newer than commit c496e53 - this pack patches model internals that shift between ComfyUI releases.

    Troubleshooting

    • Nothing offloads - the block_swap_args output isn't reaching a TaylorSeer node, or model_type isn't hidream. Both must be right.
    • OOM still - cut max_order to 0 before adding more swaps; order 0 saves the biggest chunk of cache memory.
    • Run got slow - you've over-swapped. Pull the numbers down until speed returns; the goal is the smallest offload that fits.
    CategoryTaylorSeer

    Inputs (2)

    NameTypeDefaultDescription
    double_block_swapINT00–16Double block swap.
    single_block_swapINT00–32Single block swap.

    Outputs (1)

    NameTypeDescription
    block_swap_argsBLOCKSWAPARGS