当前位置:   article > 正文

Stable Diffusion 本地部署教程_本地部署stable diffusion

本地部署stable diffusion

Stable Diffusion 本地部署教程

安装 git 和 python 3.10.6

  • Newer version of Python does not support torch, checking “Add Python to PATH”
  • 设置 pip 全局镜像
    • pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
    • 清华镜像部分依赖没有,中途会报错 https://pypi.tuna.tsinghua.edu.cn/simple/

下载主程序 Stable Diffusion web UI

  • git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
  • 如果无法访问 github ,可以从 window store 下载 Watt Toolkit 加速器即可访问
  • Readme 中有详细安装步骤

拷贝离线文件到指定路径

  • 基础模型 v1-5-pruned-emaonly.safetensors --> stable-diffusion-webui\models\Stable-diffusion

    • https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main
    • 所有其他的大模型也都放在该路径下
  • clip-vit-large-patch14

    • https://huggingface.co/openai/clip-vit-large-patch14/tree/main

    • 程序根路径下新建 openai 文件夹,把 clip-vit-large-patch14 文件夹复制到 openai

    • stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py 文件运行是会调用 clip-vit-large-patch14,如果本地没有,则会自动联网下载,由于联网会失败所以将报错

      def __init__(self, version="openai/clip-vit-large-patch14", device="cuda", max_length=77,
                       freeze=True, layer="last", layer_idx=None): 
      
      • 1
      • 2

运行 webui-user.bat

  • 运行后会创建虚拟环境,自动下载依赖文件并安装
  • set COMMANDLINE_ARGS= --lowvram --precision full --no-half --skip-torch-cuda-test
    • --lowvram 显卡不行,设置低缓存
    • --skip-torch-cuda-test 上不了网,跳过检查
  • 部分依赖(clip)需要从 github 下载,需要手动下载安装

安装插件

  • 可以将插件文件直接复制到 stable-diffusion-webui\extensions 文件夹下,重启 web 服务即可生效
  • 也可以在 web 中安装:Extensions --> install from URL

常用插件

建筑大模型

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号