当前位置:首页 >热点 >如何在无 GPU 的 macOS 上运行 Stable Diffusion 在 macOS 下运行 Stable Diffusion

如何在无 GPU 的 macOS 上运行 Stable Diffusion 在 macOS 下运行 Stable Diffusion

2024-06-30 18:09:58 [百科] 来源:避面尹邢网

如何在无 GPU 的何无 macOS 上运行 Stable Diffusion

作者:陈少文 商务办公 Prompt 有很多的撰写技巧、句式、运行修饰词;Stable Diffusion 也有很多参数可以调整。何无但本篇主要描述的运行是在无 GPU 情况下,在 macOS 下运行 Stable Diffusion,何无因此在此仅输入 bird ,运行进行测试。何无

​1. 运行 Stable Diffusion 推荐配置

  • 内存: 不低于 16 GB DDR4 或 DDR5
  • 存储: 不低于 10 GB 可用空间
  • GPU: 不低于 6 GB 显存 N 卡

如果硬件达不到要求,运行也可以使用各种优化 fork 兼容更低配置的何无硬件,但生成时间会增长。运行

当前的何无开发主机配置为:

如何在无 GPU 的 macOS 上运行 Stable Diffusion 在 macOS 下运行 Stable Diffusion

  • 2.9 GHz 8-Core Intel Core i7
  • 16 GB 2666 MHz DDR4
  • 250 GB SSD

由于没有 GPU,生成图片时,运行需要多等待一会儿。何无

如何在无 GPU 的 macOS 上运行 Stable Diffusion 在 macOS 下运行 Stable Diffusion

2. macOS 上运行 Stable Diffusion

  • 安装 anaconda
brew install --cask anaconda
  • 配置 PATH
echo 'export PATH=/usr/local/anaconda3/bin:$PATH' >> ~/.zshrc
  • conda 初始化 Shell
conda init zsh

这里需要关闭窗口,重新登录 Terminal。何无

如何在无 GPU 的 macOS 上运行 Stable Diffusion 在 macOS 下运行 Stable Diffusion

  • 下载并进入项目目录
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
  • 创建 Python 环境
conda create -n stabel python=3.10.6
  • 激活 Python 环境,并安装依赖
conda activate stabel 
pip3 install -r requirements_versions.txt
  • 下载模型

前往 https://huggingface.co/CompVis/stable-diffusion-v-1-4-original 下载 sd-v1-4.ckpt 或者 sd-v1-4-full-ema.ckpt 文件,放置到 models/Stable-diffusion ⽬录下。huggingface 上也有很多其他模型可以下载使用,也能在线体验。比如 https://huggingface.co/spaces/IDEA-CCNL/Taiyi-Stable-Diffusion-Chinese 。

  • 修改运行参数,跳过 GPU 检测,参考[1]
export COMMANDLINE_ARGS="--lowvram --precision full --no-half --skip-torch-cuda-test"
  • 运行项目
python launch.py

在本地访问 http://127.0.0.1:7860 即可打开 UI。

3. Text-to-Image 测试

Prompt 有很多的撰写技巧、句式、修饰词;Stable Diffusion 也有很多参数可以调整。但本篇主要描述的是在无 GPU 情况下,在 macOS 下运行 Stable Diffusion,因此在此仅输入 bird ,进行测试。生成的图片如下图:

图片

4. 参考

  1. https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1742
责任编辑:武晓燕 来源: 陈少文 GPUmacOSStable

(责任编辑:休闲)

    推荐文章
    热点阅读