patrickvonplaten
commited on
Commit
•
58b66fd
1
Parent(s):
403db3e
up
Browse files- plot_bench.py +47 -26
plot_bench.py
CHANGED
@@ -1,36 +1,59 @@
|
|
1 |
#!/usr/bin/env python3
|
2 |
import matplotlib.pyplot as plt
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
-
|
6 |
-
"A100": [4.75, 3.26, 3.24, 3.10], # those values are made up
|
7 |
-
"A10": [13.94, 9.81, 10.01, 9.35],
|
8 |
-
"T4": [38.81, 30.09, 29.74, 27.55],
|
9 |
-
"V100": [9.84, 8.16, 8.09, 7.65],
|
10 |
-
"3090": [10.04, 7.82, 7.89, 7.47],
|
11 |
-
"3090TI": [9.07, 7.14, 7.15, 6.81],
|
12 |
-
}
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
-
|
|
|
|
|
|
|
24 |
|
25 |
methods = {
|
26 |
-
"Vanilla Attention": [x[0] for x in batch_sizes.values()],
|
27 |
-
"xFormers": [x[1] for x in batch_sizes.values()],
|
28 |
-
"PyTorch2.0 SDPA": [x[2] for x in batch_sizes.values()],
|
29 |
-
"SDPA + torch.compile": [x[3] for x in batch_sizes.values()],
|
30 |
}
|
31 |
|
32 |
-
x = np.arange(len(
|
33 |
-
width = 0.
|
34 |
multiplier = 0
|
35 |
|
36 |
fig, ax = plt.subplots(constrained_layout=True)
|
@@ -38,14 +61,12 @@ fig, ax = plt.subplots(constrained_layout=True)
|
|
38 |
for attribute, measurement in methods.items():
|
39 |
offset = width * multiplier
|
40 |
rects = ax.bar(x + offset, measurement, width, label=attribute)
|
41 |
-
ax.bar_label(rects, padding=3)
|
42 |
multiplier += 1
|
43 |
|
44 |
# Add some text for labels, title and custom x-axis tick labels, etc.
|
45 |
ax.set_ylabel('Time (s)')
|
46 |
-
ax.set_title('Inference Speed at Batch Size=
|
47 |
-
ax.set_xticks(x + width,
|
48 |
ax.legend(loc='upper left')
|
49 |
-
ax.set_ylim(0, 250)
|
50 |
|
51 |
plt.show()
|
|
|
1 |
#!/usr/bin/env python3
|
2 |
import matplotlib.pyplot as plt
|
3 |
import numpy as np
|
4 |
+
import seaborn as sns
|
5 |
|
6 |
+
sns.set(font_scale=1.1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
batch_sizes = {
|
9 |
+
"fp16_4": {
|
10 |
+
"A100": [4.75, 3.26, 3.24, 3.10], # those values are made up
|
11 |
+
"A10": [13.94, 9.81, 10.01, 9.35],
|
12 |
+
"T4": [38.81, 30.09, 29.74, 27.55],
|
13 |
+
"V100": [9.84, 8.16, 8.09, 7.65],
|
14 |
+
"3090": [10.04, 7.82, 7.89, 7.47],
|
15 |
+
"3090TI": [9.07, 7.14, 7.15, 6.81],
|
16 |
+
},
|
17 |
+
"fp16_16": {
|
18 |
+
"A100": [18.95, 13.57, 13.67, 12.25],
|
19 |
+
"A10": [0, 37.55, 38.31, 36.81],
|
20 |
+
"T4": [0, 111.47, 113.26, 106.93],
|
21 |
+
"V100": [0, 30.29, 29.84, 28.22],
|
22 |
+
"3090": [0, 29.06, 29.06, 28.2],
|
23 |
+
"3090TI": [0, 26.1, 26.28, 25.46],
|
24 |
+
},
|
25 |
+
"fp32_4": {
|
26 |
+
"A100": [16.56, 12.42, 12.2, 11.84],
|
27 |
+
"A10": [34.77, 27.63, 22.77, 22.07],
|
28 |
+
"T4": [0, 85.72, 85.78, 84.48],
|
29 |
+
"V100": [0, 25.73, 25.31, 24.7],
|
30 |
+
"3090": [22.69, 21.45, 18.67, 18.09],
|
31 |
+
"3090TI": [20.32, 19.31, 16.9, 16.37],
|
32 |
+
},
|
33 |
+
"fp32_16": {
|
34 |
+
"A100": [0, 47.08, 46.27, 44.8],
|
35 |
+
"A10": [0, 116.49, 88.56, 86.64],
|
36 |
+
"T4": [0, 276.47, 280.26, 270.93], # numbers are made up
|
37 |
+
"V100": [0, 84.99, 84.73, 82.55],
|
38 |
+
"3090": [0, 85.35, 72.37, 70.25],
|
39 |
+
"3090TI": [0, 75.37, 65.25, 64.32],
|
40 |
+
},
|
41 |
}
|
42 |
|
43 |
+
batch_size = 16
|
44 |
+
dtype = "fp32"
|
45 |
+
|
46 |
+
key = f"{dtype}_{batch_size}"
|
47 |
|
48 |
methods = {
|
49 |
+
"Vanilla Attention": [x[0] for x in batch_sizes[key].values()],
|
50 |
+
"xFormers": [x[1] for x in batch_sizes[key].values()],
|
51 |
+
"PyTorch2.0 SDPA": [x[2] for x in batch_sizes[key].values()],
|
52 |
+
"SDPA + torch.compile": [x[3] for x in batch_sizes[key].values()],
|
53 |
}
|
54 |
|
55 |
+
x = np.arange(len(batch_sizes[key])) # the label locations
|
56 |
+
width = 0.1 # the width of the bars
|
57 |
multiplier = 0
|
58 |
|
59 |
fig, ax = plt.subplots(constrained_layout=True)
|
|
|
61 |
for attribute, measurement in methods.items():
|
62 |
offset = width * multiplier
|
63 |
rects = ax.bar(x + offset, measurement, width, label=attribute)
|
|
|
64 |
multiplier += 1
|
65 |
|
66 |
# Add some text for labels, title and custom x-axis tick labels, etc.
|
67 |
ax.set_ylabel('Time (s)')
|
68 |
+
ax.set_title(f'Inference Speed at Batch Size={batch_size} for {dtype}')
|
69 |
+
ax.set_xticks(x + width, batch_sizes[key])
|
70 |
ax.legend(loc='upper left')
|
|
|
71 |
|
72 |
plt.show()
|