ComfyUI安装和启动攻略1
ComfyUI 不是算法,也不是模型库。
它是一个 “可视化工作流界面(UI)+ 扩展框架”,
用来运行、组合和控制 AI 模型(尤其是扩散模型,比如 Stable Diffusion、Wan、Flux、SDXL、视频生成模型等)。
一、安装和确认:
1. 克隆ComfyUI到本地:
cd ~
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
创建环境:
module load cuda/12.2
module load anaconda3
conda create -n comfy python=3.10 -y
conda activate comfy
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
检查 GPU 是否可用
# 查看分区名、GPU资源(GRES)
sinfo -o "%20P %15G %10a %10l %5D %8t" # P=Partition, G=GRES, a=avail, l=timelimit, D=nodes, t=state# 方式 A:让调度器任选 gn 节点
salloc -p gpu --gres=gpu:1 --cpus-per-task=1
#确认有可用GPU
python -c "import torch; print(torch.cuda.is_available())"
运行:
python main.py --listen 0.0.0.0 --port 8188
解释:
--listen 0.0.0.0
→ 让外部访问可用--port 8188
→ Web 界面端口
启动后终端会显示类似:
ComfyUI started
Running on http://0.0.0.0:8188
二、日常使用:
准备:
# 1️⃣ 在 login 节点上申请 GPU 节点
# salloc -p gpuq --gres=gpu:1 --cpus-per-task=8 --mem=32G --time=02:00:00
salloc -p gpuq --gres=gpu:1 --cpus-per-task=1# 2️⃣ 进入 GPU 节点后(比如 gn07)
srun --pty bash -l # 有些环境 salloc 后自动进去,这步可省# 3️⃣ 在计算节点上激活你的环境
conda activate comfy# 4️⃣ 验证 GPU 可见
python -c "import torch; print(torch.cuda.is_available())"
准备好后:
# 5️⃣ 启动你的任务,比如 ComfyUI
cd ~/ComfyUI
python main.py --listen 0.0.0.0 --port 8188
本地:
ssh -L 18188:127.0.0.1:8188 -J A20250009@10.90.24.15 A20250009@gn08
之后本地浏览器打开:
http://127.0.0.1:18188