AlexNijjar commited on
Commit
94d9564
·
1 Parent(s): 41936a6

Remove winner

Browse files
Files changed (2) hide show
  1. src/validator_states.py +3 -7
  2. src/wandb_data.py +2 -11
src/validator_states.py CHANGED
@@ -1,4 +1,3 @@
1
- import statistics
2
  from datetime import timedelta
3
 
4
  import gradio as gr
@@ -6,7 +5,7 @@ import pandas as pd
6
  from packaging import version
7
 
8
  from chain_data import get_nodes, UPDATED
9
- from wandb_data import get_current_runs, Run, BenchmarkStatus
10
 
11
  AVERAGE_BENCHMARKING_TIME_WARNING_THRESHOLD = 180 # 3 minutes
12
  ETA_WARNING_THRESHOLD = 43200 # 12 hours
@@ -30,8 +29,6 @@ def colorize(val, color: str) -> str:
30
  def create_validator_states() -> gr.Dataframe:
31
  data: list[list] = []
32
  runs = sorted(get_current_runs(), key=lambda run: run.uid)
33
- winners = [run.winner_uid for run in runs if run.winner_uid and run.status == BenchmarkStatus.FINISHED]
34
- winner_uid_mode = statistics.mode(winners) if winners else None
35
  latest_version = get_latest_version(runs)
36
  for run in runs:
37
  if not run.hotkey in get_nodes():
@@ -43,7 +40,6 @@ def create_validator_states() -> gr.Dataframe:
43
  run.name,
44
  colorize(run.version, "springgreen" if run.version == latest_version else "red"),
45
  colorize(run.status.name(), run.status.color()),
46
- colorize(run.winner_uid, "springgreen" if winner_uid_mode and run.winner_uid == winner_uid_mode else "orange" if run.winner_uid and run.status == BenchmarkStatus.FINISHED else "gray"),
47
  f"{min(run.total_submissions, len(run.submissions) + len(run.invalid_submissions))}/{run.total_submissions}",
48
  len(run.invalid_submissions),
49
  colorize(f"{timedelta(seconds=int(run.average_benchmarking_time))}", "orange" if run.average_benchmarking_time > AVERAGE_BENCHMARKING_TIME_WARNING_THRESHOLD else "springgreen" if run.average_benchmarking_time > 0 else "gray"),
@@ -54,8 +50,8 @@ def create_validator_states() -> gr.Dataframe:
54
  ])
55
 
56
  return gr.Dataframe(
57
- pd.DataFrame(data, columns=["UID", "Name", "Version", "Status", "Winner", "Tested", "Invalid", "Avg. Benchmark Time", "ETA", "Step", "VTrust", "Updated"]),
58
- datatype=["number", "markdown", "markdown", "markdown", "markdown", "number", "number", "markdown", "markdown", "number", "markdown", "markdown"],
59
  interactive=False,
60
  max_height=800,
61
  row_count=1,
 
 
1
  from datetime import timedelta
2
 
3
  import gradio as gr
 
5
  from packaging import version
6
 
7
  from chain_data import get_nodes, UPDATED
8
+ from wandb_data import get_current_runs, Run
9
 
10
  AVERAGE_BENCHMARKING_TIME_WARNING_THRESHOLD = 180 # 3 minutes
11
  ETA_WARNING_THRESHOLD = 43200 # 12 hours
 
29
  def create_validator_states() -> gr.Dataframe:
30
  data: list[list] = []
31
  runs = sorted(get_current_runs(), key=lambda run: run.uid)
 
 
32
  latest_version = get_latest_version(runs)
33
  for run in runs:
34
  if not run.hotkey in get_nodes():
 
40
  run.name,
41
  colorize(run.version, "springgreen" if run.version == latest_version else "red"),
42
  colorize(run.status.name(), run.status.color()),
 
43
  f"{min(run.total_submissions, len(run.submissions) + len(run.invalid_submissions))}/{run.total_submissions}",
44
  len(run.invalid_submissions),
45
  colorize(f"{timedelta(seconds=int(run.average_benchmarking_time))}", "orange" if run.average_benchmarking_time > AVERAGE_BENCHMARKING_TIME_WARNING_THRESHOLD else "springgreen" if run.average_benchmarking_time > 0 else "gray"),
 
50
  ])
