ComfyUI 集成混元DIT(comfyui-hydit)

2024-06-14 09:44
文章标签 comfyui 混元 dit hydit 集成

本文主要是介绍ComfyUI 集成混元DIT(comfyui-hydit),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

最近腾讯官方推出了ComfyUI插件comfyui-hydit 。是一个专门为腾讯的 Hunyuan-DiT 模型设计的自定义节点和工作流。本文主要介绍如何通过ComfyUI来运行腾讯新出的支持中文提示词的混元文生图大模型Hunyuan-DiT

环境准备

插件

从腾讯混元DIT 源码库获取插件源码:
https://github.com/Tencent/HunyuanDiT.git
从该仓库中获取 :comfyui-hydit

模型

所有模型下载后保存在需要挂载的路径下。

所有模型下载后保存在需要挂载的路径下:/u01/workspace/models/hunyuan

克隆HunyuanDiT模型

有多个模型可选择,我们这里采用了第三个模型:
Tencent-Hunyuan/HunyuanDiT 基础模型
Tencent-Hunyuan/HunyuanDiT-Diffusers 加入Diffusers格式
Tencent-Hunyuan/Distillation 加速版

git clone https://huggingface.co/Tencent-Hunyuan/HunyuanDiT
git clone https://huggingface.co/Tencent-Hunyuan/Distillation

如果想要加速版,以上两个地址的文件都要下载
注意下载完Distillation 模型后,需要拷贝模型pytorch_model_distill.pt到: HunyuanDiT/t2i/model/目录下

下载OpenAI视觉模型

git clone https://hf-mirror.com/openai/clip-vit-large-patch14-336
:::danger
保存位置:/u01/workspace/models/clip-vit-large-patch14-336
源码修改方式请参照混元模型的部署过程。
:::

容器化部署ComfyUI

复制comfyui-hydit插件目录到ComfyUI custom_nodes目录:

├── AIGODLIKE-ComfyUI-Translation
├── comfyui_controlnet_aux
├── ComfyUI_Custom_Nodes_AlekPet
├── ComfyUI-Custom-Scripts
├── comfyui-hydit
├── ComfyUI-Manager
├── ComfyUI_TiledKSampler
├── ComfyUI_UltimateSDUpscale
├── Derfuu_ComfyUI_ModdedNodes
├── efficiency-nodes-comfyui
├── example_node.py.example
├── __pycache__
├── sdxl_prompt_styler
└── websocket_image_save.py

准备Dockerfile文件

准备Dockerfile可以安装预装插件和不预装两种不同的方式,如果不预装插件,可以把插件挂载到宿主机上等启动之在安装插件,本文采用的是预装的方式准备的Dockerfile

FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV LANG=zh_CN.UTF-8
WORKDIR /appRUN apt-get update 
RUN apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libxext6 git
RUN rm -rf /var/lib/apt/lists/*
ENV GIT_PYTHON_REFRESH=quiet RUN pip config set global.index-url http://mirrors.aliyun.com/pypi/simple
RUN pip config set install.trusted-host mirrors.aliyun.comCOPY ComfyUI/ /app/ComfyUI/
WORKDIR /app/ComfyUIRUN pip install --use-pep517 -r requirements.txt
RUN pip install -r  custom_nodes/comfyui_controlnet_aux/requirements.txt
RUN pip install -r  custom_nodes/ComfyUI-Manager/requirements.txt
RUN pip install -r  custom_nodes/ComfyUI_Custom_Nodes_AlekPet/ArgosTranslateNode/requirements.txt
RUN pip install -r  custom_nodes/ComfyUI_Custom_Nodes_AlekPet/DeepTranslatorNode/requirements.txt
RUN pip install -r  custom_nodes/ComfyUI_Custom_Nodes_AlekPet/GoogleTranslateNode/requirements.txt
RUN pip install -r  custom_nodes/efficiency-nodes-comfyui/requirements.txt
RUN pip install -r  custom_nodes/comfyui-hydit/requirements.txtEXPOSE 8188
CMD [ "python","main.py ","--port 8188"]

custom_nodes/comfyui-hydit/requirements.txt 修改:

#--extra-index-url https://pypi.ngc.nvidia.com
#--extra-index-url https://download.pytorch.org/whl/cu117
timm
diffusers
peft
protobuf
accelerate
loguru
sentencepiece
cuda-python
polygraphy
pandas
omegaconf
# torch>=2.3.0
# torchvision>=0.18.0
# torchaudio>=2.3.0
xformers>=0.0.26.post1
pytorch_lightning

执行构建

docker buile -t qingcloudtech/comfyui:v1.1 .

启动容器

docker run -it --gpus all \
-p 8188:8188 \
-v /u01/workspace/models/stablediffusion:/app/ComfyUI/models \
-v /u01/workspace/comfyui/output/:/app/ComfyUI/output \
- /u01/workspace/ComfyUI/extra_model_paths.yaml:/app/ComfyUI/extra_model_paths.yaml
qingcloudtech/comfyui:v1.5 python main.py

启动容器(docker-compose方式)

准备配置文件
version: '3.8'
services:comfyui:image: qingcloudtech/comfyui:v1.1container_name: comfyuicommand: python /app/ComfyUI/main.pydeploy:resources:reservations:devices:- driver: nvidiacount: allcapabilities: [gpu]volumes:- /u01/workspace/models/stablediffusion/:/app/ComfyUI/models/- /u01/workspace/comfyui/output/:/app/ComfyUI/output- /u01/workspace/ComfyUI/extra_model_paths.yaml:/app/ComfyUI/extra_model_paths.yamlnetwork_mode: host
执行启动命令:
docker-compose up -d

浏览器访问:

演示访问:

1、浏览器访问:127.0.0.1:8188
2、从web界面中加载如下测试json:

{"last_node_id": 21,"last_link_id": 6,"nodes": [{"id": 19,"type": "DiffusersClipTextEncode","pos": [74,277],"size": {"0": 400,"1": 200},"flags": {},"order": 0,"mode": 0,"outputs": [{"name": "positive","type": "STRINGC","links": [5],"shape": 3,"label": "positive"},{"name": "negative","type": "STRINGC","links": [6],"shape": 3,"label": "negative"}],"properties": {"Node name for S&R": "DiffusersClipTextEncode"},"widgets_values": ["castle,landscape,1girl,loli,silver hair,school_uniform,crystal_earrings,kind_smile,arm_support,in summer,mini_witch_hat,frilled,strappy_heels,book,\n","错误的眼睛,糟糕的人脸,毁容,糟糕的艺术,变形,多余的肢体,模糊的颜色,模糊,重复,病态,残缺,"]},{"id": 16,"type": "DiffusersModelMakeup","pos": [526,393],"size": {"0": 304.79998779296875,"1": 46},"flags": {},"order": 3,"mode": 0,"inputs": [{"name": "pipeline","type": "PIPELINE","link": 2,"label": "pipeline"},{"name": "scheduler","type": "SCHEDULER","link": 3,"label": "scheduler"}],"outputs": [{"name": "MAKED_PIPELINE","type": "MAKED_PIPELINE","links": [4],"shape": 3,"label": "MAKED_PIPELINE"}],"properties": {"Node name for S&R": "DiffusersModelMakeup"}},{"id": 18,"type": "DiffusersSampler","pos": [842,132],"size": [315,454],"flags": {},"order": 4,"mode": 0,"inputs": [{"name": "maked_pipeline","type": "MAKED_PIPELINE","link": 4,"label": "maked_pipeline"},{"name": "positive","type": "STRINGC","link": 5,"label": "positive"},{"name": "negative","type": "STRINGC","link": 6,"label": "negative"}],"outputs": [{"name": "IMAGE","type": "IMAGE","links": [1],"shape": 3,"label": "IMAGE"}],"properties": {"Node name for S&R": "DiffusersSampler"},"widgets_values": [1,1024,1024,30,6,2705109163,"randomize"]},{"id": 6,"type": "PreviewImage","pos": [1186,181],"size": [210,246],"flags": {},"order": 5,"mode": 0,"inputs": [{"name": "images","type": "IMAGE","link": 1,"label": "图像"}],"title": "Preview Image","properties": {"Node name for S&R": "PreviewImage"}},{"id": 21,"type": "DiffusersPipelineLoader","pos": [81,544],"size": {"0": 315,"1": 190},"flags": {},"order": 1,"mode": 0,"outputs": [{"name": "PIPELINE","type": "PIPELINE","links": [2],"shape": 3,"label": "PIPELINE"},{"name": "MODEL","type": "MODEL","links": null,"shape": 3,"label": "MODEL"},{"name": "CLIP","type": "CLIP","links": null,"shape": 3,"label": "CLIP"},{"name": "VAE","type": "VAE","links": null,"shape": 3,"label": "VAE"}],"properties": {"Node name for S&R": "DiffusersPipelineLoader"},"widgets_values": ["ckpts","pytorch_model_distill.pt","disable","diffusers"]},{"id": 15,"type": "DiffusersSchedulerLoader","pos": [73,129],"size": {"0": 315,"1": 58},"flags": {},"order": 2,"mode": 0,"outputs": [{"name": "SCHEDULER","type": "SCHEDULER","links": [3],"shape": 3,"label": "SCHEDULER"}],"properties": {"Node name for S&R": "DiffusersSchedulerLoader"},"widgets_values": ["ddim"]}],"links": [[1,18,0,6,0,"IMAGE"],[2,21,0,16,0,"PIPELINE"],[3,15,0,16,1,"SCHEDULER"],[4,16,0,18,0,"MAKED_PIPELINE"],[5,19,0,18,1,"STRINGC"],[6,19,1,18,2,"STRINGC"]],"groups": [],"config": {},"extra": {"ds": {"scale": 0.9090909090909098,"offset": {"0": 163.4918776991919,"1": 16.755363890844446}}},"version": 0.4
}

3、查看结果:
image.png


【Qinghub Studio 】更适合开发人员的低代码开源开发平台
QingHub企业级应用统一部署
QingHub企业级应用开发管理
QingHub演示
https://qingplus.cn

这篇关于ComfyUI 集成混元DIT(comfyui-hydit)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1060049

相关文章

SpringBoot集成Netty,Handler中@Autowired注解为空

最近建了个技术交流群,然后好多小伙伴都问关于Netty的问题,尤其今天的问题最特殊,功能大概是要在Netty接收消息时把数据写入数据库,那个小伙伴用的是 Spring Boot + MyBatis + Netty,所以就碰到了Handler中@Autowired注解为空的问题 参考了一些大神的博文,Spring Boot非controller使用@Autowired注解注入为null的问题,得到

vue项目集成CanvasEditor实现Word在线编辑器

CanvasEditor实现Word在线编辑器 官网文档:https://hufe.club/canvas-editor-docs/guide/schema.html 源码地址:https://github.com/Hufe921/canvas-editor 前提声明: 由于CanvasEditor目前不支持vue、react 等框架开箱即用版,所以需要我们去Git下载源码,拿到其中两个主

BD错误集锦8——在集成Spring MVC + MyBtis编写mapper文件时需要注意格式 You have an error in your SQL syntax

报错的文件 <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.yuan.dao.YuanUserDao"><!

BD错误集锦7——在集成Spring MVC + MyBtis时使用c3p0作为数据库时报错Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatem

异常信息如下: Type Exception ReportMessage Handler dispatch failed; nested exception is java.lang.AbstractMethodError: Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.isClosed()Z is abstractDescr

陀螺仪LSM6DSV16X与AI集成(8)----MotionFX库解析空间坐标

陀螺仪LSM6DSV16X与AI集成.8--MotionFX库解析空间坐标 概述视频教学样品申请源码下载开启CRC串口设置开启X-CUBE-MEMS1设置加速度和角速度量程速率选择设置FIFO速率设置FIFO时间戳批处理速率配置过滤链初始化定义MotionFX文件卡尔曼滤波算法主程序执行流程lsm6dsv16x_motion_fx_determin欧拉角简介演示 概述 本文将探讨

Spring 集成 RabbitMQ 与其概念,消息持久化,ACK机制

目录 RabbitMQ 概念exchange交换机机制 什么是交换机binding?Direct Exchange交换机Topic Exchange交换机Fanout Exchange交换机Header Exchange交换机RabbitMQ 的 Hello - Demo(springboot实现)RabbitMQ 的 Hello Demo(spring xml实现)RabbitMQ 在生产环境

springboot集成prometheus监控

1 Maven pom.xml引入依赖 <dependency><groupId>io.prometheus</groupId><artifactId>simpleclient_spring_boot</artifactId></dependency> 2 启动类引入注解 import io.prometheus.client.spring.boot.EnablePrometheusEnd

在vue项目中集成cesium

首先创建一个新的vue项目 安装vite中cesium插件 https://github.com/nshen/vite-plugin-cesium 安装插件 npm i cesium vite-plugin-cesium vite -D 配置插件 注释原有样式 修改代码 效果

web前端不可错过的开发工具–Adobe Brackets(开源、简洁强大的HTML、CSS和JavaScript集成开发环境)

Adobe Brackets是一个开源的基于HTML/CSS/JavaScript开发,运行在native shell上的集成开发环境。该项目由Adobe创建和维护,根据MIT许可证发布。提供Windows和OS X平台支持。 Brackets的特点是简约、快捷,没有很多的视图或者面板,它的核心目标是减少在开发过程中那些效率低下的重复性工作,例如浏览器刷新,修改元素的样式,搜索功能等等。

【jenkins1】gitlab与jenkins集成

文章目录 1.Jenkins-docker配置:运行在8080端口上,机器只要安装docker就能装载image并运行容器2.Jenkins与GitLab配置:docker ps查看正在运行,浏览器访问http://10....:8080/2.1 GitLab与Jenkins的Access Token配置:不涉及具体项目2.2 新建jenkins job和配置job:jenkins的Dash