rusticluftig commited on
Commit
f314c0a
·
1 Parent(s): 3ed0b33

Compute losses in try/except

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. utils.py +6 -0
app.py CHANGED
@@ -56,6 +56,8 @@ def main():
56
  validator_df = state_vars["validator_df"]
57
  benchmarks = state_vars.get("benchmarks", None)
58
  benchmark_timestamp = state_vars.get("benchmark_timestamp", None)
 
 
59
 
60
  demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}")
61
  with demo:
@@ -82,7 +84,6 @@ def main():
82
  gr.HTML(EVALUATION_HEADER)
83
  show_stale = gr.Checkbox(label="Show Stale", interactive=True)
84
  competition_leaderboards = []
85
- losses_1 = utils.get_losses_over_time(vali_runs, 1)
86
  comp_1 = competitions.COMPETITION_DETAILS[1]
87
  with gr.Accordion(f"{comp_1.name} Competition"):
88
  gr.HTML(comp_1.html_description)
@@ -106,7 +107,6 @@ def main():
106
  title="Best Average Loss Over Time",
107
  )
108
  comp_2 = competitions.COMPETITION_DETAILS[2]
109
- losses_2 = utils.get_losses_over_time(vali_runs, 2)
110
  # Covert the losses into % of correct answers.
111
  losses_2["losses"] = losses_2["losses"].apply(lambda x: 1 - x if x else None)
112
  with gr.Accordion(f"{comp_2.name} Competition"):
 
56
  validator_df = state_vars["validator_df"]
57
  benchmarks = state_vars.get("benchmarks", None)
58
  benchmark_timestamp = state_vars.get("benchmark_timestamp", None)
59
+ losses_1 = state_vars["losses_1"]
60
+ losses_2 = state_vars["losses_2"]
61
 
62
  demo = gr.Blocks(css=".typewriter {font-family: 'JMH Typewriter', sans-serif;}")
63
  with demo:
 
84
  gr.HTML(EVALUATION_HEADER)
85
  show_stale = gr.Checkbox(label="Show Stale", interactive=True)
86
  competition_leaderboards = []
 
87
  comp_1 = competitions.COMPETITION_DETAILS[1]
88
  with gr.Accordion(f"{comp_1.name} Competition"):
89
  gr.HTML(comp_1.html_description)
 
107
  title="Best Average Loss Over Time",
108
  )
109
  comp_2 = competitions.COMPETITION_DETAILS[2]
 
110
  # Covert the losses into % of correct answers.
111
  losses_2["losses"] = losses_2["losses"].apply(lambda x: 1 - x if x else None)
112
  with gr.Accordion(f"{comp_2.name} Competition"):
utils.py CHANGED
@@ -422,6 +422,10 @@ def load_state_vars() -> dict[Any]:
422
  weight_keys = set()
423
  for uid, stats in validator_df.items():
424
  weight_keys.update(stats[-1].keys())
 
 
 
 
425
 
426
  # Enable benchmark if the flag is set
427
  if BENCHMARK_FLAG:
@@ -446,6 +450,8 @@ def load_state_vars() -> dict[Any]:
446
  "validator_df": validator_df,
447
  "benchmarks": benchmarks,
448
  "benchmark_timestamp": benchmark_timestamp,
 
 
449
  }
450
 
451
 
 
422
  weight_keys = set()
423
  for uid, stats in validator_df.items():
424
  weight_keys.update(stats[-1].keys())
425
+
426
+ # Compute loss over time for all competitions.
427
+ losses_1 = get_losses_over_time(vali_runs, 1)
428
+ losses_2 = get_losses_over_time(vali_runs, 2)
429
 
430
  # Enable benchmark if the flag is set
431
  if BENCHMARK_FLAG:
 
450
  "validator_df": validator_df,
451
  "benchmarks": benchmarks,
452
  "benchmark_timestamp": benchmark_timestamp,
453
+ "losses_1": losses_1,
454
+ "losses_2": losses_2,
455
  }
456
 
457