Stable Diffusion is a latent text-to-image diffusion model. More details could be found in Stable Diffusion v1 and Stable Diffusion v2.
please got the main page, and follow the instructions to build and install intel-extension-for-openxla.
Mark intel-extension-for-openxla
folder as <WORKSPACE>, then
cd <WORKSPACE>/example/stable_diffusion/
pip install transformers==4.38 diffusers==0.26.3 datasets==2.20.0 msgpack==1.0.7
pip install -r ../../test/requirements.txt
ENV | Description | PVC Platform | ATSM/DG2 Platform |
---|---|---|---|
ZE_AFFINITY_MASK | Run this model on single GPU tile | export ZE_AFFINITY_MASK=0 | export ZE_AFFINITY_MASK=0 |
XLA_FLAGS | Customize xla debug options | export XLA_FLAGS="--xla_gpu_force_conv_nhwc" | export XLA_FLAGS="--xla_gpu_force_conv_nhwc" |
Model | Output Image Resolution | Command |
---|---|---|
CompVis/stable-diffusion-v1-4 | 512x512 | python jax_stable.py |
stabilityai/stable-diffusion-2 | 768x768 | python jax_stable.py -m stabilityai/stable-diffusion-2 |
stabilityai/stable-diffusion-2-1 | 768x768 | python jax_stable.py -m stabilityai/stable-diffusion-2-1 |
Add option --accuracy
to check whether the demo result is expected. Output range is 0
~1
, higher is better:
python jax_stable.py -m stabilityai/stable-diffusion-2-1 --accuracy
Average Latency per image is: x.xxx s
Average Throughput per second is: x.xxx steps
RMSE accuracy is: 0.976