ror HF Staff commited on
Commit
c7954ca
Β·
1 Parent(s): c8a335c

Version 0.1

Browse files
Files changed (1) hide show
  1. app.py +134 -13
app.py CHANGED
@@ -1,8 +1,16 @@
1
  import matplotlib.pyplot as plt
 
2
  import numpy as np
3
 
4
  import gradio as gr
5
 
 
 
 
 
 
 
 
6
 
7
  # Sample test results with test names
8
  MODELS = {
@@ -50,6 +58,9 @@ MODELS = {
50
  }
51
  }
52
 
 
 
 
53
  def plot_model_stats(model_name: str) -> tuple[plt.Figure, str, str]:
54
  """Draws a pie chart of model's passed, failed, skipped, and error stats."""
55
  model_stats = MODELS[model_name]
@@ -131,7 +142,7 @@ def plot_model_stats(model_name: str) -> tuple[plt.Figure, str, str]:
131
 
132
  # Device label closer to chart and bigger
133
  ax.set_title(device_label,
134
- fontsize=28, weight='bold', pad=2, color='#FFFFFF',
135
  fontfamily='monospace')
136
 
137
  # Create both pie charts with device labels
@@ -146,22 +157,47 @@ def plot_model_stats(model_name: str) -> tuple[plt.Figure, str, str]:
146
 
147
  # Add central shared title for model name
148
  fig.suptitle(f'{model_name.lower()}',
149
- fontsize=32, weight='normal', color='#CCCCCC',
150
  fontfamily='monospace', y=0.95)
151
 
152
  # Clean layout with padding and space for central title
153
  plt.tight_layout()
154
  plt.subplots_adjust(top=0.85, wspace=0.4) # Added wspace for padding between charts
155
 
156
- # Generate separate failed tests info for AMD and NVIDIA
157
- amd_failed = model_stats['amd']['failed']
158
- nvidia_failed = model_stats['nvidia']['failed']
 
 
 
 
 
159
 
160
- amd_failed_info = "Fails on AMD:"
161
- amd_failed_info += "\n" + "─" * len(amd_failed_info) + "\n" + ("\n".join(amd_failed) if amd_failed else "None")
 
 
 
 
 
 
 
 
 
 
162
 
163
- nvidia_failed_info = "Fails on NVIDIA:"
164
- nvidia_failed_info += "\n" + "─" * len(nvidia_failed_info) + "\n" + ("\n".join(nvidia_failed) if nvidia_failed else "None")
 
 
 
 
 
 
 
 
 
 
165
 
166
  return fig, amd_failed_info, nvidia_failed_info
167
 
@@ -292,10 +328,69 @@ dark_theme_css = """
292
  border-color: #666666 !important;
293
  }
294
 
295
- /* Plot container */
296
  .plot-container {
297
  background-color: #000000 !important;
298
  border: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  }
300
 
301
  /* Text elements */
@@ -367,6 +462,8 @@ h1, h2, h3, p, .markdown {
367
  resize: none !important;
368
  scrollbar-width: thin !important;
369
  scrollbar-color: #333333 #000000 !important;
 
 
370
  }
371
 
372
  /* WebKit scrollbar styling for failed tests */
@@ -387,10 +484,24 @@ h1, h2, h3, p, .markdown {
387
  background-color: #555555 !important;
388
  }
389
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  .failed-tests {
391
  background-color: #000000 !important;
392
  height: 220px !important;
393
  max-height: 220px !important;
 
 
394
  }
395
 
396
  .failed-tests .gr-textbox {
@@ -398,8 +509,18 @@ h1, h2, h3, p, .markdown {
398
  border: none !important;
399
  height: 200px !important;
400
  max-height: 200px !important;
 
 
 
 
 
 
 
 
401
  }
402
 
 
 
403
  /* JavaScript to reset scroll position */
404
  .scroll-reset {
405
  animation: resetScroll 0.1s ease;
@@ -448,7 +569,7 @@ with gr.Blocks(title="Model Test Results Dashboard", css=dark_theme_css) as demo
448
  with gr.Row():
449
  with gr.Column(scale=1):
450
  amd_failed_tests_output = gr.Textbox(
451
- value="Fails on AMD:\n────────────\nnetwork_timeout\ngpu_initialization\nmemory_overflow",
452
  lines=8,
453
  max_lines=8,
454
  interactive=False,
@@ -457,7 +578,7 @@ with gr.Blocks(title="Model Test Results Dashboard", css=dark_theme_css) as demo
457
  )
458
  with gr.Column(scale=1):
459
  nvidia_failed_tests_output = gr.Textbox(
460
- value="Fails on NVIDIA:\n────────────────\ndistributed\nmulti_gpu\ndriver_conflict",
461
  lines=8,
462
  max_lines=8,
463
  interactive=False,
@@ -472,7 +593,7 @@ with gr.Blocks(title="Model Test Results Dashboard", css=dark_theme_css) as demo
472
  outputs=[plot_output, amd_failed_tests_output, nvidia_failed_tests_output]
473
  ).then(
474
  fn=None,
475
- js="() => { setTimeout(() => { document.querySelectorAll('textarea').forEach(t => { if (t.closest('.failed-tests')) { t.scrollTo({ top: 0, behavior: 'smooth' }); } }); }, 100); }"
476
  )
477
 
478
  # Initialize with the first model
 
1
  import matplotlib.pyplot as plt
2
+ import matplotlib
3
  import numpy as np
4
 
5
  import gradio as gr
6
 
7
+ # Configure matplotlib to prevent memory warnings and set dark background
8
+ matplotlib.rcParams['figure.max_open_warning'] = 0
9
+ matplotlib.rcParams['figure.facecolor'] = '#000000'
10
+ matplotlib.rcParams['axes.facecolor'] = '#000000'
11
+ matplotlib.rcParams['savefig.facecolor'] = '#000000'
12
+ plt.ioff() # Turn off interactive mode to prevent figure accumulation
13
+
14
 
15
  # Sample test results with test names
16
  MODELS = {
 
58
  }
59
  }
60
 
61
+ def generate_underlined_line(text: str) -> str:
62
+ return text + "\n" + "─" * len(text) + "\n"
63
+
64
  def plot_model_stats(model_name: str) -> tuple[plt.Figure, str, str]:
65
  """Draws a pie chart of model's passed, failed, skipped, and error stats."""
