update doc
Browse files
README.md
CHANGED
@@ -14,11 +14,13 @@ tags:
|
|
14 |
- text-to-image
|
15 |
---
|
16 |
|
17 |
-
# Stable Diffusion XL Turbo for ONNX Runtime
|
18 |
|
19 |
## Introduction
|
20 |
|
21 |
-
This repository hosts the optimized
|
|
|
|
|
22 |
```
|
23 |
python stable_diffusion_xl.py --provider cuda --model_id stabilityai/sdxl-turbo --optimize --use_fp16_fixed_vae
|
24 |
```
|
@@ -34,26 +36,6 @@ See the [usage instructions](#usage-example) for how to run the SDXL pipeline wi
|
|
34 |
|
35 |
The VAE decoder is converted from [sdxl-vae-fp16-fix](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix). There are slight discrepancies between its output and that of the original VAE, but the decoded images should be [close enough for most purposes](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/discussions/7#64c5c0f8e2e5c94bd04eaa80).
|
36 |
|
37 |
-
The Canny control net is converted from [diffusers/controlnet-canny-sdxl-1.0](https://huggingface.co/diffusers/controlnet-canny-sdxl-1.0).
|
38 |
-
|
39 |
-
## Performance Comparison
|
40 |
-
|
41 |
-
#### Latency for SDXL-Turbo
|
42 |
-
|
43 |
-
Below is average latency of generating an image of size 512x512 using NVIDIA A100-SXM4-80GB GPU:
|
44 |
-
|
45 |
-
| Engine | Batch Size | Steps | PyTorch 2.1 + Diffusers | ONNX Runtime Demo |
|
46 |
-
|-------------|------------|------ | ----------------|-------------------|
|
47 |
-
| Static | 1 | 1 | 109.4 ms | 49.5 ms |
|
48 |
-
| Static | 4 | 1 | 247.0 ms | 143.1 ms |
|
49 |
-
| Static | 1 | 4 | 171.1 ms | 104.1 ms |
|
50 |
-
| Static | 4 | 4 | 390.5 ms | 271.69 ms |
|
51 |
-
|
52 |
-
|
53 |
-
Static means the engine is built for the given batch size and image size combination, and CUDA graph is used to speed up.
|
54 |
-
|
55 |
-
For PyTorch 2.1, the UNet use channel last (NHWC) format, and compile the UNet with mode `reduce-overhead`. See [benchmark script](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/python/tools/transformers/models/stable_diffusion/benchmark_controlnet.py) for detail.
|
56 |
-
|
57 |
## Usage Example
|
58 |
|
59 |
Following the [demo instructions](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/python/tools/transformers/models/stable_diffusion/README.md#run-demo-with-docker). Example steps:
|
|
|
14 |
- text-to-image
|
15 |
---
|
16 |
|
17 |
+
# Stable Diffusion XL Turbo for ONNX Runtime CUDA
|
18 |
|
19 |
## Introduction
|
20 |
|
21 |
+
This repository hosts the optimized onnx models of **SDXL Turbo** to accelerate inference with ONNX Runtime CUDA execution provider for Nvidia GPUs. It cannot run in other providers like CPU or DirectML.
|
22 |
+
|
23 |
+
The models are generated by [Olive](https://github.com/microsoft/Olive/tree/main/examples/stable_diffusion) with command like the following:
|
24 |
```
|
25 |
python stable_diffusion_xl.py --provider cuda --model_id stabilityai/sdxl-turbo --optimize --use_fp16_fixed_vae
|
26 |
```
|
|
|
36 |
|
37 |
The VAE decoder is converted from [sdxl-vae-fp16-fix](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix). There are slight discrepancies between its output and that of the original VAE, but the decoded images should be [close enough for most purposes](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/discussions/7#64c5c0f8e2e5c94bd04eaa80).
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
## Usage Example
|
40 |
|
41 |
Following the [demo instructions](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/python/tools/transformers/models/stable_diffusion/README.md#run-demo-with-docker). Example steps:
|