51
 
52
  return gr.Dataframe(
53
+ pd.DataFrame(data, columns=["UID", "Name", "Version", "Status", "Tested", "Invalid", "Avg. Benchmark Time", "ETA", "Step", "VTrust", "Updated"]),
54
+ datatype=["number", "markdown", "markdown", "markdown", "number", "number", "markdown", "markdown", "number", "markdown", "markdown"],
55
  interactive=False,
56
  max_height=800,
57
  row_count=1,
src/wandb_data.py CHANGED
@@ -88,7 +88,6 @@ class Run:
88
  average_benchmarking_time: float
89
  step: int
90
  eta: int
91
- winner_uid: int | None
92
  baseline_metrics: Metrics | None
93
  total_submissions: int
94
  submissions: dict[Key, Submission]
@@ -201,13 +200,6 @@ def _add_runs(wandb_runs: list[wapi.Run]):
201
  ...
202
 
203
  status = _status_from_run(wandb_run)
204
- winner_submission = max(
205
- submissions.values(),
206
- key=lambda submission: submission.score,
207
- default=None
208
- )
209
- winner_uid = winner_submission.info.uid if winner_submission else None
210
-
211
  uid = int(wandb_run.config["uid"])
212
  hotkey = wandb_run.config["hotkey"]
213
  date = _date_from_run(wandb_run)
@@ -216,11 +208,11 @@ def _add_runs(wandb_runs: list[wapi.Run]):
216
 
217
  # Get num_gpus from metrics, default to 1 if not found
218
  num_gpus = int(metrics.get("num_gpus", 1))
219
-
220
  # Update ETA calculation to account for GPUs
221
  eta_calculation = (
222
  max(
223
- int(average_benchmarking_time * (len(submission_info) - len(submissions) - len(invalid_submissions))) if average_benchmarking_time else 0,
224
  0
225
  ) // num_gpus # Divide by number of GPUs
226
  if status != BenchmarkStatus.FINISHED else 0
@@ -236,7 +228,6 @@ def _add_runs(wandb_runs: list[wapi.Run]):
236
  average_benchmarking_time=average_benchmarking_time,
237
  step=int(metrics["step"]),
238
  eta=eta_calculation,
239
- winner_uid=winner_uid,
240
  baseline_metrics=baseline_metrics,
241
  total_submissions=len(submission_info),
242
  submissions=submissions,
 
88
  average_benchmarking_time: float
89
  step: int
90
  eta: int
 
91
  baseline_metrics: Metrics | None
92
  total_submissions: int
93
  submissions: dict[Key, Submission]
 
200
  ...
201
 
202
  status = _status_from_run(wandb_run)
 
 
 
 
 
 
 
203
  uid = int(wandb_run.config["uid"])
204
  hotkey = wandb_run.config["hotkey"]
205
  date = _date_from_run(wandb_run)
 
208
 
209
  # Get num_gpus from metrics, default to 1 if not found
210
  num_gpus = int(metrics.get("num_gpus", 1))
211
+
212
  # Update ETA calculation to account for GPUs
213
  eta_calculation = (
214
  max(
215
+ int(average_benchmarking_time * (len(submission_info) - len(submissions) - len(invalid_submissions))) if average_benchmarking_time else 0,
216
  0
217
  ) // num_gpus # Divide by number of GPUs
218
  if status != BenchmarkStatus.FINISHED else 0
 
228
  average_benchmarking_time=average_benchmarking_time,
229
  step=int(metrics["step"]),
230
  eta=eta_calculation,
 
231
  baseline_metrics=baseline_metrics,
232
  total_submissions=len(submission_info),
233
  submissions=submissions,