模型部署arrowPic ComfyUI-HunyuanVideoWrapper 模型部署教程
ComfyUI-HunyuanVideoWrapper 模型部署教程
发布时间:2025-01-21 10:31:00

一、介绍

ComfyUI 是一个强大的、模块化的 Stable Diffusion 界面与后端项目。该用户界面允许用户使用基于图形/节点/流程图的界面设计和执行高级稳定的扩散管道。该项目部分其它特点如下:

  • 目前全面支持 SD1.xSD2.xSDXLSD3Stable Video Diffusion 和 Stable Cascade
  • 命令行选项: --lowvram 使其在显存小于 1GB 的 GPU 上运行(在显存较低的 GPU 上自动启用)
  • 即使没有 GPU,也可以工作: --cpu (慢)
  • 可以加载 ckptsafetensors 和 diffusers models/checkpoints。独立 VAE 和 CLIP 模型
  • 从生成的 PNG 文件加载完整的工作流程(带有种子)
  • 将工作流程保存/加载为 Json 文件

HunyuanVideoWrapper:量化版的混元模型,Scaled Dot 产品注意力(sdpa)现在应该可以正常工作(仅在 Windows 上测试,torch2.5.1+cu124 在 4090 上测试),仍然建议使用 sage 注意力以提高速度,但应该不再是必要的,这会使安装变得更加容易。

二、容器构建说明

1. 部署ComfyUI

(1)使用命令克隆ComfyUI

git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI

(2)安装 conda(如已安装则跳过)

下面需要使用 Anaconda 或 Mimiconda 创建虚拟环境,可以输入 conda --version 进行检查。下面是 Mimiconda 的安装过程:

  • 下载 Miniconda 安装脚本
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  • 运行安装脚本
bash Miniconda3-latest-Linux-x86_64.sh
  • 遵循安装提示并初始化

按 Enter 键查看许可证条款,阅读完毕后输入 yes 接受条款,安装完成后,脚本会询问是否初始化 conda 环境,输入 yes 并按 Enter 键。

  • 运行 source ~/.bashrc 命令激活 conda 环境
  • 再次输入 conda --version 命令来验证是否安装成功,如果出现类似 conda 4.10.3 这样的输出就成功了。

(3)创建虚拟环境

输入下面的命令:

conda create -n comfyui python=3.10
conda activate comfyui

(4)安装pytorch

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121

(5)安装项目依赖

pip install -r requirements.txt

此时所需环境就已经搭建完成,通过下面命令进行启动:

python main.py

访问网址得到类似下图界面即表示成功启动:

image.png

2. 克隆HunyuanVideoWrapper项目

(1)下载HunyuanVideoWrapper项目相关内容

访问 https://github.com/kijai/ComfyUI-HunyuanVideoWrapper,下载 HunyuanVideoWrapper的相关内容。首次访问该页面时,可能需要同意用户协议才能看到模型下载页。

1733800606260.png

重新进入终端,运行下载指令,保存路径为/ComfyUI/custom_nodes/

cd /ComfyUI/custom_nodes/
git clone https://github.com/kijai/ComfyUI-HunyuanVideoWrapper.git

下载完成以后安装依赖,安装路径为/ComfyUI/custom_nodes/ComfyUI-HunyuanVideoWrapper/

cd ComfyUI-HunyuanVideoWrapper/
pip install -r requirements.txt

(2)相关模型下载

  • 根据HunyuanVideoWrapper项目给出的下载链接

image.png

下载Kijai/HunyuanVideo_comfy,访问地址:,点击下图箭头所指,通过Clone repository获取下载链接

1733802940511.png

  • 下载模型
cd /ComfyUI/models/
git clone https://huggingface.co/Kijai/HunyuanVideo_comfy

模型下载成功以后,移动到相应路径下,进入路径下操作/ComfyUI/models/HunyuanVideo_comfy

cd HunyuanVideo_comfy
mv hunyuan_video_720_cfgdistill_fp8_e4m3fn.safetensors /ComfyUI/models/diffusion_models/
mv hunyuan_video_vae_bf16.safetensors /ComfyUI/models/vae/

下载llava-llama-3-8b-text-encoder-tokenizer模型和clip-vit-large-patch14模型,在https://huggingface.co上下载速度相对较慢,可以在魔搭社区下载https://www.modelscope.cn,进入社区,通过模型名称搜索,获取相应的下载链接。

1733809564847.png

下载模型,都需要切换相应的保存路径下

下载llava-llama-3-8b-text-encoder-tokenizer模型。此处注意,如果在/ComfyUI/models/路径下没有LLM文件夹,需要自己创建

cd /ComfyUI/models/LLM
git lfs install
git clone https://www.modelscope.cn/Kijai/llava-llama-3-8b-text-encoder-tokenizer.git

下载clip-vit-large-patch14模型

cd /ComfyUI/models/clip
git lfs install
git clone https://www.modelscope.cn/AI-ModelScope/clip-vit-large-patch14.git

(3)启动项目

重新启动项目,通过访问地址进入webui,将工作流拖入webui界面。

conda activate comfyui
cd ComfyUI
python main.py

出现“http....8080”表示运行成功。

image.png

访问webui

image.png

下载工作流,需下载图中的文件夹,这是官方提供的工作流,下载链接https://github.com/kijai/ComfyUI-HunyuanVideoWrapper。建议下载到本地,使用的时候直接将文件拖入webui界面

1733811677118.png

1733812137647.png

导入工作流即可开始comfyui探索之旅

屏幕截图

3. 拓展插件安装(可选)

(1)下载manager管理器

manager 是一个用来加强ComfyUI可用性的扩展,提供了对ComfyUI各种自定义节点的安装、删除、禁用、启用等管理功能。同时还提供了中心功能和便利功能,用来访问 ComfyUI 中各种信息。

cd /ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git

成功安装之后重启界面会出现一个“Manager”如图:

image.png

(2)界面汉化插件

git clone https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git

下载文件之后需要重新启动,重启模型之后:

image.png

设置一次之后可点击图中框选出的选项进行语言的切换:

image.png

(3)中文提示词插件安装

cd /ComfyUI/custom_nodes
git clone https://github.com/thisjam/comfyui-sixgod_prompt.git

然后重启ComfyUI后看到下图的小标志就表示可以了:

image.png

使用方法:双击页面,在搜索框中搜索“six”即可出现,点击sixGodPrompts,此时出现的就是提示词的中文输入框可以替代自带的clip输入框,可点击左下角的小标或按“AIT”+“q”打开和隐藏。

image.png

使用方法如下:

image.png

点击此处,立即体验ComfyUI-HunyuanVideoWrapper!

bg-circle
算力加速·赋能科研
2026闲时计算资源公益助研活动进行中
2026年1月1日-2026年12月31
立即申请
新人好礼
客服中心