云服务器部署Stable Diffusion Webui从0到1总结:反复重启+循环debug

03-18 1367阅读

文章目录

  • 在学校服务器部署Stable Diffusion Webui
    • (一)准备工作
    • (二)环境配置
    • (三)git拉取项目到本地
    • (四)运行项目
    • 遇到的问题:
      • (一)使用git clone时,Failed to connect to 127.0.0.1 port 7890
      • (二)使用git clone时,出现RPC failed
      • (三)RuntimeError: Couldn’t install open_clip
      • (四)Couldn't checkout {name}'s hash: {commithash}.
      • (五)Failure when receiving data from the peer
      • (六)OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0
      • (七)Failed to connect to github.com port 443 after 127293 ms: Couldn't connect to server
      • (八)FileNotFoundError: No checkpoints found. When searching for checkpoints for Stable-diffusion
      • (九) Can't load tokenizer for 'openai/clip-vit-large-patch14'

        在学校服务器部署Stable Diffusion Webui

        (一)准备工作

        查看显卡

         nvidia-smi
        

        查看git版本号

        git --version
        

        (二)环境配置

        配置一个新环境

        conda create -n sd python=3.10.6
        

        查看已有环境

        conda env list
        

        激活该环境

        conda activate sd
        

        进入用于存放项目的空文件夹

        cd sdwebui
        

        (三)git拉取项目到本地

        git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
        

        (四)运行项目

        进入项目目录下

         cd stable-diffusion-webui
        

        运行

        bash webui.sh -f
        

        遇到的问题:

        (一)使用git clone时,Failed to connect to 127.0.0.1 port 7890

        git config --global --list
        
        git config--global user.name dx
        
         git config --global user.password dxdxdxdx
        

        查看是否设置代理

        git config --global http.proxy
        

        取消设置代理

        git config --global --unset http.proxy
        

        (二)使用git clone时,出现RPC failed

        因为git库上面放了一些数据,整个库较大。curl的postBuffer 默认值较小,配置下个这个值,就不会出现该错误了

        git config --global http.postBuffer 1024288000
        

        再进行git clone 则不会再报错了

        (三)RuntimeError: Couldn’t install open_clip

        根据错误信息分析,程序在安装“open_clip”包时,尝试从GitHub上克隆代码仓库,但是克隆失败了,可能是由于网络连接问题或GitHub服务器出现问题导致的。可以重新运行程序,或等会再试,就可以了。

        (四)Couldn’t checkout {name}'s hash: {commithash}.

        这可能是因为存在Unknown option:-C的问题:

        云服务器部署Stable Diffusion Webui从0到1总结:反复重启+循环debug

        这个错误的意思是git版本不对,不能识别-C的命令,但是可以识别-c的命令,因此有两种解决方式:

        方式一:更新git版本

        方式二:更改-C的命令为-c

        该错误需要修改module文件夹下的launch_utils.py文件

        先进入module文件夹

        cd module
        

        进入launch_utils文件夹的编辑模式

        vim launch_utils.py
        

        在vim 中查找-C 并替换成 -c

        :%s/-C/-c/g   # 查找全部-C并替换成-c
        

        然后退出vim重新运行就行,退出方式:先点击Esc键,这一步的意思是vim准备接受命令了。然后直接敲击键盘输入命令。这一步需要注意的是,不要试图用鼠标在屏幕上找要任何输入命令的地方。你只需要点了Esc键,直接敲击键盘,然后键入命令,回车就行。另外,注意输入法需要是英文状态。(这一部分可以具体参考【git学习】如何编辑git config --global的配置文件)

        :wq!    
        

        之后返回stable-diffusion-webui文件夹重新运行即可

        cd ..
        

        (五)Failure when receiving data from the peer

        多试几次还不行的话等一会再试几次。我的是等了一会再试直接就可以了。

        (六)OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0

        进入Git Bash Here解除ssl验证

        git config --global http.sslVerify "false"
        

        (七)Failed to connect to github.com port 443 after 127293 ms: Couldn’t connect to server

        设置代理

        git config --global http.proxy 127.0.0.1:7890
        git config --global https.proxy 127.0.0.1:7890
        

        然后再取消设置代理

        git config --global --unset http.proxy
        git config --global --unset https.proxy
        

        (八)FileNotFoundError: No checkpoints found. When searching for checkpoints for Stable-diffusion

        Stable-diffusion模型没有下载完成,根据报错提示在 huggingface.co 下载模型放到对应目录,如下载 stable-diffusion-v1-5 模型

        点击图中下载按钮,下载 v1-5-pruned-emaonly.safetensors 到 stable-diffusion-webui/models/Stable-diffusion 目录,其他模型同理。

        云服务器部署Stable Diffusion Webui从0到1总结:反复重启+循环debug

        点击图中下载按钮,下载 v1-5-pruned-emaonly.safetensors 到 stable-diffusion-webui/models/Stable-diffusion 目录,其他模型同理。

        模型下载完成,再次执行启动命令,提示已启动到 7860 端口,则可以通过 IP+7860 端口访问。

        这一部分主要参考自一份保姆级的 Stable Diffusion 部署教程,开启你的炼丹之路

        (九) Can’t load tokenizer for ‘openai/clip-vit-large-patch14’

        也是存在文件缺失的问题,根据报错提示在 huggingface.co 下载模型放到对应目录,https://huggingface.co/openai/clip-vit-large-patch14/tree/main

        下载文件为:

        1、config.json

        2、flax_model.msgpack

        3、merges.txt

        4、preprocessor_config.json

        5、pytorch_model.bin

        6、special_tokens_map.json

        7、tokenizer.json

        8、tokenizer_config.json

        9、vocab.json

        将以上九个文件放到新文件夹下:

        cd stable-diffusion-webui
        mkdir -p openai/clip-vit-large-patch14
        
VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]