0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows11 + Intel Arc B580でStable Diffusionを動かしたい!

Posted at

前提

この記事は筆者の備忘録です.
Stable Diffusion(SD.Next)が動作する所まで.

環境

物理

  • OS: Debian12
  • CPU: Ryzen9 7945HX(16c32t)
  • MEM: DDR5 5200 64GB96GB
  • iGPU: Radeon 610M
  • dGPU: Intel Arc B580

仮想環境

  • OS: Windows11(24H2)
  • CPU Ryzen9 7945HX(4vCPU)
  • MEM: 16GB
  • iGPU: VirtIO GPU DOD Controller
  • dGPU: Intel Arc B580(GPUパススルー)

作業

事前作業

  • Intel GPUの最新版ドライバを仮想マシンにインストールしておきます.
  • Intel oneAPI Base Toolkitを仮想マシンに入れておきます.

インストール作業

  • Powershellで外部スクリプトの実行ポリシーを変更します(安全な環境のPCでのみ, この作業をします).
PS c:\Users\<YourUserName>> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
  • pyenvをインストールします
PS c:\Users\<YourUserName>> Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
  • Pythonを3.10.6にダウングレードします.
PS c:\Users\<YourUserName>> pyenv install 3.10.6
PS c:\Users\<YourUserName>> pyenv global 3.10.6
  • Stable Diffusion用の仮想環境(venv)を作ります.
PS c:\Users\<YourUserName>> python -m venv venv --clear
PS c:\Users\<YourUserName>> python -m venv venv
  • Intel oneAPI用Pythonモジュールを(必要ない気がするけど)仮想マシンに入れておきます.
PS c:\Users\<YourUserName>> pip install https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torch-2.0.0a0+gite9ebda2-cp310-cp310-win_amd64.whl
PS c:\Users\<YourUserName>> pip install https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl
PS c:\Users\<YourUserName>> pip install https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/intel_extension_for_pytorch-2.0.110+gitc6ea20b-cp310-cp310-win_amd64.whl
  • Stable Diffusion(SD.Next)をインストールします.
PS c:\Users\<YourUserName>> git clone https://github.com/vladmandic/automatic.git
PS c:\Users\<YourUserName>> cd automatic
PS c:\Users\<YourUserName>\automatic> python -m venv venv

起動を円滑化するためのバッチファイル作成

  • バッチファイルを作成し, 適当なディレクトリ(例えばデスクトップ)に配置します.
SD.Next.bat
cd c:\Users\<YourUserName>\automatic
call .\venv\Scripts\activate
.\webui.bat --use-ipex

起動

  • バッチファイルをダブルクリックします.

運用

  • 使用したいモデルをSD.Nextの案内に従ってダウンロードしてください.
  • プロンプトは各自後自由に.

感想

  • Intel ArcシリーズでStable Diffusionを動かす方法は, 以前より格段に簡単になっていた.
  • 比較対象がGeForce GTX TITAN X(Maxwell/12GB)で, しかもCPUも異なるし何なら1年前の話になるので大分不公平ではあるが, 画像1枚を生成する時間が1/4になった(60秒 -> 15秒)一方, 画像の解像度はピクセル数で約4倍(512x512 -> 768x1152)に上げることが出来た.
  • 起動を円滑化するためのバッチファイル作成にやや手間取った(そのまま素直に実行コマンドを並べただけでは, 実行して直ぐにウィンドウが閉じてしまうので. callすることで閉じられずに実行される).
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?