画像生成AI

Stable Diffusion web UI インストール手順 (Mac)

Stable Diffusion とは?

Stable Diffusion は、テキストから高品質な画像を生成できるオープンソースの AI モデルです。機械学習技術を活用し、画像生成の分野で注目されています。特に、自由度の高いカスタマイズや、ユーザーの好みに応じたプロンプト入力による画像生成が可能であり、多くのクリエイターや研究者に利用されています。

このモデルは、ローカル環境で動作させることができ、インターネット接続なしでも利用できるため、プライバシーを重視した画像生成にも適しています。Stable Diffusion web UI を使用することで、コーディング不要で直感的に操作できるインターフェースを提供します。

前提条件

本記事では以下の Mac 環境を前提としています。

~> sw_vers
ProductName:       macOS
ProductVersion:    15.3
BuildVersion:      24D60

~> uname -m
arm64

1. 必要な依存関係をインストール

Homebrew のインストール (未インストールの場合)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Python、Git、wget、cmake、protobuf、Rust のインストール

brew install [email protected] git wget cmake protobuf rust

2. Python 3.10を使用するように設定

export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
python3.10 --version  # バージョン確認

3. インストールディレクトリの作成と移動

mkdir -p ~/stable-diffusion-webui && cd ~/stable-diffusion-webui

4. Stable Diffusion web UI のダウンロード

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

5. Web UI の実行スクリプトをダウンロード

wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
chmod +x webui.sh

6. Stable Diffusion モデルのダウンロード

Stable Diffusion を動作させるには .ckpt または .safetensors のモデルファイルが必要です。

モデルは Hugging Face からダウンロードできます。

推奨モデル:

ダウンロードしたモデルファイルは stable-diffusion-webui/models/Stable-diffusion/ に配置してください。

mkdir -p stable-diffusion-webui/models/Stable-diffusion
mv /path/to/downloaded/model.ckpt stable-diffusion-webui/models/Stable-diffusion/

7. Web UI の起動

./webui.sh

8. Web UI のアクセス

インストールが成功すると、Web UI は http://127.0.0.1:7860  でアクセス可能になります。

stable diffusion web ui


参考Stable Diffusion Web UI Installation on Apple Silicon