Closed7

M2 MacBookAirにstable-diffusion-webuiを入れてみる

pomera_15pomera_15

MacBookAirのスペックは以下。

MacBook Air(M2, 2022)
チップ Apple M2
メモリ 8GB
ストレージ 512GB

要求スペックを満たしていないから満足して動作しないと思うが。

pomera_15pomera_15

やったこと

手順2

brew install cmake protobuf rust python@3.10 git wget

手順3

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

手順4

Place Stable Diffusion models/checkpoints you want to use into stable-diffusion->webui/models/Stable-diffusion. If you don't have any, see Downloading Stable Diffusion Models >below.

モデルをwebui/models/Stable-diffusionに置く必要があるらしい。
モデルはここを参照とのこと。
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon#downloading-stable-diffusion-models
Stable DIffusion 1.4 (sd-v1-4.ckpt)を言われた場所に置いてみる。

pomera_15pomera_15

手順5

cd stable-diffusion-webui次に、./webui.shWeb UI を実行します。Python 仮想環境が venv を使用して作成およびアクティブ化され、不足している残りの依存関係が自動的にダウンロードおよびインストールされます。

cd stable-diffusion-webui
./webui.sh

を実行してみる。
http://127.0.0.1:7860/でアプリが立ち上がった。

pomera_15pomera_15

おー、それっぽいのが生成できた!

ただ崩れてしまっている。
モデルを適当に選んだんだけどそれが軽量なやつなのだろうか。
(だからこのスペックのMacで動いた?)

ちゃんとアニメ絵が出力されるモデルを探してみよう。

pomera_15pomera_15

https://bocek.co.jp/media/exercise/stable-diffusion/6500/
今使っているモデルでどこまで戦えるのか知りたいので、こちらの記事を参考に、モデルはそのままでプロンプトをいじってみる。

プロンプト

(masterpiece,best quality:1.4),anime, super fine illustration,shiny skin,detailed skin,detailed face,detailed eyes,an extremely cute and beautiful girl,cowboy shot,beautiful face

ネガティブプロンプト

(worst quality,low quality:2),(painting,sketch,flat color),(nsfw,nude,exposed skin,exposed chest,nipples,naked,bare navel),monochrome,grayscale,ugly face,bad face,bad anatomy,deformed eyes,missing fingers,acnes,skin blemishes

結果こんな感じ。

モデルとプロンプトに引っ張られているのか、リアル寄りになってしまう。
super fine illustrationってプロンプトが悪いのかな。

あと画像を4つ同時に生成したところ10分以上かかった。
MacBookAirがもっさりして重くなった。負荷が凄そうだな……。

pomera_15pomera_15

だいたい分かったのでクローズ。
このMacBookAirでもなんとか画像生成できそう。

このスクラップは2025/01/03にクローズされました