idolezal commited on
Commit
8ae0f62
ยท
1 Parent(s): fe41e81

Upload to the dataset the map from "submission_id" to "model_title"

Browse files
Files changed (1) hide show
  1. server.py +17 -0
server.py CHANGED
@@ -396,6 +396,8 @@ class LeaderboardServer:
396
  self.submission_id_to_file = submission_id_to_file
397
  self.submission_id_to_model_title = submission_id_to_model_title
398
  self.submission_id_to_data = submission_id_to_data
 
 
399
 
400
  def results_dataset_integrity_check(self, solve=False):
401
  """
@@ -884,6 +886,21 @@ class LeaderboardServer:
884
  self.pre_submit = None
885
  self.update_leaderboard()
886
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
887
  def _upload_submission(self, submission_id, file):
888
  api.upload_file(
889
  path_or_fileobj=file,
 
396
  self.submission_id_to_file = submission_id_to_file
397
  self.submission_id_to_model_title = submission_id_to_model_title
398
  self.submission_id_to_data = submission_id_to_data
399
+
400
+ self._upload_submission_id_to_model_title()
401
 
402
  def results_dataset_integrity_check(self, solve=False):
403
  """
 
886
  self.pre_submit = None
887
  self.update_leaderboard()
888
 
889
+ def _upload_submission_id_to_model_title(self):
890
+ # Temporary save tournament results
891
+ with self.results_dataset_local_snapshot_lock.rw:
892
+ submission_id_to_model_title_path = os.path.join(self.results_dataset_local_snapshot, "submission_id_to_model_title.json")
893
+ with open(submission_id_to_model_title_path, "w") as f:
894
+ json.dump(self.submission_id_to_model_title, f, sort_keys=True, indent=2) # readable JSON
895
+
896
+ api.upload_file(
897
+ path_or_fileobj=submission_id_to_model_title_path,
898
+ path_in_repo="submission_id_to_model_title.json",
899
+ repo_id=self.SERVER_ADDRESS,
900
+ repo_type=self.REPO_TYPE,
901
+ token=HF_TOKEN,
902
+ )
903
+
904
  def _upload_submission(self, submission_id, file):
905
  api.upload_file(
906
  path_or_fileobj=file,