Skip to content

Commit 26c5f29

Browse files
committed
benchmarks: add tiny vae for sd/sdxl
1 parent 0490f69 commit 26c5f29

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Running on an A100 80G SXM hosted at [fal.ai](https://fal.ai).
1313
|------------------|----------|------------|---------|---------|--------------|
1414
| Diffusers (torch 2.1, xformers) | 1.758s | 1.759s | 1.746s | 1.772s | 28.43 it/s |
1515
| Diffusers (torch 2.1, SDPA) | 1.591s | 1.590s | 1.581s | 1.601s | 31.44 it/s |
16+
| Diffusers (torch 2.1, SDPA, [tiny VAE](https://github.com/madebyollin/taesd))\* | 1.562s | 1.556s | 1.544s | 1.591s | 32.14 it/s |
1617
| Diffusers (torch 2.1, SDPA, compiled) | 1.352s | 1.351s | 1.348s | 1.356s | 37.01 it/s |
1718
| Diffusers (torch 2.1, SDPA, compiled, NCHW channels last) | 1.066s | 1.065s | 1.062s | 1.076s | 46.95 it/s |
1819
| OneFlow | 0.951s | 0.953s | 0.941s | 0.957s | 52.48 it/s |
@@ -22,6 +23,7 @@ Running on an A100 80G SXM hosted at [fal.ai](https://fal.ai).
2223
| | mean (s) | median (s) | min (s) | max (s) | speed (it/s) |
2324
|------------------|----------|------------|---------|---------|--------------|
2425
| Diffusers (torch 2.1, SDPA) | 5.933s | 5.933s | 5.924s | 5.943s | 8.43 it/s |
26+
| Diffusers (torch 2.1, SDPA, [tiny VAE](https://github.com/madebyollin/taesd))\* | 5.748s | 5.746s | 5.734s | 5.776s | 8.70 it/s |
2527
| Diffusers (torch 2.1, xformers) | 5.724s | 5.724s | 5.714s | 5.731s | 8.74 it/s |
2628
| Diffusers (torch 2.1, SDPA, compiled) | 5.246s | 5.247s | 5.233s | 5.259s | 9.53 it/s |
2729
| Diffusers (torch 2.1, SDPA, compiled, NCHW channels last) | 5.132s | 5.132s | 5.121s | 5.142s | 9.74 it/s |
@@ -36,6 +38,7 @@ Generation options:
3638
- For SD1.5, the width/height is 512x512 (the default); for SDXL, the width/height is 1024x1024.
3739
- For all other options, the defaults from the generation systems are used.
3840
- Weights are always half-precision (fp16) unless otherwise specified.
41+
- Generation on benchmarks with a `*`/`**` means the used techniques might lead to quality degradation but the underlying model is still the same.
3942

4043
Environments (like torch and other library versions) for each benchmark are defined
4144
under [benchmarks/](benchmarks/) folder.

artifacts/latest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"settings": {"warmup_iterations": 3, "benchmark_iterations": 10}, "parameters": {"prompt": "A photo of a cat", "steps": 50}, "timings": [{"name": "Diffusers (torch 2.1, SDPA)", "category": "SD1.5 (End-to-end)", "timings": [1.5917212970089167, 1.5975631090113893, 1.5821007050108165, 1.5864128279790748, 1.5813008210097905, 1.588955162995262, 1.583035584015306, 1.5979954930080567, 1.6009252599906176, 1.5956080609757919]}, {"name": "Diffusers (torch 2.1, xformers)", "category": "SD1.5 (End-to-end)", "timings": [1.7560910189931747, 1.7572659730212763, 1.7597715989977587, 1.7469689899880905, 1.763645778002683, 1.748716948000947, 1.7602629070170224, 1.7721076029993128, 1.7460152900021058, 1.7701677379955072]}, {"name": "Diffusers (torch 2.1, SDPA, compiled)", "category": "SD1.5 (End-to-end)", "timings": [1.356168844999047, 1.354804383998271, 1.3516721340129152, 1.3500280909938738, 1.3562533959920984, 1.3556265980005264, 1.3505920349853113, 1.3477569509996101, 1.3498703970108181, 1.3481854719866533]}, {"name": "Diffusers (torch 2.1, SDPA, compiled, NCHW channels last)", "category": "SD1.5 (End-to-end)", "timings": [1.0672315989795607, 1.0727007249952294, 1.0632865040097386, 1.0763663580000866, 1.06514667099691, 1.065665372996591, 1.0638107580016367, 1.0616009290097281, 1.0649084030010272, 1.063036303006811]}, {"name": "Diffusers (torch 2.1, SDPA)", "category": "SDXL (End-to-end)", "timings": [5.940763157996116, 5.926704184006667, 5.932992869988084, 5.940833892993396, 5.923987179005053, 5.938259807007853, 5.923574882996036, 5.930732762994012, 5.942996845988091, 5.932096109987469]}, {"name": "Diffusers (torch 2.1, xformers)", "category": "SDXL (End-to-end)", "timings": [5.728389803000027, 5.7223248230002355, 5.713896728004329, 5.7198221340077, 5.716055455995956, 5.730836973001715, 5.725524671986932, 5.730034602980595, 5.726219657983165, 5.722418188001029]}, {"name": "Diffusers (torch 2.1, SDPA, compiled)", "category": "SDXL (End-to-end)", "timings": [5.233289741008775, 5.24713467201218, 5.235783365002135, 5.239803472999483, 5.251854731992353, 5.242411447019549, 5.250333832023898, 5.259196978004184, 5.247713554999791, 5.255097048007883]}, {"name": "Diffusers (torch 2.1, SDPA, compiled, NCHW channels last)", "category": "SDXL (End-to-end)", "timings": [5.12098954099929, 5.122773736016825, 5.130043459008448, 5.131235945009394, 5.132947302015964, 5.1301643929909915, 5.13384268200025, 5.141838512994582, 5.139718485996127, 5.141162898013135]}, {"name": "TensorRT 9.0 (cuda graphs, static shapes)", "category": "SD1.5 (End-to-end)", "timings": [0.819957683008397, 0.8171751589979976, 0.8198997500003316, 0.8168765410082415, 0.8175504659884609, 0.817866342025809, 0.8211427440110128, 0.8207452670030762, 0.8174457829736639, 0.8177875310066156]}, {"name": "TensorRT 9.0 (cuda graphs, static shapes)", "category": "SDXL (End-to-end)", "timings": [4.099050192977302, 4.091173734981567, 4.09869981801603, 4.100261182000395, 4.1056046999874525, 4.1030455399886705, 4.104289636015892, 4.105645445990376, 4.1050181849859655, 4.106528664997313]}, {"name": "OneFlow", "category": "SD1.5 (End-to-end)", "timings": [0.9568120219919365, 0.9468847009993624, 0.9545126229932066, 0.9472718389879446, 0.9552929110068362, 0.9412291230109986, 0.9544001989997923, 0.9557115529896691, 0.9509655799774919, 0.9482630330021493]}, {"name": "OneFlow", "category": "SDXL (End-to-end)", "timings": [4.586631373997079, 4.61347366499831, 4.600411992985755, 4.6092570440087, 4.611457958992105, 4.604861573025119, 4.602566407003906, 4.624956093000947, 4.615925558988238, 4.580915530998027]}]}
1+
{"settings": {"warmup_iterations": 3, "benchmark_iterations": 10}, "parameters": {"prompt": "A photo of a cat", "steps": 50}, "timings": [{"name": "Diffusers (torch 2.1, SDPA)", "category": "SD1.5 (End-to-end)", "timings": [1.5917212970089167, 1.5975631090113893, 1.5821007050108165, 1.5864128279790748, 1.5813008210097905, 1.588955162995262, 1.583035584015306, 1.5979954930080567, 1.6009252599906176, 1.5956080609757919]}, {"name": "Diffusers (torch 2.1, SDPA, [tiny VAE](https://github.com/madebyollin/taesd))\\*", "category": "SD1.5 (End-to-end)", "timings": [1.562345665995963, 1.5535877529764548, 1.5727124799741432, 1.5913520029862411, 1.584301869967021, 1.5461461240192875, 1.557934220007155, 1.5496932759997435, 1.553419985983055, 1.5442492840229534]}, {"name": "Diffusers (torch 2.1, xformers)", "category": "SD1.5 (End-to-end)", "timings": [1.7560910189931747, 1.7572659730212763, 1.7597715989977587, 1.7469689899880905, 1.763645778002683, 1.748716948000947, 1.7602629070170224, 1.7721076029993128, 1.7460152900021058, 1.7701677379955072]}, {"name": "Diffusers (torch 2.1, SDPA, compiled)", "category": "SD1.5 (End-to-end)", "timings": [1.356168844999047, 1.354804383998271, 1.3516721340129152, 1.3500280909938738, 1.3562533959920984, 1.3556265980005264, 1.3505920349853113, 1.3477569509996101, 1.3498703970108181, 1.3481854719866533]}, {"name": "Diffusers (torch 2.1, SDPA, compiled, NCHW channels last)", "category": "SD1.5 (End-to-end)", "timings": [1.0672315989795607, 1.0727007249952294, 1.0632865040097386, 1.0763663580000866, 1.06514667099691, 1.065665372996591, 1.0638107580016367, 1.0616009290097281, 1.0649084030010272, 1.063036303006811]}, {"name": "Diffusers (torch 2.1, SDPA)", "category": "SDXL (End-to-end)", "timings": [5.940763157996116, 5.926704184006667, 5.932992869988084, 5.940833892993396, 5.923987179005053, 5.938259807007853, 5.923574882996036, 5.930732762994012, 5.942996845988091, 5.932096109987469]}, {"name": "Diffusers (torch 2.1, SDPA, [tiny VAE](https://github.com/madebyollin/taesd))\\*", "category": "SDXL (End-to-end)", "timings": [5.733747632999439, 5.7373922020196915, 5.739806508005131, 5.7549302889965475, 5.754676963028032, 5.745761024008971, 5.751321510004345, 5.776052331959363, 5.744757027016021, 5.746225669980049]}, {"name": "Diffusers (torch 2.1, xformers)", "category": "SDXL (End-to-end)", "timings": [5.728389803000027, 5.7223248230002355, 5.713896728004329, 5.7198221340077, 5.716055455995956, 5.730836973001715, 5.725524671986932, 5.730034602980595, 5.726219657983165, 5.722418188001029]}, {"name": "Diffusers (torch 2.1, SDPA, compiled)", "category": "SDXL (End-to-end)", "timings": [5.233289741008775, 5.24713467201218, 5.235783365002135, 5.239803472999483, 5.251854731992353, 5.242411447019549, 5.250333832023898, 5.259196978004184, 5.247713554999791, 5.255097048007883]}, {"name": "Diffusers (torch 2.1, SDPA, compiled, NCHW channels last)", "category": "SDXL (End-to-end)", "timings": [5.12098954099929, 5.122773736016825, 5.130043459008448, 5.131235945009394, 5.132947302015964, 5.1301643929909915, 5.13384268200025, 5.141838512994582, 5.139718485996127, 5.141162898013135]}, {"name": "TensorRT 9.0 (cuda graphs, static shapes)", "category": "SD1.5 (End-to-end)", "timings": [0.819957683008397, 0.8171751589979976, 0.8198997500003316, 0.8168765410082415, 0.8175504659884609, 0.817866342025809, 0.8211427440110128, 0.8207452670030762, 0.8174457829736639, 0.8177875310066156]}, {"name": "TensorRT 9.0 (cuda graphs, static shapes)", "category": "SDXL (End-to-end)", "timings": [4.099050192977302, 4.091173734981567, 4.09869981801603, 4.100261182000395, 4.1056046999874525, 4.1030455399886705, 4.104289636015892, 4.105645445990376, 4.1050181849859655, 4.106528664997313]}, {"name": "OneFlow", "category": "SD1.5 (End-to-end)", "timings": [0.9568120219919365, 0.9468847009993624, 0.9545126229932066, 0.9472718389879446, 0.9552929110068362, 0.9412291230109986, 0.9544001989997923, 0.9557115529896691, 0.9509655799774919, 0.9482630330021493]}, {"name": "OneFlow", "category": "SDXL (End-to-end)", "timings": [4.586631373997079, 4.61347366499831, 4.600411992985755, 4.6092570440087, 4.611457958992105, 4.604861573025119, 4.602566407003906, 4.624956093000947, 4.615925558988238, 4.580915530998027]}]}

benchmarks/benchmark_diffusers.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def diffusers_any(
2525
enable_xformers: bool = False,
2626
use_compile: bool = False,
2727
use_nchw_channels: bool = False,
28+
tiny_vae: str = None,
2829
) -> BenchmarkResults:
2930
# Some of these functionality might not be available in torch 2.1,
3031
# but setting just in case if in the future we upgrade to a newer
@@ -33,13 +34,19 @@ def diffusers_any(
3334
os.environ["TORCHINDUCTOR_FX_GRAPH_CACHE"] = "1"
3435

3536
import torch
36-
from diffusers import DiffusionPipeline
37+
from diffusers import AutoencoderTiny, DiffusionPipeline
3738

3839
pipeline = DiffusionPipeline.from_pretrained(
3940
model_name,
4041
torch_dtype=torch.float16,
4142
use_safetensors=True,
4243
)
44+
if tiny_vae:
45+
pipeline.vae = AutoencoderTiny.from_pretrained(
46+
tiny_vae,
47+
torch_dtype=torch.float16,
48+
)
49+
4350
pipeline.to("cuda")
4451

4552
# Use XFormers memory efficient attention instead of Torch SDPA
@@ -74,6 +81,15 @@ def diffusers_any(
7481
"model_name": "runwayml/stable-diffusion-v1-5",
7582
},
7683
},
84+
{
85+
"name": r"Diffusers (torch 2.1, SDPA, [tiny VAE](https://github.com/madebyollin/taesd))\*",
86+
"category": "SD1.5 (End-to-end)",
87+
"function": diffusers_any,
88+
"kwargs": {
89+
"model_name": "runwayml/stable-diffusion-v1-5",
90+
"tiny_vae": "madebyollin/taesd",
91+
},
92+
},
7793
{
7894
"name": "Diffusers (torch 2.1, xformers)",
7995
"category": "SD1.5 (End-to-end)",
@@ -110,6 +126,15 @@ def diffusers_any(
110126
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
111127
},
112128
},
129+
{
130+
"name": r"Diffusers (torch 2.1, SDPA, [tiny VAE](https://github.com/madebyollin/taesd))\*",
131+
"category": "SDXL (End-to-end)",
132+
"function": diffusers_any,
133+
"kwargs": {
134+
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
135+
"tiny_vae": "madebyollin/taesdxl",
136+
},
137+
},
113138
{
114139
"name": "Diffusers (torch 2.1, xformers)",
115140
"category": "SDXL (End-to-end)",

0 commit comments

Comments
 (0)