Skip to content

Installation on Intel Silicon

Qiacheng Li edited this page Nov 16, 2023 · 31 revisions

Stable Diffusion WebUI Support (Preview)

Stable Diffusion WebUI can now be run on hardware like Intel CPUs and GPUs (both integrated and discrete Graphics) with Intel® Distribution of OpenVINO™ toolkit. This is a preview support in active development and we actively welcome feedback and contributions from the community.

Important Notes

To achieve the best performance in WebUI on Windows, launch webui-user.bat using the following steps:

  • Launch command prompt as administrator
  • cd to stable-diffusion-webui directory
  • run webui-user.bat

Some features are not supported at the moment with OpenVINO acceleration script:

  • Hires Fix
  • Other custom scripts

Instructions to run WebUI with OpenVINO:

OpenVINO support is provided through a custom script. The custom script uses PyTorch's torch.compile feature and HuggingFace Diffusers library for improved performance. Below are the instructions to get started:

  • If you are familiar with the Automatic1111 workflow, use this fork from OpenVINOToolKit instead of Automatic1111 and follow the instructions. Alternatively, follow the below instructions:

Linux

# Make sure Python version is 3.10+
python -m venv sd_env
source sd_env/bin/activate
git clone https://github.com/openvinotoolkit/stable-diffusion-webui.git
cd stable-diffusion-webui

export PYTORCH_TRACING_MODE=TORCHFX
export COMMANDLINE_ARGS="--skip-torch-cuda-test --precision full --no-half" 

# Launch the WebUI
./webui.sh 
  • After launching the WebUI by running ./webui.sh, Use the OpenVINO custom script by following the instructions here

Windows

git clone https://github.com/openvinotoolkit/stable-diffusion-webui.git
cd stable-diffusion-webui
webui-user.bat
  • Use the OpenVINO custom script by following the instructions here

Notes:

  • The steps above will create a virtual environment and install the required packages into this environment. If you want to use your own virtual environment to run Stable Diffusion WebUI, please update VENV_DIR= lines to VENV_DIR=- in first-time-runner.bat and torch-install.ps1 files.
  • PyTorch doesn't support torch.compile officially on windows yet. Launching torch-install.bat installs PyTorch and enables torch.compile for OpenVINO backend.

Enabling Public Access

To enable public access, please add "--share --listen" arguments into the COMMANLINE_ARGUMENTS variable (On Windows, you can do this by updating webui-user.bat file).

Installation Instructions

Install OpenVINO:

Install from Pypi:

OpenVINO with torch.compile support is now available in preview in the OpenVINO prerelease package. Install the latest prerelease package from using the command pip install --pre openvino

Build and install from source:

OpenVINO can also be built from source using the instructions provided here

Known Issues

  • Changing the sampling method to DPM++ or Karras methods recompiles the model due to some modifications it makes to the graph. It is recommended to exclude the time for first image generation for any performance measurements
  • Regular Stable Diffusion 2.1 has known issues on discrete GPUs at this time. Please use the Stable Diffusion 2.1-base version instead.