MacOS
MPS support
pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
如果出现
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')
错误,则证明安装的 torch 版本不是 arm ,需要将 torch torchvision torchaudio 删除重装。
不需要增加 --no-binary=:all: --compile --no-cache-dir --force-reinstall
这些类似的参数
pip uninstall torch torchvision torchaudio
以此类推,如果出现其他 mach-o file 的错误,也是将其卸载重装。因为 M系列芯片和 Intel 系列芯片有过渡期,可能会出现 M系列芯片的电脑上有 X86 的 packages。
比如可能会出现 numpy、PIL(其实是 Pillow)同样因为版本问题导致一样的报错。
如果是 PIL 出现问题,则需要重装 Pillow pip uninstall Pillow
-> pip install Pillow
测试安装是否成功代码
import torch
if torch.backends.mps.is_available():
mps_device = torch.device("mps")
x = torch.ones(1, device=mps_device)
print (x)
else:
print ("MPS device not found.")
执行之后输出 tensor([1.], device='mps:0')
为成功
(资料来源 https://developer.apple.com/metal/pytorch/)
安装 ComfyUI
原项目太大了,如果不是为了维护项目,可以直接只下载最新代码
git clone --depth 1 git@github.com:comfyanonymous/ComfyUI.git
使用 --depth 1
会使下载 14433 个文件变成只下载 408 个文件。
创建虚拟环境
因为 python 的包管理问题,如果不希望 comfyui 影响系统的 package ,可以只在当前 python 虚拟环境下运行
cd ComfyUI
python -m venv
安装 Python 依赖
pip install -r requirements.txt
运行 ComfyUI
python main.py
安装插件
- 插件安装管理器:https://github.com/ltdrdata/ComfyUI-Manager
- SDXL风格样式:https://github.com/twri/sdxl_prompt_styler
- ComfyUI界面汉化:https://github.com/AIGODLIKE/AIGODLIKE-COMFYUI-TRANSLATION
- 中文提示词输入:https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet
- 蟒蛇八卦工具箱:https://github.com/pythongosssss/ComfyUI-Custom-Scripts
ref waytoai
工具箱
cd ComfyUI/custom_nodes
git clone --depth=1 https://github.com/ltdrdata/ComfyUI-Manager.git
简体中文
cd ComfyUI/custom_nodes
git clone --depth=1 https://github.com/AIGODLIKE/AIGODLIKE-COMFYUI-TRANSLATION.git