Nathan Habib commited on
Commit
624b3c8
1 Parent(s): adb0416

fix model display when fething metadata

Browse files
src/display_models/get_model_metadata.py CHANGED
@@ -31,7 +31,7 @@ def get_model_metadata(leaderboard_data: List[dict]):
31
  with open(tmp_request_file, "r") as f:
32
  req_content = json.load(f)
33
  if (
34
- req_content["status"] == "FINISHED"
35
  and req_content["precision"] == model_data["Precision"].split(".")[-1]
36
  ):
37
  request_file = tmp_request_file
@@ -39,13 +39,16 @@ def get_model_metadata(leaderboard_data: List[dict]):
39
  try:
40
  with open(request_file, "r") as f:
41
  request = json.load(f)
42
- model_type = model_type_from_str(request["model_type"])
43
  model_data[AutoEvalColumn.model_type.name] = model_type.value.name
44
  model_data[AutoEvalColumn.model_type_symbol.name] = model_type.value.symbol # + ("🔺" if is_delta else "")
45
- model_data[AutoEvalColumn.license.name] = request["license"]
46
- model_data[AutoEvalColumn.likes.name] = request["likes"]
47
- model_data[AutoEvalColumn.params.name] = request["params"]
48
- except Exception:
 
 
 
49
  if model_data["model_name_for_query"] in MODEL_TYPE_METADATA:
50
  model_data[AutoEvalColumn.model_type.name] = MODEL_TYPE_METADATA[
51
  model_data["model_name_for_query"]
 
31
  with open(tmp_request_file, "r") as f:
32
  req_content = json.load(f)
33
  if (
34
+ req_content["status"] in ["FINISHED", "PENDING_NEW_EVAL"]
35
  and req_content["precision"] == model_data["Precision"].split(".")[-1]
36
  ):
37
  request_file = tmp_request_file
 
39
  try:
40
  with open(request_file, "r") as f:
41
  request = json.load(f)
42
+ model_type = model_type_from_str(request.get("model_type", ""))
43
  model_data[AutoEvalColumn.model_type.name] = model_type.value.name
44
  model_data[AutoEvalColumn.model_type_symbol.name] = model_type.value.symbol # + ("🔺" if is_delta else "")
45
+ model_data[AutoEvalColumn.license.name] = request.get("license", "?")
46
+ model_data[AutoEvalColumn.likes.name] = request.get("likes", 0)
47
+ model_data[AutoEvalColumn.params.name] = request.get("params", 0)
48
+ except Exception as e:
49
+ print(f"Could not find request file for {model_data['model_name_for_query']}: {e}")
50
+ print(f"{request_file=}")
51
+ print(f"{request_files=}")
52
  if model_data["model_name_for_query"] in MODEL_TYPE_METADATA:
53
  model_data[AutoEvalColumn.model_type.name] = MODEL_TYPE_METADATA[
54
  model_data["model_name_for_query"]