Windows 11環境でのStable Diffusion WebUI構築とIntel CPU対応方法

前提条件と基本設定

Windows 11上でStable Diffusion WebUIを動作させる場合、特にIntel CPUを搭載したマシンではCUDA非対応のため、OpenVINOまたはIPEXを活用した代替実行環境が必要です。以下の手順に従って環境を構築してください。

Anaconda環境の構築

公式サイトから64ビットインストーラーをダウンロードし、以下のパスをシステム環境変数に追加します:

C:\ProgramData\anaconda3
C:\ProgramData\anaconda3\Scripts
C:\ProgramData\anaconda3\Library\bin

次に、Python 3.10.6用の仮想環境を作成します:

conda create --name sd_webui python=3.10.6 --yes
conda activate sd_webui

高速ダウンロード設定

国内ミラーを設定することでダウンロード速度を向上させます。.condarcファイルに以下を追加:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

pipの設定ファイル(%APPDATA%\pip\pip.ini)に:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

リポジトリ取得とモデル配置

公式リポジトリをクローンします:

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

モデルファイルを直接ダウンロードし、models/Stable-diffusion/ディレクトリに配置します。例:

v1-5-pruned-emaonly.safetensors

Intel CPU向けOpenVINO実行手順

Intelハードウェア向けの専用リポジトリを使用します:

git clone https://github.com/openvinotoolkit/stable-diffusion-webui
cd stable-diffusion-webui
set PYTORCH_TRACING_MODE=TORCHFX
set COMMANDLINE_ARGS=--skip-torch-cuda-test --precision full
webui-user.bat

OpenVINOでは以下に注意が必要です:

  • DPM++やKarrasサンプリング方法を使用するとモデル再コンパイルが発生
  • Stable Diffusion 2.1はベース版でのみ動作可能
  • 一部のカスタムスクリプトは非対応

IPEXによるGPUアクセラレーション

秋葉aaaki氏提供の起動ツールでIntel Arc GPUのサポートが可能です。ただし、現在は公開ミラーに未反映のため、公式リポジトリからIPEXパッケージを手動で取得する必要があります。

タグ: stable-diffusion OpenVINO Intel conda PIP

7月2日 00:12 投稿