CivArchive
    Hunyuan Video Workflow for High VRAM Savings - v1.0
    NSFW
    Preview 50745231

    This workflow has only been tested on WSL. You'll need Triton, Sage Attention and Bits and Bytes if you want but it doesn't affect memory. If you don't have Bits and Bytes installed, then set the TextEncoder quantization to Disabled. If you don't use Sage Attention, then the memory usage will be higher.

    You can connect Enhance-a-Video node to feta_args, but it will slightly impact memory usage depending on the weight used. You can also connect a Lora to the model loader.

    The biggest factor that will affect memory usage is the blockswap node. The higher you set this, the more memory is saved and the longer the generation time. Start with double blocks. It maxes at 20. If you need more memory savings, use single blocks which maxes at 40. I have a 4080 and I've been able to do nearly 300 frames at 720x480 which takes about 25 minutes. You can increase resolution while reducing frames. A 24+ GB card will obviously be able to do more.

    The goal is to set the blockswaps as low as possible while using most of your VRAM to preserve generation speed. For example, don't set 20/40 for a 2 second video. Only increase if needing more frames or resolution and you are already near your VRAM limit. Use a memory monitor such as GPU-Z. Don't get too close to your max VRAM or it's possible it will work without a OOM error but generate a lot slower than it should. I have 16 GB which is 16384 MB. I try to keep it below 16000 MB for full speed. If I go even slightly higher it could double the generation time or worse.

    The note box is for my own reference. You can modify this for your own reference.

    Description

    FAQ

    Comments (10)

    myprivacy27091991221Jan 10, 2025· 1 reaction
    CivitAI

    IndexError: list index out of range in HunyuanVideo TextEncode node

    Mitch_Connor_420_69Jan 10, 2025
    CivitAI

    Do you have any examples of 300+ frame videos? How well does the video stick to the context of the LORA towards the end?

    nelwyn2541
    Author
    Jan 10, 2025

    I've edited the description since I was thinking of my best in the past. Since updating recently, I haven't been getting quite as many frames but can still manage in the high 200's at 720x480. I've uploaded a video example although it didn't quite follow my prompt completely. I'm not sure what changed but I did start using the mp_rank_00 f8 scaled model instead of the hunyuan_video_720 one although the new one is supposed to save memory too, but I haven't really noticed that. There's been some updates from kijai too since then on the github. The example video is 720x480 with 289 frames at 24 FPS which is about the best I can do now.

    As for Loras, I've only used one once and it did seem to follow it.

    SantaonholidaysJan 10, 2025
    CivitAI

    My Compile Args is broken,i installed Triton etc. nothing helped

    nelwyn2541
    Author
    Jan 10, 2025

    You can try disconnecting the torch compile settings node as it will still work without it but will use more memory.

    SantaonholidaysJan 10, 2025

    @nelwyn2541 I dont mind the memory usage i have a 4090 but if it cuts the length of the generation would be better if i have it fixed :D

    nelwyn2541
    Author
    Jan 10, 2025

    @Santaonholidays I'm not sure what the issue could be. You could try using the workflow under the examples folder in the ComfyUI-HunyuanVideoWrapper folder labeled lowvram_blockswap_test. This workflow is based off of that with my own twist on it. Originally when I started, I used Windows and so I didn't use the compile node or sage attention and it worked fine. Later on, came the additions but I could only get it to work on WSL.

    SantaonholidaysJan 10, 2025

    @nelwyn2541 i did that and it works fine there

    nelwyn2541
    Author
    Jan 11, 2025

    @Santaonholidays Well, you could try updating your HunyuanVideoWrapper folder from the github since there have been some new additions and changes to the nodes in the past week and see if this workflow works then.

    SantaonholidaysJan 11, 2025

    @nelwyn2541 i have the recent version because i removed and installed everything new :D

    Workflows
    Hunyuan Video

    Details

    Downloads
    1,245
    Platform
    CivitAI
    Platform Status
    Available
    Created
    1/10/2025
    Updated
    4/30/2026
    Deleted
    -

    Files

    hunyuanVideoWorkflowFor_v10.zip

    Mirrors

    Huggingface (1 mirrors)