2025年9月3日
4 分钟阅读

部署stable-diffusion

部署stable-diffusion

部署stable-diffusion

安装

  • 第一步

    git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
    
  • 第二步

    ./webui.sh
    
  • 第三步
    将lanch.py 加入到systemctl

    # 在 /usr/lib/systemd/system 下添加stable-diffussion.service
    [Unit]
    Description=The diffusion webui
    
    [Service]
    Type=forking
    PIDFile=/run/diffusion.pid
    User=ai
    ExecStart=/home/ai/cjz/workspace/stable-diffusion-webui/webui.sh
    [Install]
    WantedBy=multi-ser.target
    
  • 开放端口
    启动参数加上 --listen

问题汇总

  • venv

    bash
    apt install puthon3-venv
    python
    import venv python -m venv venv
  • Cannot locate TCMalloc

    sudo apt install --no-install-recommends google-perftools
    
  • no module 'xformers'

    -- 方法一,直接xformers

    pip install xformers
    

    -- 方法二,卸载xformers和torch,并重新安装

    pip uninstall xformers torch
    pip install xformers
    

    -- 方法三

1. go to the webui directory
2. source ./venv/bin/activate
3. cd repositories
4. git clone [https://github.com/facebookresearch/xformers.git](https://github.com/facebookresearch/xformers.git)
5. cd xformers
6. git submodule update --init --recursive
7. pip install -r requirements.txt
8. pip install -e .
  • loading stable diffusion model: FileNotFoundError
    可以去civitai下载模型放到models/stable_diffision目录下

  • 部分模型需要代理,开启代理时需要修改webui.py文件

    shared=True
    
    • 挂上代理之后可能会报错

      # Expecting value: line 1 column 1 (char 0)
      

      解决方法:启动参数加上 --no-gradio-queue
      比如

      python
      python3 launch.py --no-gradio-queue
评论区 (0)
你的临时ID:
暂无评论,来发表第一条评论吧!