Hunyuan Video in ComfyUI (Patreon)
Downloads
Content
NOTE
The licence only allows certain territories to use the model, so I've removed the video and there are no outputs shown here. Next time I'll need to make sure I read the licence properly!
Mistake 1:
The license for the Tencent Hunyuan model only allows usage in certain territories, and I’ve now realized that the license excludes the United Kingdom and South Korea, which I initially missed. As a result, I’ve removed the video and the model files to comply with these restrictions. Going forward, I will ensure I carefully review licensing terms to avoid such oversights.
You can see the official Tencent license here:
https://huggingface.co/tencent/HunyuanVideo/blob/main/LICENSE
Take care as this is different to the licence file in the kijai repo, which has only the European Union excluded:
https://huggingface.co/Kijai/HunyuanVideo_comfy/blob/main/LICENSE
The Tencent license change commit was made later, so it’s easy to miss. This may also be present in other places.
Mistake 2:
Geo-restricted licensing is new to me, but as per the Tencent license terms under "5. Rules of Use", it appears that anyone sharing videos made with Hunyuan Video on platforms like Twitter, TikTok, Reddit, GitHub, or Hugging Face could also be violating the licensing agreement (unless they are properly restricting access by territory). I now realize I should have been more cautious in understanding the broader implications of this.
Please note, I am not a lawyer and this is not legal advice, but after reviewing the licensing terms, it’s clear I should have been more diligent in reading the fine print. This mistake is entirely my own, and I sincerely apologise for any confusion caused.
For those who are still able to comply with the terms, the information below is hopefully still okay. Please ensure that you are adhering to the correct territorial restrictions before proceeding.
ComfyUI
As seems to be the way nowadays, ComfyUI is the place to go if you want to run it at home on your own computer.
For a standard ComfyUI install on Linux, you can install everything as usual:
conda activate comfyui
cd custom_nodes/
git clone https://github.com/kijai/ComfyUI-HunyuanVideoWrapper
cd ComfyUI-HunyuanVideoWrapper
pip install -r requirements.txt
pip install -U flash_attn sageattention triton
For Microsoft Windows, it's all identical apart from the last line, as you may not be set up to compile flash & sage attention on that OS.
These attention modules are optional. You can create videos without them, but if you don't use sage attention then you'll be taking quite a chunky performance hit.
To get the last line to work on MS Windows, I'd suggest checking out this post by Purz - https://purz.notion.site/Get-Windows-Triton-working-for-Mochi-6a0c055e21c84cfba7f1dd628e624e97
It happens to be an old one for Mochi, but shows how he got sageattention installed on his Windows system.
For Mac OS I haven't seen much, but some GitHub comments appear to suggest it can be made to work.
For the "Comfy" attention, once again you'll need to start with xformers disabled if you have it installed. E.g.
python main.py --disable-xformers
Links
https://github.com/Tencent/HunyuanVideo
https://github.com/kijai/ComfyUI-HunyuanVideoWrapper
https://github.com/thu-ml/SageAttention
https://github.com/woct0rdho/triton-windows/releases
https://purz.notion.site/Get-Windows-Triton-working-for-Mochi-6a0c055e21c84cfba7f1dd628e624e97
Workflows
Workflows attached are:
HunYuanVideo_t2v_example_v0 = Text to video example (rodent eating pasta)
HunYuanVideo_t2v_lowvram_example_v0 = Includes settings for low VRAM cards
HunYuanVideo_v2v_example_v0 = Example with both t2v & v2v together
HunYuanVideo_v2v_example_v1 = Example with just v2v
Note that the sampler does odd numbers of frames - 1,5,9,13,17,21, etc.