-
Notifications
You must be signed in to change notification settings - Fork 49
Installation on Intel Silicon
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.
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
- 768x768 with SD v1.5
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:
# 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
- Download Git and Python 3.10
git clone https://github.com/openvinotoolkit/stable-diffusion-webui.git
cd stable-diffusion-webui
- Download the validated PyTorch nightly wheel file (2.1.0.dev20230713) from here and drop it into
stable-diffusion-webui
directory - In
stable-diffusion-webui
directory, launchfirst-time-runner.bat
. - After prerequisites are installed, launch
torch-install.bat
. - After installation is completed, launch an admin command prompt and cd to
stable-diffusion-webui
- Run
webui-user.bat
- Use the OpenVINO custom script by following the instructions here
Note: 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.
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).
OpenVINO is integrated as a TorchDynamo backend in PyTorch and can be leveraged using "torch.compile". TorchDynamo is available from PyTorch 2.0 onwards.
Install PyTorch from PyPi using pip install torch
PyTorch doesn't support torch.compile officially on windows yet. Launching torch-install.bat
will install PyTorch and enable torch.compile for OpenVINO backend.
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
OpenVINO can also be built from source using the instructions provided here
- 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.
This is the Stable Diffusion web UI wiki. Wiki Home