【英文】MacOS部署AI绘画模型

Preface

Deploying AI painting models on MacOS

Download the Project

1
2
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui

Download the Model

  • Put the downloaded .safetensors file into the stable-diffusion-webui/models/Stable-diffusion directory.

Start WebUI

1
./webui.sh

Pitfalls

  • Error: ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.

Cause

  • Using a network proxy.

Solution

  • Modify line 80 of stable-diffusion-webui/webui.py from share=cmd_opts.share, to share=True,
1
2
app, local_url, share_url = shared.demo.launch(
share=True,

Pitfalls

  • Error:
1
ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`

Cause

  • Using SOCKS proxy, but the socksio package is not installed.

Solution

  • Disable SOCKS proxy.

Pitfalls

  • Error: RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'

Cause

  • MacOS does not support half precision.

Solution

  • Disable half precision by using the --no-half argument when starting.

  • Modify line 13 of the webui-macos-env.sh file, and add the --no-half argument.

1
export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate --no-half"

Generate AI Paintings

  • Enter prompts to generate AI paintings.

English prompts are preferred to avoid misinterpretation by AI.
Multiple keywords should be separated by ,.
For prompt phrases with multiple words, enclose them in parentheses ().

Completion

References

Bing’s Blog
Zhihu - AIGC LLM Practitioner