Skip to content

Mac 安装 stable-diffusion

笔者所使用设备 Mac mini(macOS Ventura),如读者你是 window 请自行谷歌 window 安装 stable-diffusion 教程。

笔者不会python,也不会机器学习,安装过程可能不是最佳的方式,但是能跑起来(hh)。

环境准备

安装python

笔者的操作不一定是最佳实践

我这里使用安装包傻瓜式的一键安装,从官网下载 python 3.16.0 安装包

打开下载好的安装包,无脑选择下一步即可

安装完后打开终端输入,查看 python 版本

sh
python3 --version

这里可以在~/.zshrc中设置一个别名python,方便后续使用

sh
alias python=python3

安装 stable-diffusion-webui

clone 项目到本地

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

克隆完成后进入项目目录

sh
cd stable-diffusion-webui

安装项目依赖(此过程会持续一段时间)

sh
pip install -r requirements.txt

启动项目

sh
./webui.sh

访问 http://127.0.0.1:7860/ 即可应用的内容

配置 stable-diffusion-webui

汉化

为了方便后续的使用我们可以将 stable-diffusion-webui 汉化一下

使用插件stable-diffusion-webui-chinese

安装操作路径: Extensions => URL for extension's git repository => Install

输入插件地址:https://github.com/VinsonLaro/stable-diffusion-webui-chinese,点击Install即可

紧接着应用插件:Installed => Apply and restart UI

设置汉化:Settings => User Interface => Localization => Apply Settings => Reload UI

推荐使用中英对照,方便观看部分英文教程

再次访问即可看到英文汉化的内容

安装插件

由于网络问题可能会出现访问失败的情况,如下图所示

这里可以使用笔者的CV下来的配置https://script.sugarat.top/json/sd.json

或者浏览器访问链接资源,将其下载到本地,本地启动一个服务(比如使用http-server

sh
npx http-server

url设置为http://127.0.0.1:8080/sd.json即可,点击 加载 即可看到插件列表

例如 安装 sd-webui-controlnet3D Openpose Editor

搜索controlnet,找到相应的插件,点击 Installed 即可

在已安装列表即可看到安装的插件

重启后即可看到刚安装的插件生效了

安装模型

C 站https://civitai.com/ 下载(需要科学上网工具才能访问)

比如 ChilloutMix 模型

点击下载

导入下载的模型到目录 models/Stable-diffusion

然后重启服务或者点击刷新

简单使用

可以直接 Copy 其它用户分享到C站上的提示词

比如下面这个例子

查看大图时滑到右下角

或者缩略图右下角的 “i”

下面实操使用一下上面的提示词

我这里把步数调成了30

txt
extremely detailed CG uniform 8k illustrations, high color substitution, sketches graffiti art, illustrations photo, masterpiece, hyper detailed, best quality, ultra high res, high resolution, (intricate details), perfect lighting, best shadow, (graffiti wall:1.4), 1 girl, (extremely detailed face and eyes), (shiny big eyes), (shiny graffiti long hair:1.2), ((colorful)), ((colorful illustrations)), face focus, lip gloss, random eyes color,
txt
by bad-picture-chill-75v, nude, porn, nipples, pussy, pornography, canvas frame, cartoon, 3d, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), wierd colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy, 3d render, background blur, (blurred background),  (briefs), (triangle pants), watermark, astigmatism, scattered light, lens astigmatism, chest light, shiny boobs, glowing boobs, halo, fog, hazy,
txt
DPM++ SDE Karras
txt
30
txt
9

最后效果如下