ror HF Staff commited on
Commit
d73296f
·
1 Parent(s): 32319bd

error bars

Browse files
Files changed (1) hide show
  1. app.py +37 -2
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import pandas as pd
2
  import gradio as gr
3
  import matplotlib.pyplot as plt
@@ -43,6 +44,26 @@ def create_matplotlib_bar_charts():
43
  ttft_values = data['ttft']
44
  tpot_values = data['tpot']
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  # Define color mapping based on configuration keywords
47
  def get_color_for_config(label):
48
  is_eager = 'eager' in label.lower()
@@ -66,10 +87,17 @@ def create_matplotlib_bar_charts():
66
 
67
  # TTFT Plot (left)
68
  ax1.set_facecolor('#000000')
69
- bars1 = ax1.bar(range(len(labels)), ttft_values,
70
  color=colors, width=1.0, edgecolor='white', linewidth=1,
71
  label=[label[:15] + '...' if len(label) > 15 else label for label in labels])
72
 
 
 
 
 
 
 
 
73
  ax1.set_ylabel('TTFT (seconds)', color='white', fontsize=14)
74
  ax1.set_title('Time to first token (lower is better)', color='white', fontsize=16, pad=20)
75
 
@@ -79,9 +107,16 @@ def create_matplotlib_bar_charts():
79
 
80
  # TPOT Plot (right)
81
  ax2.set_facecolor('#000000')
82
- bars2 = ax2.bar(range(len(labels)), tpot_values,
83
  color=colors, width=1.0, edgecolor='white', linewidth=1)
84
 
 
 
 
 
 
 
 
85
  ax2.set_ylabel('TPOT (seconds)', color='white', fontsize=14)
86
  ax2.set_title('Time per output token (lower is better)', color='white', fontsize=16, pad=20)
87
 
 
1
+ from math import e
2
  import pandas as pd
3
  import gradio as gr
4
  import matplotlib.pyplot as plt
 
44
  ttft_values = data['ttft']
45
  tpot_values = data['tpot']
46
 
47
+ # Calculate error bars (standard deviation) for each configuration
48
+ import numpy as np
49
+ ttft_errors = []
50
+ tpot_errors = []
51
+
52
+ # Get raw data to calculate standard deviations
53
+ raw_data = DATA.data
54
+ for label in labels:
55
+ if label in raw_data:
56
+ # Calculate std dev for TTFT
57
+ ttft_raw = [d['wall_time'] for d in raw_data[label]['ttft']]
58
+ ttft_errors.append(float(np.std(ttft_raw)))
59
+
60
+ # Calculate std dev for TPOT
61
+ tpot_raw = [d['wall_time'] for d in raw_data[label]['tpot']]
62
+ tpot_errors.append(float(np.std(tpot_raw)))
63
+ else:
64
+ ttft_errors.append(0)
65
+ tpot_errors.append(0)
66
+
67
  # Define color mapping based on configuration keywords
68
  def get_color_for_config(label):
69
  is_eager = 'eager' in label.lower()
 
87
 
88
  # TTFT Plot (left)
89
  ax1.set_facecolor('#000000')
90
+ _ = ax1.bar(range(len(labels)), ttft_values,
91
  color=colors, width=1.0, edgecolor='white', linewidth=1,
92
  label=[label[:15] + '...' if len(label) > 15 else label for label in labels])
93
 
94
+ # Add error bars for TTFT
95
+ ax1.errorbar(
96
+ range(len(labels)), ttft_values, yerr=ttft_errors,
97
+ fmt='none', ecolor='white', alpha=0.8,
98
+ elinewidth=1.5, capthick=1.5, capsize=4,
99
+ )
100
+
101
  ax1.set_ylabel('TTFT (seconds)', color='white', fontsize=14)
102
  ax1.set_title('Time to first token (lower is better)', color='white', fontsize=16, pad=20)
103
 
 
107
 
108
  # TPOT Plot (right)
109
  ax2.set_facecolor('#000000')
110
+ _ = ax2.bar(range(len(labels)), tpot_values,
111
  color=colors, width=1.0, edgecolor='white', linewidth=1)
112
 
113
+ # Add error bars for TPOT
114
+ ax2.errorbar(
115
+ range(len(labels)), tpot_values, yerr=tpot_errors,
116
+ fmt='none', ecolor='white', alpha=0.8,
117
+ elinewidth=1.5, capthick=1.5, capsize=4,
118
+ )
119
+
120
  ax2.set_ylabel('TPOT (seconds)', color='white', fontsize=14)
121
  ax2.set_title('Time per output token (lower is better)', color='white', fontsize=16, pad=20)
122