66
  model_stats = MODELS[model_name]
 
142
 
143
  # Device label closer to chart and bigger
144
  ax.set_title(device_label,
145
+ fontsize=28, weight='normal', pad=2, color='#FFFFFF',
146
  fontfamily='monospace')
147
 
148
  # Create both pie charts with device labels
 
157
 
158
  # Add central shared title for model name
159
  fig.suptitle(f'{model_name.lower()}',
160
+ fontsize=32, weight='bold', color='#CCCCCC',
161
  fontfamily='monospace', y=0.95)
162
 
163
  # Clean layout with padding and space for central title
164
  plt.tight_layout()
165
  plt.subplots_adjust(top=0.85, wspace=0.4) # Added wspace for padding between charts
166
 
167
+ # Generate separate failed tests info for AMD and NVIDIA with exclusive/common separation
168
+ amd_failed = set(model_stats['amd']['failed'])
169
+ nvidia_failed = set(model_stats['nvidia']['failed'])
170
+
171
+ # Find exclusive and common failures
172
+ amd_exclusive = amd_failed - nvidia_failed
173
+ nvidia_exclusive = nvidia_failed - amd_failed
174
+ common_failures = amd_failed & nvidia_failed
175
 
176
+ # Build AMD info
177
+ amd_failed_info = ""
178
+ if not amd_exclusive and not common_failures:
179
+ msg = "Error(s) detected" if model_stats["amd"]["error"] else "No failures"
180
+ amd_failed_info += generate_underlined_line(msg)
181
+ if amd_exclusive:
182
+ amd_failed_info += generate_underlined_line("Failures on AMD (exclusive):")
183
+ amd_failed_info += "\n".join(sorted(amd_exclusive))
184
+ amd_failed_info += "\n\n" if common_failures else ""
185
+ if common_failures:
186
+ amd_failed_info += generate_underlined_line("Failures on AMD (common):")
187
+ amd_failed_info += "\n".join(sorted(common_failures))
188
 
189
+ # Build NVIDIA info
190
+ nvidia_failed_info = ""
191
+ if not nvidia_exclusive and not common_failures:
192
+ msg = "Error(s) detected" if model_stats["nvidia"]["error"] else "No failures"
193
+ nvidia_failed_info += generate_underlined_line(msg)
194
+ if nvidia_exclusive:
195
+ nvidia_failed_info += generate_underlined_line("Failures on NVIDIA (exclusive):")
196
+ nvidia_failed_info += "\n".join(sorted(nvidia_exclusive))
197
+ nvidia_failed_info += "\n\n" if common_failures else ""
198
+ if common_failures:
199
+ nvidia_failed_info += generate_underlined_line("Failures on NVIDIA (common):")
200
+ nvidia_failed_info += "\n".join(sorted(common_failures))
201
 
202
  return fig, amd_failed_info, nvidia_failed_info
203
 
 
328
  border-color: #666666 !important;
329
  }
330
 
