Nodes/ComfyUI CogVideoX Wrapper/CogVideo TransformerEdit
ComfyUI Node Runs on cloud

CogVideo TransformerEdit

Experimentally pruning CogVideoX blocks

By kijai·Created 2 years ago·Updated 12 months ago· 1,549
CogVideo TransformerEdit
    • block_list
    remove_blocks15, 25, 37

    This one's for tinkerers, and it says so on the tin - its own description leads with "EXPERIMENTAL." What it does is remove specific transformer blocks from the model. CogVideoX is a stack of many transformer layers; this node lets you yank named ones out before the model runs, producing a lighter, faster, and - fair warning - potentially worse model. It's a research/optimization toy, not something a normal workflow needs.

    The idea behind block pruning is that not every layer in a big model contributes equally, and some can be dropped with surprisingly little quality loss while saving compute and memory. Finding which blocks are safe to remove is the whole game, and it's fiddly, model-specific, and easy to get wrong. That's why this is flagged experimental rather than shipped as a default speed setting.

    The input and output that matter

    There's exactly one input:

    • remove_blocks (default "15, 25, 37") - a comma-separated list of block indices to strip out. The default is just an example set, not a recommendation. Which blocks are actually safe depends on the specific CogVideoX model and what you're generating.

    The single output, block_list (a TRANSFORMERBLOCKS bundle), plugs into the block_edit input on your model loader - either (Down)load CogVideo Model or CogVideoX Model Loader. The loader applies the edit as it builds the model. Nothing happens until it's connected there.

    How to install it

    Part of the CogVideoX wrapper:

    • ComfyUI Manager - search ComfyUI-CogVideoXWrapper, install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-CogVideoXWrapper, then pip install -r ComfyUI-CogVideoXWrapper/requirements.txt, restart.

    Common issues & troubleshooting

    Quality tanked after pruning. That's the risk, and it's on you - removing the wrong blocks damages the model. There's no universal "safe" list; the default 15, 25, 37 is illustrative. If output degrades, remove fewer blocks or none, and reintroduce them one at a time to find which ones actually hurt.

    No effect at all. The block_list output has to be wired into the loader's block_edit input. If it's dangling, the model loads untouched. This node doesn't modify anything on its own - it just produces the instruction the loader carries out.

    Should I use this? Almost certainly not, unless you're deliberately experimenting with pruning for speed or research. For everyday CogVideoX generation, leave it out entirely and use the proper VRAM levers - fp8 quantization, CPU offload, GGUF - which give you memory savings without gambling on which layers the model can live without.

    CategoryCogVideoWrapper

    Inputs (1)

    NameTypeDefaultDescription
    remove_blocksSTRING15, 25, 37Comma separated list of block indices to remove, 5b blocks: 0-41, 2b model blocks 0-29

    Outputs (1)

    NameTypeDescription
    block_listTRANSFORMERBLOCKS