Clémentine commited on
Commit
49a4ed6
1 Parent(s): 3994f5a

fix submit different revisions

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. src/load_from_hub.py +6 -2
app.py CHANGED
@@ -159,7 +159,7 @@ def add_new_eval(
159
  return styled_warning("Model authors have requested that their model be not submitted on the leaderboard.")
160
 
161
  # Check for duplicate submission
162
- if out_path.split("eval-queue/")[1].lower() in requested_models:
163
  return styled_warning("This model has been already submitted.")
164
 
165
  with open(out_path, "w") as f:
@@ -256,7 +256,7 @@ def filter_models(
256
 
257
  numeric_interval = [NUMERIC_INTERVALS[s] for s in size_query]
258
  params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
259
- filtered_df = filtered_df[params_column.between(numeric_interval[0][0], numeric_interval[-1][-1])]
260
 
261
  return filtered_df
262
 
 
159
  return styled_warning("Model authors have requested that their model be not submitted on the leaderboard.")
160
 
161
  # Check for duplicate submission
162
+ if f"{model}_{revision}_{precision}" in requested_models:
163
  return styled_warning("This model has been already submitted.")
164
 
165
  with open(out_path, "w") as f:
 
256
 
257
  numeric_interval = [NUMERIC_INTERVALS[s] for s in size_query]
258
  params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
259
+ filtered_df = filtered_df[params_column.between(numeric_interval[0][0], numeric_interval[-1][1])]
260
 
261
  return filtered_df
262
 
src/load_from_hub.py CHANGED
@@ -20,9 +20,13 @@ def get_all_requested_models(requested_models_dir: str) -> set[str]:
20
  for root, _, files in os.walk(requested_models_dir):
21
  current_depth = root.count(os.sep) - requested_models_dir.count(os.sep)
22
  if current_depth == depth:
23
- file_names.extend([os.path.join(root, file) for file in files])
 
 
 
 
24
 
25
- return set([file_name.lower().split("eval-queue/")[1] for file_name in file_names])
26
 
27
 
28
  def load_all_info_from_hub(QUEUE_REPO: str, RESULTS_REPO: str, QUEUE_PATH: str, RESULTS_PATH: str) -> list[Repository]:
 
20
  for root, _, files in os.walk(requested_models_dir):
21
  current_depth = root.count(os.sep) - requested_models_dir.count(os.sep)
22
  if current_depth == depth:
23
+ for file in files:
24
+ if not file.endswith(".json"): continue
25
+ with open(os.path.join(root, file), "r") as f:
26
+ info = json.load(f)
27
+ file_names.append(f"{info['model']}_{info['revision']}_{info['precision']}")
28
 
29
+ return set(file_names)
30
 
31
 
32
  def load_all_info_from_hub(QUEUE_REPO: str, RESULTS_REPO: str, QUEUE_PATH: str, RESULTS_PATH: str) -> list[Repository]: