Update README.md w/ correct info
Browse filesREADME.md previously had info for SDXL-Turbo instead of SD-Turbo
README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
pipeline_tag: text-to-image
|
| 3 |
license: other
|
| 4 |
license_name: sai-nc-community
|
| 5 |
-
license_link: https://huggingface.co/stabilityai/
|
| 6 |
-
base_model: stabilityai/
|
| 7 |
language:
|
| 8 |
- en
|
| 9 |
tags:
|
|
@@ -14,15 +14,15 @@ tags:
|
|
| 14 |
- text-to-image
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# Stable Diffusion
|
| 18 |
|
| 19 |
## Introduction
|
| 20 |
|
| 21 |
-
This repository hosts the optimized
|
| 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
|
| 26 |
```
|
| 27 |
|
| 28 |
See the [usage instructions](#usage-example) for how to run the SDXL pipeline with the ONNX files hosted in this repository.
|
|
@@ -32,9 +32,24 @@ See the [usage instructions](#usage-example) for how to run the SDXL pipeline wi
|
|
| 32 |
- **Developed by:** Stability AI
|
| 33 |
- **Model type:** Diffusion-based text-to-image generative model
|
| 34 |
- **License:** [STABILITY AI NON-COMMERCIAL RESEARCH COMMUNITY LICENSE](https://huggingface.co/stabilityai/sd-turbo/blob/main/LICENSE)
|
| 35 |
-
- **Model Description:** This is a conversion of the [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
@@ -48,10 +63,10 @@ git clone https://github.com/microsoft/onnxruntime
|
|
| 48 |
cd onnxruntime
|
| 49 |
```
|
| 50 |
|
| 51 |
-
2. Download the
|
| 52 |
```shell
|
| 53 |
git lfs install
|
| 54 |
-
git clone https://huggingface.co/tlwu/
|
| 55 |
```
|
| 56 |
|
| 57 |
3. Launch the docker
|
|
@@ -84,8 +99,8 @@ python3 -m pip install --upgrade polygraphy onnx-graphsurgeon --extra-index-url
|
|
| 84 |
|
| 85 |
6. Perform ONNX Runtime optimized inference
|
| 86 |
```shell
|
| 87 |
-
python3
|
| 88 |
"starry night over Golden Gate Bridge by van gogh" \
|
| 89 |
-
--version
|
| 90 |
-
--engine-dir /workspace/
|
| 91 |
```
|
|
|
|
| 2 |
pipeline_tag: text-to-image
|
| 3 |
license: other
|
| 4 |
license_name: sai-nc-community
|
| 5 |
+
license_link: https://huggingface.co/stabilityai/sd-turbo/blob/main/LICENSE.TXT
|
| 6 |
+
base_model: stabilityai/sd-turbo
|
| 7 |
language:
|
| 8 |
- en
|
| 9 |
tags:
|
|
|
|
| 14 |
- text-to-image
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# Stable Diffusion Turbo for ONNX Runtime CUDA
|
| 18 |
|
| 19 |
## Introduction
|
| 20 |
|
| 21 |
+
This repository hosts the optimized ONNX models of **SD Turbo** to accelerate inference with ONNX Runtime CUDA execution provider for Nvidia GPUs. It cannot run in other providers like CPU and 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.py --provider cuda --model_id stabilityai/sd-turbo --optimize --use_fp16_fixed_vae
|
| 26 |
```
|
| 27 |
|
| 28 |
See the [usage instructions](#usage-example) for how to run the SDXL pipeline with the ONNX files hosted in this repository.
|
|
|
|
| 32 |
- **Developed by:** Stability AI
|
| 33 |
- **Model type:** Diffusion-based text-to-image generative model
|
| 34 |
- **License:** [STABILITY AI NON-COMMERCIAL RESEARCH COMMUNITY LICENSE](https://huggingface.co/stabilityai/sd-turbo/blob/main/LICENSE)
|
| 35 |
+
- **Model Description:** This is a conversion of the [SD-Turbo](https://huggingface.co/stabilityai/sd-turbo) model for [ONNX Runtime](https://github.com/microsoft/onnxruntime) inference with CUDA execution provider.
|
| 36 |
+
|
| 37 |
+
## Performance
|
| 38 |
+
|
| 39 |
+
#### Latency
|
| 40 |
+
|
| 41 |
+
Below is average latency of generating an image of size 512x512 using NVIDIA A100-SXM4-80GB GPU:
|
| 42 |
+
|
| 43 |
+
| Engine | Batch Size | Steps | ONNX Runtime CUDA |
|
| 44 |
+
|-------------|------------|------ | ----------------- |
|
| 45 |
+
| Static | 1 | 1 | 38.2 ms |
|
| 46 |
+
| Static | 4 | 1 | 120.2 ms |
|
| 47 |
+
| Static | 1 | 4 | 68.7 ms |
|
| 48 |
+
| Static | 4 | 4 | 192.6 ms |
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
Static means the engine is built for the given batch size and image size combination, and CUDA graph is used to speed up.
|
| 52 |
|
|
|
|
| 53 |
|
| 54 |
## Usage Example
|
| 55 |
|
|
|
|
| 63 |
cd onnxruntime
|
| 64 |
```
|
| 65 |
|
| 66 |
+
2. Download the ONNX files from this repo
|
| 67 |
```shell
|
| 68 |
git lfs install
|
| 69 |
+
git clone https://huggingface.co/tlwu/sd-turbo-onnxruntime
|
| 70 |
```
|
| 71 |
|
| 72 |
3. Launch the docker
|
|
|
|
| 99 |
|
| 100 |
6. Perform ONNX Runtime optimized inference
|
| 101 |
```shell
|
| 102 |
+
python3 demo_txt2img.py \
|
| 103 |
"starry night over Golden Gate Bridge by van gogh" \
|
| 104 |
+
--version sd-turbo \
|
| 105 |
+
--engine-dir /workspace/sd-turbo-onnxruntime
|
| 106 |
```
|