Create README
Browse files
README.md
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: text-to-image
|
3 |
+
inference: false
|
4 |
+
license: other
|
5 |
+
license_name: sai-nc-community
|
6 |
+
license_link: https://huggingface.co/stabilityai/sdxl-turbo/blob/main/LICENSE.TXT
|
7 |
+
tags:
|
8 |
+
- tensorrt
|
9 |
+
- sdxl-turbo
|
10 |
+
- text-to-image
|
11 |
+
---
|
12 |
+
|
13 |
+
# SDXL-Turbo Tensorrt
|
14 |
+
## Introduction
|
15 |
+
|
16 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
17 |
+
This repository hosts the TensorRT version of **Stable Diffusion XL Turbo** created in collaboration with [NVIDIA](https://huggingface.co/nvidia). The optimized versions give substantial improvements in speed and efficiency.
|
18 |
+
|
19 |
+
SDXL-Turbo is a fast generative text-to-image model that can synthesize photorealistic images from a text prompt in a single network evaluation.
|
20 |
+
A real-time demo is available here: http://clipdrop.co/stable-diffusion-turbo
|
21 |
+
|
22 |
+
## Model Details
|
23 |
+
|
24 |
+
### Model Description
|
25 |
+
SDXL-Turbo is a distilled version of [SDXL 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0), trained for real-time synthesis.
|
26 |
+
|
27 |
+
- **Developed by:** Stability AI
|
28 |
+
- **Model type:** Generative text-to-image model
|
29 |
+
- **Model Description:** This is a conversion of the [SDXL Turbo](https://huggingface.co/stabilityai/sdxl-turbo)
|
30 |
+
|
31 |
+
|
32 |
+
## Performance
|
33 |
+
#### Timings for 4 steps at 512x512
|
34 |
+
|
35 |
+
| Accelerator | CLIP | Unet | VAE |Total |
|
36 |
+
|-------------|--------------------------|-----------------------------|------------------------|------------------------|
|
37 |
+
| A100 | 1.03 ms | 79.31 ms | 53.69.34 ms | 138.57 ms |
|
38 |
+
| H100 | 0.78 ms | 48.87 ms | 30.35 ms | 83.8 ms |
|
39 |
+
|
40 |
+
|
41 |
+
## Usage Example
|
42 |
+
1. Following the [setup instructions](https://github.com/rajeevsrao/TensorRT/blob/release/9.2/demo/Diffusion/README.md) on launching a TensorRT NGC container.
|
43 |
+
```shell
|
44 |
+
git clone https://github.com/rajeevsrao/TensorRT.git
|
45 |
+
cd TensorRT
|
46 |
+
git checkout release/9.2
|
47 |
+
docker run --rm -it --gpus all -v $PWD:/workspace nvcr.io/nvidia/pytorch:23.11-py3 /bin/bash
|
48 |
+
```
|
49 |
+
|
50 |
+
2. Download the SDXL LCM TensorRT files from this repo
|
51 |
+
```shell
|
52 |
+
git lfs install
|
53 |
+
git clone https://huggingface.co/stabilityai/sdxl-turbo-tensorrt
|
54 |
+
cd sdxl-turbo-tensorrt
|
55 |
+
git lfs pull
|
56 |
+
cd ..
|
57 |
+
```
|
58 |
+
|
59 |
+
3. Install libraries and requirements
|
60 |
+
```shell
|
61 |
+
cd demo/Diffusion
|
62 |
+
python3 -m pip install --upgrade pip
|
63 |
+
pip3 install -r requirements.txt
|
64 |
+
python3 -m pip install --pre --upgrade --extra-index-url https://pypi.nvidia.com tensorrt
|
65 |
+
```
|
66 |
+
|
67 |
+
4. Perform TensorRT optimized inference:
|
68 |
+
|
69 |
+
- **SDXL Turbo**
|
70 |
+
|
71 |
+
Works best for 512x512 images and EulerA scheduler. The first invocation produces plan files in --engine-dir specific to the accelerator being run on and are reused for later invocations.
|
72 |
+
```
|
73 |
+
python3 demo_txt2img_xl.py \
|
74 |
+
""Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"" \
|
75 |
+
--version=xl-turbo \
|
76 |
+
--onnx-dir /workspace/sdxl-turbo-tensorrt/ \
|
77 |
+
--engine-dir /workspace/sdxl-turbo-tensorrt/engine \
|
78 |
+
--denoising-steps 4 \
|
79 |
+
--guidance-scale 0.0 \
|
80 |
+
--seed 42 \
|
81 |
+
--width 512 \
|
82 |
+
--height 512
|
83 |
+
```
|