331
+ /* Plot container with smooth transitions */
332
  .plot-container {
333
  background-color: #000000 !important;
334
  border: none !important;
335
+ transition: opacity 0.6s ease-in-out !important;
336
+ }
337
+
338
+ /* Gradio plot component styling */
339
+ .gr-plot {
340
+ background-color: #000000 !important;
341
+ transition: opacity 0.6s ease-in-out !important;
342
+ }
343
+
344
+ .gr-plot .gradio-plot {
345
+ background-color: #000000 !important;
346
+ transition: opacity 0.6s ease-in-out !important;
347
+ }
348
+
349
+ .gr-plot img {
350
+ transition: opacity 0.6s ease-in-out !important;
351
+ }
352
+
353
+ /* Target the plot wrapper */
354
+ div[data-testid="plot"] {
355
+ background-color: #000000 !important;
356
+ }
357
+
358
+ /* Target all possible plot containers */
359
+ .plot-container img,
360
+ .gr-plot img,
361
+ .gradio-plot img {
362
+ background-color: #000000 !important;
363
+ }
364
+
365
+ /* Ensure plot area background */
366
+ .gr-plot > div,
367
+ .plot-container > div {
368
+ background-color: #000000 !important;
369
+ }
370
+
371
+ /* Prevent white flash during plot updates */
372
+ .plot-container::before {
373
+ content: "";
374
+ position: absolute;
375
+ top: 0;
376
+ left: 0;
377
+ right: 0;
378
+ bottom: 0;
379
+ background-color: #000000;
380
+ z-index: -1;
381
+ }
382
+
383
+ /* Force all plot elements to have black background */
384
+ .plot-container *,
385
+ .gr-plot *,
386
+ div[data-testid="plot"] * {
387
+ background-color: #000000 !important;
388
+ }
389
+
390
+ /* Override any white backgrounds in matplotlib */
391
+ .plot-container canvas,
392
+ .gr-plot canvas {
393
+ background-color: #000000 !important;
394
  }
395
 
396
  /* Text elements */
 
462
  resize: none !important;
463
  scrollbar-width: thin !important;
464
  scrollbar-color: #333333 #000000 !important;
465
+ scroll-behavior: auto;
466
+ transition: opacity 0.5s ease-in-out !important;
467
  }
468
 
469
  /* WebKit scrollbar styling for failed tests */
 
484
  background-color: #555555 !important;
485
  }
486
 
487
+ /* Prevent white flash in text boxes during updates */
488
+ .failed-tests::before {
489
+ content: "";
490
+ position: absolute;
491
+ top: 0;
492
+ left: 0;
493
+ right: 0;
494
+ bottom: 0;
495
+ background-color: #000000;
496
+ z-index: -1;
497
+ }
498
+
499
  .failed-tests {
500
  background-color: #000000 !important;
501
  height: 220px !important;
502
  max-height: 220px !important;
503
+ position: relative;
504
+ transition: opacity 0.5s ease-in-out !important;
505
  }
506
 
507
  .failed-tests .gr-textbox {
 
509
  border: none !important;
510
  height: 200px !important;
511
  max-height: 200px !important;
512
+ transition: opacity 0.5s ease-in-out !important;
513
+ }
514
+
515
+ /* Force all textbox elements to have black background */
516
+ .failed-tests *,
517
+ .failed-tests .gr-textbox *,
518
+ .failed-tests textarea * {
519
+ background-color: #000000 !important;
520
  }
521
 
522
+
523
+
524
  /* JavaScript to reset scroll position */
525
  .scroll-reset {
526
  animation: resetScroll 0.1s ease;
 
569
  with gr.Row():
570
  with gr.Column(scale=1):
571
  amd_failed_tests_output = gr.Textbox(
572
+ value="Failures on AMD (exclusive):\n─────────────────────────────\nnetwork_timeout\n\nFailures on AMD (common):\n────────────────────────\ndistributed",
573
  lines=8,
574
  max_lines=8,
575
  interactive=False,
 
578
  )
579
  with gr.Column(scale=1):
580
  nvidia_failed_tests_output = gr.Textbox(
581
+ value="Failures on NVIDIA (exclusive):\n─────────────────────────────────\nmulti_gpu\n\nFailures on NVIDIA (common):\n────────────────────────────\ndistributed",
582
  lines=8,
583
  max_lines=8,
584
  interactive=False,
 
593
  outputs=[plot_output, amd_failed_tests_output, nvidia_failed_tests_output]
594
  ).then(
595
  fn=None,
596
+ js="() => { setTimeout(() => { document.querySelectorAll('textarea').forEach(t => { if (t.closest('.failed-tests')) { t.scrollTop = 0; setTimeout(() => { t.style.scrollBehavior = 'smooth'; t.scrollTo({ top: 0, behavior: 'smooth' }); t.style.scrollBehavior = 'auto'; }, 50); } }); }, 300); }"
597
  )
598
 
599
  # Initialize with the first model