badaoui HF Staff commited on
Commit
a9eacdc
·
1 Parent(s): 76e6276

Remove unused files to reduce code size

Browse files

- Delete logos/amd_logo.png and logos/nvidia_logo.png (not needed with text labels)
- Delete time_series.py (316 lines) - unused matplotlib version
- Keep time_series_gradio.py which uses Plotly and is actually used
- Total reduction: ~340 lines of unused code

Files changed (3) hide show
  1. logos/amd_logo.png +0 -0
  2. logos/nvidia_logo.png +0 -0
  3. time_series.py +0 -316
logos/amd_logo.png DELETED
Binary file (61.7 kB)
 
logos/nvidia_logo.png DELETED
Binary file (94.6 kB)
 
time_series.py DELETED
@@ -1,316 +0,0 @@
1
- import matplotlib.pyplot as plt
2
- import pandas as pd
3
- import numpy as np
4
- from datetime import datetime
5
- from data import extract_model_data
6
-
7
- COLORS = {
8
- 'passed': '#4CAF50',
9
- 'failed': '#E53E3E',
10
- 'skipped': '#FFD54F',
11
- 'error': '#8B0000',
12
- 'amd': '#ED1C24',
13
- 'nvidia': '#76B900'
14
- }
15
-
16
- FIGURE_WIDTH = 20
17
- FIGURE_HEIGHT = 12
18
-
19
- BLACK = '#000000'
20
- LABEL_COLOR = '#CCCCCC'
21
- TITLE_COLOR = '#FFFFFF'
22
- GRID_COLOR = '#333333'
23
-
24
- TITLE_FONT_SIZE = 24
25
- LABEL_FONT_SIZE = 14
26
- LEGEND_FONT_SIZE = 12
27
-
28
-
29
- def create_time_series_summary(historical_df: pd.DataFrame) -> plt.Figure:
30
- if historical_df.empty or 'date' not in historical_df.columns:
31
- fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
32
- ax.set_facecolor(BLACK)
33
- ax.text(0.5, 0.5, 'No historical data available',
34
- horizontalalignment='center', verticalalignment='center',
35
- transform=ax.transAxes, fontsize=20, color='#888888',
36
- fontfamily='monospace', weight='normal')
37
- ax.axis('off')
38
- return fig
39
-
40
- historical_df['date_dt'] = pd.to_datetime(historical_df['date'])
41
- historical_df = historical_df.sort_values('date_dt')
42
-
43
- daily_stats = []
44
- dates = []
45
-
46
- for date in historical_df['date_dt'].unique():
47
- date_data = historical_df[historical_df['date_dt'] == date]
48
-
49
- total_amd_passed = total_amd_failed = total_amd_skipped = 0
50
- total_nvidia_passed = total_nvidia_failed = total_nvidia_skipped = 0
51
-
52
- for _, row in date_data.iterrows():
53
- amd_stats, nvidia_stats = extract_model_data(row)[:2]
54
-
55
- total_amd_passed += amd_stats['passed']
56
- total_amd_failed += amd_stats['failed']
57
- total_amd_skipped += amd_stats['skipped']
58
- total_nvidia_passed += nvidia_stats['passed']
59
- total_nvidia_failed += nvidia_stats['failed']
60
- total_nvidia_skipped += nvidia_stats['skipped']
61
-
62
- amd_total = total_amd_passed + total_amd_failed
63
- nvidia_total = total_nvidia_passed + total_nvidia_failed
64
-
65
- amd_failure_rate = (total_amd_failed / amd_total * 100) if amd_total > 0 else 0
66
- nvidia_failure_rate = (total_nvidia_failed / nvidia_total * 100) if nvidia_total > 0 else 0
67
-
68
- daily_stats.append({
69
- 'amd_failure_rate': amd_failure_rate,
70
- 'nvidia_failure_rate': nvidia_failure_rate,
71
- 'amd_passed': total_amd_passed,
72
- 'amd_failed': total_amd_failed,
73
- 'amd_skipped': total_amd_skipped,
74
- 'nvidia_passed': total_nvidia_passed,
75
- 'nvidia_failed': total_nvidia_failed,
76
- 'nvidia_skipped': total_nvidia_skipped
77
- })
78
- dates.append(date)
79
-
80
- fig = plt.figure(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT + 4), facecolor=BLACK)
81
- gs = fig.add_gridspec(3, 2, height_ratios=[1.2, 1, 1], width_ratios=[2, 1],
82
- hspace=0.3, wspace=0.25)
83
-
84
- ax1 = fig.add_subplot(gs[0, :])
85
- ax2 = fig.add_subplot(gs[1, 0])
86
- ax3 = fig.add_subplot(gs[2, 0])
87
- ax4 = fig.add_subplot(gs[1:, 1])
88
-
89
- for ax in [ax1, ax2, ax3, ax4]:
90
- ax.set_facecolor(BLACK)
91
-
92
- dates_array = np.array(dates)
93
- amd_rates = [stat['amd_failure_rate'] for stat in daily_stats]
94
- nvidia_rates = [stat['nvidia_failure_rate'] for stat in daily_stats]
95
-
96
- ax1.fill_between(dates_array, 0, amd_rates, color=COLORS['amd'], alpha=0.15)
97
- ax1.fill_between(dates_array, 0, nvidia_rates, color=COLORS['nvidia'], alpha=0.15)
98
- ax1.plot(dates_array, amd_rates, color=COLORS['amd'], linewidth=3,
99
- label='AMD', marker='o', markersize=7, markeredgewidth=2, markeredgecolor=BLACK)
100
- ax1.plot(dates_array, nvidia_rates, color=COLORS['nvidia'], linewidth=3,
101
- label='NVIDIA', marker='s', markersize=7, markeredgewidth=2, markeredgecolor=BLACK)
102
-
103
- if len(amd_rates) > 2:
104
- z_amd = np.polyfit(range(len(amd_rates)), amd_rates, 1)
105
- p_amd = np.poly1d(z_amd)
106
- ax1.plot(dates_array, p_amd(range(len(amd_rates))),
107
- color=COLORS['amd'], linestyle='--', alpha=0.5, linewidth=2)
108
-
109
- z_nvidia = np.polyfit(range(len(nvidia_rates)), nvidia_rates, 1)
110
- p_nvidia = np.poly1d(z_nvidia)
111
- ax1.plot(dates_array, p_nvidia(range(len(nvidia_rates))),
112
- color=COLORS['nvidia'], linestyle='--', alpha=0.5, linewidth=2)
113
-
114
- ax1.set_title('Overall Failure Rates Over Time', fontsize=TITLE_FONT_SIZE,
115
- color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=20)
116
- ax1.set_ylabel('Failure Rate (%)', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
117
- ax1.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
118
- ax1.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
119
- labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
120
- ax1.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE, axis='x', rotation=45)
121
-
122
- amd_passed = [stat['amd_passed'] for stat in daily_stats]
123
- amd_failed = [stat['amd_failed'] for stat in daily_stats]
124
- amd_skipped = [stat['amd_skipped'] for stat in daily_stats]
125
-
126
- ax2.stackplot(dates_array, amd_passed, amd_failed, amd_skipped,
127
- colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
128
- alpha=0.8, labels=['Passed', 'Failed', 'Skipped'])
129
-
130
- ax2.set_title('AMD Test Results', fontsize=TITLE_FONT_SIZE - 2,
131
- color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=15)
132
- ax2.set_ylabel('Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
133
- ax2.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
134
- ax2.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE - 1, axis='x', rotation=45)
135
-
136
- nvidia_passed = [stat['nvidia_passed'] for stat in daily_stats]
137
- nvidia_failed = [stat['nvidia_failed'] for stat in daily_stats]
138
- nvidia_skipped = [stat['nvidia_skipped'] for stat in daily_stats]
139
-
140
- ax3.stackplot(dates_array, nvidia_passed, nvidia_failed, nvidia_skipped,
141
- colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
142
- alpha=0.8, labels=['Passed', 'Failed', 'Skipped'])
143
-
144
- ax3.set_title('NVIDIA Test Results', fontsize=TITLE_FONT_SIZE - 2,
145
- color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=15)
146
- ax3.set_ylabel('Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
147
- ax3.set_xlabel('Date', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
148
- ax3.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
149
- ax3.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE - 1, axis='x', rotation=45)
150
-
151
- latest = daily_stats[-1]
152
- metrics = [
153
- ('Latest AMD Failure Rate', f"{latest['amd_failure_rate']:.1f}%", COLORS['amd']),
154
- ('Latest NVIDIA Failure Rate', f"{latest['nvidia_failure_rate']:.1f}%", COLORS['nvidia']),
155
- ('', '', None),
156
- ('Total AMD Tests', str(latest['amd_passed'] + latest['amd_failed'] + latest['amd_skipped']), '#888888'),
157
- ('Total NVIDIA Tests', str(latest['nvidia_passed'] + latest['nvidia_failed'] + latest['nvidia_skipped']), '#888888'),
158
- ]
159
-
160
- ax4.axis('off')
161
- y_pos = 0.9
162
- ax4.text(0.5, 0.95, 'SUMMARY', ha='center', va='top', fontsize=TITLE_FONT_SIZE - 2,
163
- color=TITLE_COLOR, fontfamily='monospace', fontweight='bold',
164
- transform=ax4.transAxes)
165
-
166
- for label, value, color in metrics:
167
- if label:
168
- ax4.text(0.1, y_pos, label, ha='left', va='center', fontsize=LABEL_FONT_SIZE,
169
- color=LABEL_COLOR, fontfamily='monospace', transform=ax4.transAxes)
170
- ax4.text(0.9, y_pos, value, ha='right', va='center', fontsize=LABEL_FONT_SIZE + 2,
171
- color=color or LABEL_COLOR, fontfamily='monospace', fontweight='bold',
172
- transform=ax4.transAxes)
173
- y_pos -= 0.15
174
-
175
- handles = [plt.Rectangle((0,0),1,1, fc=COLORS['passed'], alpha=0.8),
176
- plt.Rectangle((0,0),1,1, fc=COLORS['failed'], alpha=0.8),
177
- plt.Rectangle((0,0),1,1, fc=COLORS['skipped'], alpha=0.8)]
178
- ax4.legend(handles, ['Passed', 'Failed', 'Skipped'],
179
- loc='lower center', fontsize=LEGEND_FONT_SIZE,
180
- frameon=False, labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
181
-
182
- plt.close('all')
183
- return fig
184
-
185
-
186
- def create_model_time_series(historical_df: pd.DataFrame, model_name: str) -> plt.Figure:
187
- if historical_df.empty or 'date' not in historical_df.columns:
188
- fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
189
- ax.set_facecolor(BLACK)
190
- ax.text(0.5, 0.5, f'No historical data available for {model_name}',
191
- horizontalalignment='center', verticalalignment='center',
192
- transform=ax.transAxes, fontsize=20, color='#888888',
193
- fontfamily='monospace', weight='normal')
194
- ax.axis('off')
195
- return fig
196
-
197
- model_data = historical_df[historical_df.index.str.lower() == model_name.lower()]
198
-
199
- if model_data.empty:
200
- fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
201
- ax.set_facecolor(BLACK)
202
- ax.text(0.5, 0.5, f'No data found for model: {model_name}',
203
- horizontalalignment='center', verticalalignment='center',
204
- transform=ax.transAxes, fontsize=20, color='#888888',
205
- fontfamily='monospace', weight='normal')
206
- ax.axis('off')
207
- return fig
208
-
209
- model_data = model_data.copy()
210
- model_data['date_dt'] = pd.to_datetime(model_data['date'])
211
- model_data = model_data.sort_values('date_dt')
212
-
213
- dates = model_data['date_dt'].values
214
- amd_stats_list = []
215
- nvidia_stats_list = []
216
-
217
- for _, row in model_data.iterrows():
218
- amd_stats, nvidia_stats = extract_model_data(row)[:2]
219
- amd_stats_list.append(amd_stats)
220
- nvidia_stats_list.append(nvidia_stats)
221
-
222
- fig = plt.figure(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
223
- gs = fig.add_gridspec(2, 2, height_ratios=[1, 1], width_ratios=[3, 1],
224
- hspace=0.3, wspace=0.2)
225
-
226
- ax1 = fig.add_subplot(gs[0, 0])
227
- ax2 = fig.add_subplot(gs[1, 0])
228
- ax3 = fig.add_subplot(gs[:, 1])
229
-
230
- for ax in [ax1, ax2, ax3]:
231
- ax.set_facecolor(BLACK)
232
-
233
- amd_passed = [stats['passed'] for stats in amd_stats_list]
234
- amd_failed = [stats['failed'] for stats in amd_stats_list]
235
- amd_skipped = [stats['skipped'] for stats in amd_stats_list]
236
-
237
- ax1.stackplot(dates, amd_passed, amd_failed, amd_skipped,
238
- colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
239
- alpha=0.7, labels=['Passed', 'Failed', 'Skipped'])
240
-
241
- ax1.plot(dates, amd_failed, color=COLORS['failed'], linewidth=2.5,
242
- marker='o', markersize=7, markeredgewidth=2, markeredgecolor=BLACK,
243
- linestyle='-', label='_nolegend_')
244
-
245
- ax1.set_title(f'{model_name.upper()} - AMD Results', fontsize=TITLE_FONT_SIZE,
246
- color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=20)
247
- ax1.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
248
- ax1.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
249
- ax1.legend(fontsize=LEGEND_FONT_SIZE, loc='upper left', frameon=False,
250
- labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
251
- ax1.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE, axis='x', rotation=45)
252
-
253
- nvidia_passed = [stats['passed'] for stats in nvidia_stats_list]
254
- nvidia_failed = [stats['failed'] for stats in nvidia_stats_list]
255
- nvidia_skipped = [stats['skipped'] for stats in nvidia_stats_list]
256
-
257
- ax2.stackplot(dates, nvidia_passed, nvidia_failed, nvidia_skipped,
258
- colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
259
- alpha=0.7, labels=['Passed', 'Failed', 'Skipped'])
260
-
261
- ax2.plot(dates, nvidia_failed, color=COLORS['failed'], linewidth=2.5,
262
- marker='s', markersize=7, markeredgewidth=2, markeredgecolor=BLACK,
263
- linestyle='-', label='_nolegend_')
264
-
265
- ax2.set_title(f'{model_name.upper()} - NVIDIA Results', fontsize=TITLE_FONT_SIZE,
266
- color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=20)
267
- ax2.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
268
- ax2.set_xlabel('Date', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
269
- ax2.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
270
- ax2.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE, axis='x', rotation=45)
271
-
272
- ax3.axis('off')
273
- latest_amd = amd_stats_list[-1]
274
- latest_nvidia = nvidia_stats_list[-1]
275
-
276
- amd_total = latest_amd['passed'] + latest_amd['failed']
277
- nvidia_total = latest_nvidia['passed'] + latest_nvidia['failed']
278
- amd_fail_rate = (latest_amd['failed'] / amd_total * 100) if amd_total > 0 else 0
279
- nvidia_fail_rate = (latest_nvidia['failed'] / nvidia_total * 100) if nvidia_total > 0 else 0
280
-
281
- ax3.text(0.5, 0.95, 'LATEST RESULTS', ha='center', va='top',
282
- fontsize=TITLE_FONT_SIZE - 4, color=TITLE_COLOR, fontfamily='monospace',
283
- fontweight='bold', transform=ax3.transAxes)
284
-
285
- y = 0.80
286
- sections = [
287
- ('AMD', [
288
- ('Pass Rate', f"{(latest_amd['passed']/amd_total*100) if amd_total > 0 else 0:.1f}%", COLORS['passed']),
289
- ('Fail Rate', f"{amd_fail_rate:.1f}%", COLORS['failed']),
290
- ('Total', str(latest_amd['passed'] + latest_amd['failed'] + latest_amd['skipped']), '#888888'),
291
- ]),
292
- ('NVIDIA', [
293
- ('Pass Rate', f"{(latest_nvidia['passed']/nvidia_total*100) if nvidia_total > 0 else 0:.1f}%", COLORS['passed']),
294
- ('Fail Rate', f"{nvidia_fail_rate:.1f}%", COLORS['failed']),
295
- ('Total', str(latest_nvidia['passed'] + latest_nvidia['failed'] + latest_nvidia['skipped']), '#888888'),
296
- ])
297
- ]
298
-
299
- for section_name, metrics in sections:
300
- ax3.text(0.5, y, section_name, ha='center', va='center',
301
- fontsize=LABEL_FONT_SIZE + 2, color=TITLE_COLOR,
302
- fontfamily='monospace', fontweight='bold', transform=ax3.transAxes)
303
- y -= 0.08
304
-
305
- for label, value, color in metrics:
306
- ax3.text(0.15, y, label, ha='left', va='center',
307
- fontsize=LABEL_FONT_SIZE - 1, color=LABEL_COLOR,
308
- fontfamily='monospace', transform=ax3.transAxes)
309
- ax3.text(0.85, y, value, ha='right', va='center',
310
- fontsize=LABEL_FONT_SIZE, color=color,
311
- fontfamily='monospace', fontweight='bold', transform=ax3.transAxes)
312
- y -= 0.07
313
- y -= 0.05
314
-
315
- plt.close('all')
316
- return fig