第一遍配的时候没做记录,过了一个月发现服务器上conda环境被清了,只能重新配一遍了(悲)
顺手在这做个过程记录
项目地址:https://github.com/ChenyiZhang007/MattePro
MattePro部分
为了确保节点正常工作,应该先配置好MattePro的环境,再去配置comfyui
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
// 临时设定pip镜像源
from detectron2.config import LazyConfig, instantiate
ModuleNotFoundError: No module named 'detectron2.config'
// 不装detectron2肯定是跑不起来的
Detectron2部分
这项目git仓库的release巨古老

只能跟随官方教程手动编译安装了
https://detectron2.readthedocs.io/en/latest/tutorials/install.html

执行到python -m pip install -e detectron2
出现了以下报错

也就是说,安装这东西要解决一个叫The detected CUDA version mismatches the version that was used to compile
的报错,其实就是这个项目莫名其妙对CUDA版本加了很严格的限制,查找解决方案时找到了下面的博客
https://blog.csdn.net/m0_51516317/article/details/139423784
解决不了问题就解决提出问题的代码
基于以上的精妙思想,修改 /opt/conda/envs/mattepro/lib/python3.10/site-packages/torch/utils/cpp_extension.py
的部分代码
if cuda_ext and not IS_HIP_EXTENSION:
pass #_check_cuda_version(compiler_name, compiler_version)
# 把原本的调用改成了直接pass
重新执行安装
python -m pip install -e detectron2
网页上线
找到了一个方法,让纯内网算力服务器部署出来的comfyui能被公网访问到
用户浏览器 --> 公网服务器 (Nginx, 80/443端口) --> 公网服务器本地端口 (此处随便选了个17860) --> SSH 隧道 --> 算力服务器的 7860
端口
步骤分为两大部分:
- 在公网服务器
bjtu.top
上:配置 Nginx,让它准备好接收来自公网的请求,并转发给一个本地端口。 - 在内网算力服务器
10.126.62.68
上:运行 SSH 命令,建立一个连接到bjtu.top
的隧道,把 Nginx 的流量“接过来”。
在算力服务器上执行
ssh -fN -R 17860:localhost:8188 root@网页服务器IP
命令解释:
-R 17860:localhost:7860
: 核心指令。在远程主机 (bjtu.top
) 上监听17860
端口,并将所有流量转发到本机 (10.126.62.68
) 的7860
端口。[email protected]
: 您用于登录公网服务器的用户名和地址。请务必替换public_user
为您的真实用户名。-fN
: 与之前一样,后台运行且不执行命令。
公网服务器的Nginx配置如下
server {
listen 80;
listen [::]:80;
server_name 项目要用的域名;
return 301 https://$server_name$request_uri;
}
# HTTPS server block for comfyui.bjtu.top
# This is where the reverse proxy happens
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name 项目要用的域名;
# 为ComfyUI等应用设置,支持长时间连接和WebSocket
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
location / {
# 代理到您通过SSH隧道建立的本地端口 17860
proxy_pass http://127.0.0.1:17860;
# 以下是为 WebSocket 正常工作设置的关键头部
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
}
}

Comments NOTHING