idolezal commited on
Commit
36141d4
1 Parent(s): 3f5825a

For testing purpose create pre-submit from fake tournament

Browse files
Files changed (2) hide show
  1. app.py +2 -3
  2. server.py +6 -1
app.py CHANGED
@@ -19,7 +19,7 @@ from server import LeaderboardServer, xmlAndMarkdownEscape, xmlQuoteAttr
19
 
20
  # For testing purpose
21
  HF_DISABLE_SUBMIT = bool(int(os.environ.get("HF_DISABLE_SUBMIT", "0")))
22
- HF_FAKE_TOURNAMENT = bool(int(os.environ.get("HF_FAKE_TOURNAMENT", "0")))
23
 
24
  leaderboard_server = LeaderboardServer()
25
 
@@ -65,10 +65,9 @@ def process_submission(*inputs):
65
 
66
  gr.Info('Submission valid, going to queue for the tournament…')
67
 
 
68
  if HF_FAKE_TOURNAMENT:
69
  pre_submit = None
70
- else:
71
- pre_submit = leaderboard_server.prepare_model_for_submission(inputs["submission_file"], metadata)
72
  except ValueError as err:
73
  gr.Warning(str(err))
74
  return (
 
19
 
20
  # For testing purpose
21
  HF_DISABLE_SUBMIT = bool(int(os.environ.get("HF_DISABLE_SUBMIT", "0")))
22
+ from server import HF_FAKE_TOURNAMENT
23
 
24
  leaderboard_server = LeaderboardServer()
25
 
 
65
 
66
  gr.Info('Submission valid, going to queue for the tournament…')
67
 
68
+ pre_submit = leaderboard_server.prepare_model_for_submission(inputs["submission_file"], metadata)
69
  if HF_FAKE_TOURNAMENT:
70
  pre_submit = None
 
 
71
  except ValueError as err:
72
  gr.Warning(str(err))
73
  return (
server.py CHANGED
@@ -29,6 +29,7 @@ VISIBLE_METRICS = SUPPORTED_METRICS + ["macro_f1"]
29
 
30
  api = HfApi()
31
 
 
32
  HF_RESULTS_DATASET = os.environ.get("HF_RESULTS_DATASET") # <HF_RESULTS_DATASET> ::= <owner> "/" <dataset name>; e.g. CZLC/LLM_benchmark_data
33
  HF_TOKEN = os.environ.get("HF_TOKEN")
34
 
@@ -706,7 +707,11 @@ class LeaderboardServer:
706
  if self.pre_submit == None:
707
  gr.Info('Running tournament...', duration=15)
708
  self.update_leaderboard()
709
- tournament_results = self.start_tournament(submission_id, file)
 
 
 
 
710
  self.pre_submit = self.PreSubmit(tournament_results, submission_id, file)
711
  break
712
  gr.Info("Waiting in queue...", duration=5)
 
29
 
30
  api = HfApi()
31
 
32
+ HF_FAKE_TOURNAMENT = bool(int(os.environ.get("HF_FAKE_TOURNAMENT", "0")))
33
  HF_RESULTS_DATASET = os.environ.get("HF_RESULTS_DATASET") # <HF_RESULTS_DATASET> ::= <owner> "/" <dataset name>; e.g. CZLC/LLM_benchmark_data
34
  HF_TOKEN = os.environ.get("HF_TOKEN")
35
 
 
707
  if self.pre_submit == None:
708
  gr.Info('Running tournament...', duration=15)
709
  self.update_leaderboard()
710
+ if HF_FAKE_TOURNAMENT:
711
+ with self.var_lock.ro:
712
+ tournament_results = copy.deepcopy(self.tournament_results)
713
+ else:
714
+ tournament_results = self.start_tournament(submission_id, file)
715
  self.pre_submit = self.PreSubmit(tournament_results, submission_id, file)
716
  break
717
  gr.Info("Waiting in queue...", duration=5)