demo1984s 的个人博客
这里使用Anaconda3管理Python环境,目的是为了避免Python项目共用环境导致的依赖冲突等一系列问题。下载页面 Download Anaconda Distribution | Anaconda - https://www.anaconda.com/download。
百度网盘下载链接 Anaconda3-2024.10-1-Windows-x86_64.exe - https://pan.baidu.com/s/1itL6cu8KmEIlBCXsFdt7yA?pwd=25mw
检查Python是否安装成功,这里懒得折腾环境变量,这里在开始才到找到并打开Anaconda Prompt运行后续命令。



Git客户端用于从github.com上下载和更新ComfyUI仓库源码。下载页面Git - Downloads - https://git-scm.com/downloads。
百度网盘下载链接 Git-2.47.1.2-64-bit - https://pan.baidu.com/s/1lQ_AugwOLCrZQYa5OplwFg?pwd=7cjt
检查Git是否安装成功。

没有安装ComfyUI官方的桌面版 (Download ComfyUI for Windows/Mac - https://www.comfy.org/download) 的主要原因是感觉不太稳定,重启电脑后总会有一些问题,所以这里从github.com下载仓库源码的方式部署。
GitHub - comfyanonymous/ComfyUI: The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. - https://github.com/comfyanonymous/ComfyUI
克隆到本地D盘D:\github.com目录下。
git clone https://github.com/comfyanonymous/ComfyUI.git
新建一个ComfyUI-Python3.12-GPU的Python虚拟环境。
conda create -n ComfyUI-Python3.12-GPU python=3.12
激活虚拟环境,注意看红框由(base)变成(ComfyUI-Python3.12-GPU)表示成功切换Python环境。
conda activate ComfyUI-Python3.12-GPU

本机为NVIDIA显卡,先查看显卡支持的CUDA版本为12.7,安装pytorch的版本可小于等于12.7。
nvidia-smi

到pytorch网站Start Locally | PyTorch - https://pytorch.org/get-started/locally/ 查看最新支持版本为 12.6。
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

安装后报错,到页面Previous PyTorch Versions | PyTorch - https://pytorch.org/get-started/previous-versions/ 找到更低版本为12.4.
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124

如果后面ComfyUI启动提示AssertionError: Torch not compiled with CUDA enabled的错误,可先删除pytorch。
pip uninstall torch -y
重新安装pytorch,因为已经安装过,返回的信息提示是当前环境中相关依赖包及版本已经满足需求,首次安装会自动下载安装。
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124

安装其他依赖,同样因为已经安装过,返回的信息与首次安装不一样。
cd ComfyUI
pip install -r requirements.txt

如果想删除相关包,可用命令
pip uninstall -r requirements.txt
如果想强制更新,可用命令pip install --upgrade -r requirements.txt
Janus-Pro的节点有好几位作者都发布了,这里以安装ComfyUI-Janus-Pro节点为例。
git clone https://github.com/CY-CHENYUE/ComfyUI-Janus-Pro.git
为了方便后面的管理,更推荐ComfyUI-Manager安装的方式。当然命令行方式更灵活,例如某些节点在ComfyUI-Manager搜索不到的的时候。
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
当然也可以启动ComfyUI后,通过ComfyUI-Manager进行安装。
cd ..
python main.py
打开浏览器访问http://127.0.0.1:8188/,可看到ComfyUI-Manager工具栏。

点开节点管理。

搜索Janus发现有好几个几点可用,这里选择安装ComfyUI-Janus-Pro节点。

为了加速下载,建议按以下步骤操作。
按下快捷键win+x,打开菜单项系统。

选择高级系统设置。

选择环境变量

新建一个名为HF_ENDPOINT,值为https://hf-mirror.com的用户变量,用系统变量新建也是可以的。

设置完成后关掉Anaconda Prompt窗口后重新打开,查看环境变量是否已生效。
echo %HF_ENDPOINT%
如果没有显示任何内容,或者在后续下载模型的时候报huggingface.co连接超时,重启电脑让环境变量生效。
先安装抱抱脸下载客户端工具huggingface-hub,部分网文写的是huggingface-cli,也许是Python版本不一样的问题或者就是写错,不深究。
pip install huggingface-hub

抱抱脸上deepseek-ai (DeepSeek) - https://huggingface.co/deepseek-ai 有Janus-Pro-1B和Janus-Pro-7B两个版本,都下载下来试试效果。

下载Janus-Pro-1B:
huggingface-cli download deepseek-ai/Janus-Pro-1B --local-dir D:\github.com\ComfyUI\models\Janus-Pro\Janus-Pro-1B --resume-download --local-dir-use-symlinks False

下载Janus-Pro-7B:
huggingface-cli download deepseek-ai/Janus-Pro-7B --local-dir D:\github.com\ComfyUI\models\Janus-Pro\Janus-Pro-7B --resume-download --local-dir-use-symlinks False

用节点作者提供的工作流测试,一个节点用于文生图,另一个节点用于反推图片提示词。
cute anime girl with massive fluffy fennec ears and a big fluffy tail blonde messy long hair blue eyes wearing a maid outfit with a long black gold leaf pattern dress and a white apron mouth open holding a fancy black forest cake with candles on top in the kitchen of an old dark Victorian mansion lit by candlelight with a bright window to the foggy forest and very expensive stuff everywhere
Flux Dev原图:
Janus-Pro-1B效果(384x384):
Janus-Pro-7B效果(384x384):
A portrait photo of a girl
Janus-Pro-1B效果(384x384):
Janus-Pro-7B效果(384x384):
初步体验如上。