Mac安装Stable Diffusion

第一步:安装anaconda

Free Download

第二步:下载代码

# 创建虚拟环境sdtest1
conda create -n sdtest1 python=3.10
# 激活虚拟环境sdtest1
conda activate sdtest1
# 下载代码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
# 也可以使用代理下载
git clone https://ghproxy.com/https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

第三步:pip设置镜像源

国内常用的镜像源如下所示

清华: https://pypi.tuna.tsinghua.edu.cn/simple
阿里云: http://mirrors.aliyun.com/pypi/simple/
中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣: http://pypi.douban.com/simple/

# pip设置阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

第四步:安装依赖

# 进入 stable-diffusion-webui 目录
pip install -r requirements_versions.txt
pip install -r requirements.txt

我在安装依赖时一直卡在下面地方很久都不动

Preparing metadata (setup.py) ... -

通过使用--verbose来显示安装过程中出现的错误信息

pip install -r requirements_versions.txt --verbose
pip install -r requirements.txt --verbose

然后看到如下错误

Collecting basicsr==1.4.2 (from -r requirements_versions.txt (line 4))
  Using cached https://mirrors.aliyun.com/pypi/packages/86/41/00a6b000f222f0fa4c6d9e1d6dcc9811a374cabb8abb9d408b77de39648c/basicsr-1.4.2.tar.gz (172 kB)
  Running command python setup.py egg_info
  /Users/lizhencheng/lzc/app/anaconda/anaconda3/envs/test/lib/python3.10/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
  !!

          ********************************************************************************
          Requirements should be satisfied by a PEP 517 installer.
          If you are using pip, you can try `pip install --use-pep517`.
          ********************************************************************************

  !!
    dist.fetch_build_eggs(dist.setup_requires)

根据错误提示,重新安装即可

第五步:启动准备

启动时会去GitHub下载东西,可以设置下代理。

stable-diffusion-webui/modules/launch_utils.py中的https://github.com替换成https://ghproxy.com/https://github.com

手动下载模型v1-5-pruned-emaonly.safetensors,大概有4G左右,下载地址如下:
https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors

将下载好的模型放到目录:stable-diffusion-webui/models/Stable-diffusion

第六步:启动项目

# 可以通过--port指定端口
python launch.py --skip-torch-cuda-test --precision full --no-half --api

相关教程

Stable Diffusion2.1+WebUI的安装与使用

Mac环境 Stable Diffusion Web Ui 安装教程

AI图片生成Stable Diffusion环境搭建与运行

调用Stable Diffusion API 接口

GitHub Proxy

开源的建筑模型

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
青葱年少的头像青葱年少普通用户
上一篇 2023年12月28日
下一篇 2023年12月28日

相关推荐