Skip to content

Linux 上安装 ComfyUI

ComfyUI 是一个强大且模块化的 Stable Diffusion GUI 和后端,它提供了一个基于图/节点/流程图的界面,让用户无需编码即可设计和执行高级的 Stable Diffusion 工作流。以下是在 Linux 系统上安装 ComfyUI 的步骤:

步骤 1:克隆存储库

首先,通过Git克隆ComfyUI的仓库到本地,打开终端并运行以下命令:

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

步骤 2:放置模型文件

将你的Stable Diffusion检查点(ckpt/safetensors文件)放置在 models/checkpoints 目录中。

将您的VAE模型放置在models/vae目录中。

步骤 3:安装PyTorch【AMD GPU(仅限 Linux)】

根据你的GPU类型安装PyTorch。对于AMD GPU,可以使用以下命令安装PyTorch的稳定版本 或 安装带有 ROCm 6.2 的夜间版本,可能会有一些性能改进:

bash
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1
# 或者
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2

对于NVIDIA 用户,可以使用以下命令安装:

bash
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu124
# 或者
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124

故障排除 如果您遇到“Torch not compiled with CUDA enabled”错误,卸载 Torch:

bash
pip uninstall torch

然后使用上述命令重新安装。

步骤 4:安装依赖项

在 ComfyUI 文件夹中打开终端并安装依赖项:

bash
pip install -r requirements.txt

步骤 5:运行 ComfyUI

依赖项安装完成后,通过运行以下Python命令启动ComfyUI:

bash
python main.py

完成

现在,ComfyUI 应已在您的 Linux 系统上成功安装并运行。

按照上述步骤,您应该能够在您的 Linux 系统上成功安装和运行 ComfyUI。如果有任何问题,请参考 ComfyUI GitHub 仓库 获取更多信息。