pharmapsychotic commited on
Commit
942ef5e
1 Parent(s): 0b077d8

Add usage instructions

Browse files
Files changed (1) hide show
  1. README.md +49 -5
README.md CHANGED
@@ -19,6 +19,13 @@ This repository hosts the TensorRT versions of **Stable Diffusion XL 1.0** creat
19
 
20
  ![examples](./examples.jpg)
21
 
 
 
 
 
 
 
 
22
 
23
  ### Performance Comparison
24
 
@@ -39,9 +46,46 @@ This repository hosts the TensorRT versions of **Stable Diffusion XL 1.0** creat
39
  | H100 | 0.40 images/sec | 0.68 images/sec | ~70% |
40
 
41
 
42
- ### Model Description
43
 
44
- - **Developed by:** Stability AI
45
- - **Model type:** Diffusion-based text-to-image generative model
46
- - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/blob/main/LICENSE.md)
47
- - **Model Description:** This is a conversion of the [SDXL base 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) and [SDXL refiner 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0) models for [NVIDIA TensorRT](https://developer.nvidia.com/tensorrt) optimized inference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  ![examples](./examples.jpg)
21
 
22
+ ### Model Description
23
+
24
+ - **Developed by:** Stability AI
25
+ - **Model type:** Diffusion-based text-to-image generative model
26
+ - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/blob/main/LICENSE.md)
27
+ - **Model Description:** This is a conversion of the [SDXL base 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) and [SDXL refiner 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0) models for [NVIDIA TensorRT](https://developer.nvidia.com/tensorrt) optimized inference
28
+
29
 
30
  ### Performance Comparison
31
 
 
46
  | H100 | 0.40 images/sec | 0.68 images/sec | ~70% |
47
 
48
 
49
+ ### Usage Example
50
 
51
+ 1. Following the [setup instructions](https://github.com/rajeevsrao/TensorRT/blob/release/8.6/demo/Diffusion/README.md) for TensorRT on launching a TensorRT NGC container.
52
+ ```shell
53
+ git clone https://github.com/rajeevsrao/TensorRT.git
54
+ cd TensorRT
55
+ git checkout release/8.6
56
+ docker run --rm -it --gpus all -v $PWD:/workspace nvcr.io/nvidia/pytorch:23.06-py3 /bin/bash
57
+ ```
58
+
59
+ 2. Download the SDXL TensorRT files from this repo
60
+ ```shell
61
+ git lfs install
62
+ git clone https://huggingface.co/stabilityai/stable-diffusion-xl-1.0-tensorrt
63
+ cd stable-diffusion-xl-1.0-tensorrt
64
+ git lfs pull
65
+ cd ..
66
+ ```
67
+
68
+ 3. Install libraries and requirements
69
+ ```shell
70
+ python3 -m pip install --upgrade pip
71
+ python3 -m pip install --upgrade tensorrt
72
+
73
+ export TRT_OSSPATH=/workspace
74
+ cd $TRT_OSSPATH/demo/Diffusion
75
+ pip3 install -r requirements.txt
76
+ ```
77
+
78
+ 4. Perform TensorRT optimized inference
79
+ ```
80
+ python3 demo_txt2img_xl.py \
81
+ "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" \
82
+ --hf-token=<Your HF TOKEN> \
83
+ --build-static-batch \
84
+ --use-cuda-graph \
85
+ --num-warmup-runs 1 \
86
+ --width 1024 \
87
+ --height 1024 \
88
+ --denoising-steps 30 \
89
+ --onnx-base-dir /workspace/stable-diffusion-xl-1.0-tensorrt/sdxl-1.0-base \
90
+ --onnx-refiner-dir /workspace/stable-diffusion-xl-1.0-tensorrt/sdxl-1.0-refiner
91
+ ```