Nathan Habib commited on
Commit
80f4eeb
β€’
1 Parent(s): d295afa

get model type info from request file

Browse files
app.py CHANGED
@@ -328,7 +328,7 @@ with demo:
328
  )
329
  filter_columns = gr.Radio(
330
  label="⏚ Filter model types",
331
- choices = ["all", "🟒 base", "πŸ”Ά instruction-tuned", "🟦 RL-tuned"],
332
  value="all",
333
  elem_id="filter-columns"
334
  )
@@ -404,7 +404,7 @@ with demo:
404
  False, label="Private", visible=not IS_PUBLIC
405
  )
406
  model_type = gr.Dropdown(
407
- choices=["pretrained", "fine-tuned", "with RL"],
408
  label="Model type",
409
  multiselect=False,
410
  value=None,
 
328
  )
329
  filter_columns = gr.Radio(
330
  label="⏚ Filter model types",
331
+ choices = ["all", "🟒 base", "πŸ”Ά fine-tuned", "🟦 RL-tuned"],
332
  value="all",
333
  elem_id="filter-columns"
334
  )
 
404
  False, label="Private", visible=not IS_PUBLIC
405
  )
406
  model_type = gr.Dropdown(
407
+ choices=["pretrained", "fine-tuned", "RL-tuned"],
408
  label="Model type",
409
  multiselect=False,
410
  value=None,
src/auto_leaderboard/load_results.py CHANGED
@@ -119,12 +119,6 @@ def get_eval_results(is_public) -> List[EvalResult]:
119
 
120
  up_to_date = files[-1]
121
 
122
- if len(files) > 1:
123
- print(root)
124
- print(files)
125
- print(up_to_date)
126
- print("===")
127
-
128
  json_filepaths.append(os.path.join(root, up_to_date))
129
 
130
  eval_results = {}
 
119
 
120
  up_to_date = files[-1]
121
 
 
 
 
 
 
 
122
  json_filepaths.append(os.path.join(root, up_to_date))
123
 
124
  eval_results = {}
src/auto_leaderboard/model_metadata_type.py CHANGED
@@ -15,13 +15,13 @@ class ModelInfo:
15
  model_type_symbols = {
16
  "fine-tuned": "πŸ”Ά",
17
  "pretrained": "🟒",
18
- "with RL": "🟦",
19
  }
20
 
21
  class ModelType(Enum):
22
  PT = ModelInfo(name="pretrained", symbol="🟒")
23
- SFT = ModelInfo(name="finetuned", symbol="πŸ”Ά")
24
- RL = ModelInfo(name="with RL", symbol="🟦")
25
 
26
 
27
  TYPE_METADATA: Dict[str, ModelType] = {
@@ -532,21 +532,31 @@ TYPE_METADATA: Dict[str, ModelType] = {
532
  def get_model_type(leaderboard_data: List[dict]):
533
  for model_data in leaderboard_data:
534
  # Todo @clefourrier once requests are connected with results
535
- is_delta = False # (model_data["weight_type"] != "Original")
536
  # Stored information
537
  request_file = os.path.join("eval-queue", model_data["model_name_for_query"] + "_eval_request_*" + ".json")
538
  request_file = glob.glob(request_file)
539
 
 
 
 
 
 
 
 
540
  try:
541
- request_file = request_file[0]
542
  with open(request_file, "r") as f:
543
  request = json.load(f)
544
- model_type = request["model_type"]
545
  is_delta = request["weight_type"] != "Original"
 
 
 
 
 
 
 
546
  model_data[AutoEvalColumn.model_type.name] = model_type
547
  model_data[AutoEvalColumn.model_type_symbol.name] = model_type_symbols[model_type] + ("πŸ”Ί" if is_delta else "")
548
  except Exception:
549
- if model_data["model_name_for_query"] in TYPE_METADATA:
550
- model_data[AutoEvalColumn.model_type.name] = TYPE_METADATA[model_data["model_name_for_query"]].value.name
551
- model_data[AutoEvalColumn.model_type_symbol.name] = TYPE_METADATA[model_data["model_name_for_query"]].value.symbol + ("πŸ”Ί" if is_delta else "")
552
 
 
15
  model_type_symbols = {
16
  "fine-tuned": "πŸ”Ά",
17
  "pretrained": "🟒",
18
+ "RL-tuned": "🟦",
19
  }
20
 
21
  class ModelType(Enum):
22
  PT = ModelInfo(name="pretrained", symbol="🟒")
23
+ SFT = ModelInfo(name="fine-tuned", symbol="πŸ”Ά")
24
+ RL = ModelInfo(name="RL-tuned", symbol="🟦")
25
 
26
 
27
  TYPE_METADATA: Dict[str, ModelType] = {
 
532
  def get_model_type(leaderboard_data: List[dict]):
533
  for model_data in leaderboard_data:
534
  # Todo @clefourrier once requests are connected with results
 
535
  # Stored information
536
  request_file = os.path.join("eval-queue", model_data["model_name_for_query"] + "_eval_request_*" + ".json")
537
  request_file = glob.glob(request_file)
538
 
539
+ if len(request_file) == 0:
540
+ model_data[AutoEvalColumn.model_type.name] = "Unknown"
541
+ model_data[AutoEvalColumn.model_type_symbol.name] = "No request file"
542
+ continue
543
+
544
+ request_file = request_file[0]
545
+
546
  try:
 
547
  with open(request_file, "r") as f:
548
  request = json.load(f)
 
549
  is_delta = request["weight_type"] != "Original"
550
+ except Exception:
551
+ is_delta = False
552
+
553
+ try:
554
+ with open(request_file, "r") as f:
555
+ request = json.load(f)
556
+ model_type = request["model_type"]
557
  model_data[AutoEvalColumn.model_type.name] = model_type
558
  model_data[AutoEvalColumn.model_type_symbol.name] = model_type_symbols[model_type] + ("πŸ”Ί" if is_delta else "")
559
  except Exception:
560
+ model_data[AutoEvalColumn.model_type.name] = "Unknown"
561
+ model_data[AutoEvalColumn.model_type_symbol.name] = "Add type to request files"
 
562