Jacqueline Garrahan commited on
Commit
0982a7f
1 Parent(s): c02e9eb

Fix handling of missing data

Browse files
Files changed (2) hide show
  1. src/display/utils.py +15 -2
  2. src/leaderboard/read_evals.py +12 -11
src/display/utils.py CHANGED
@@ -50,7 +50,7 @@ class EvalQueueColumn: # Queue column
50
  revision = ColumnContent("revision", "str", True)
51
  private = ColumnContent("private", "bool", True)
52
  precision = ColumnContent("precision", "str", True)
53
- weight_type = ColumnContent("weight_type", "str", "Original")
54
  status = ColumnContent("status", "str", True)
55
 
56
  ## All the model information that we might need
@@ -87,6 +87,20 @@ class WeightType(Enum):
87
  Adapter = ModelDetails("Adapter")
88
  Original = ModelDetails("Original")
89
  Delta = ModelDetails("Delta")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  class Precision(Enum):
92
  float16 = ModelDetails("float16")
@@ -119,4 +133,3 @@ EVAL_COLS = [c.name for c in fields(EvalQueueColumn)]
119
  EVAL_TYPES = [c.type for c in fields(EvalQueueColumn)]
120
 
121
  BENCHMARK_COLS = [t.value.col_name for t in Tasks]
122
-
 
50
  revision = ColumnContent("revision", "str", True)
51
  private = ColumnContent("private", "bool", True)
52
  precision = ColumnContent("precision", "str", True)
53
+ weight_type = ColumnContent("weight_type", "str", "?")
54
  status = ColumnContent("status", "str", True)
55
 
56
  ## All the model information that we might need
 
87
  Adapter = ModelDetails("Adapter")
88
  Original = ModelDetails("Original")
89
  Delta = ModelDetails("Delta")
90
+ Unknown = ModelDetails("?")
91
+
92
+ def from_str(weight):
93
+ if weight == "Adapter":
94
+ return WeightType.Adapter
95
+
96
+ elif weight == "Original":
97
+ return WeightType.Original
98
+
99
+ elif weight == "Delta":
100
+ return WeightType.Delta
101
+
102
+ else:
103
+ return WeightType.Unknown
104
 
105
  class Precision(Enum):
106
  float16 = ModelDetails("float16")
 
133
  EVAL_TYPES = [c.type for c in fields(EvalQueueColumn)]
134
 
135
  BENCHMARK_COLS = [t.value.col_name for t in Tasks]
 
src/leaderboard/read_evals.py CHANGED
@@ -95,17 +95,18 @@ class EvalResult:
95
  """Finds the relevant request file for the current model and updates info with it"""
96
  request_file = get_request_file_for_model(requests_path, self.full_model)
97
 
98
- try:
99
- with open(request_file, "r") as f:
100
- request = json.load(f)
101
- self.model_type = ModelType.from_str(request.get("model_type", ""))
102
- self.weight_type = WeightType[request.get("weight_type", "Original")]
103
- self.license = request.get("license", "?")
104
- self.likes = request.get("likes", 0)
105
- self.num_params = request.get("params", 0)
106
- self.date = request.get("submitted_time", "")
107
- except Exception:
108
- print(f"Could not find request file for {self.org}/{self.model}")
 
109
 
110
  def to_dict(self):
111
  """Converts the Eval Result to a dict compatible with our dataframe display"""
 
95
  """Finds the relevant request file for the current model and updates info with it"""
96
  request_file = get_request_file_for_model(requests_path, self.full_model)
97
 
98
+
99
+ #try:
100
+ with open(request_file, "r") as f:
101
+ request = json.load(f)
102
+ self.model_type = ModelType.from_str(request.get("model_type", ""))
103
+ self.weight_type = WeightType[request.get("weight_type", "Unknown")]
104
+ self.license = request.get("license", "?")
105
+ self.likes = request.get("likes", 0)
106
+ self.num_params = request.get("params", 0)
107
+ self.date = request.get("submitted_time", "")
108
+ #except Exception:
109
+ # print(f"Could not find request file for {self.org}/{self.model}")
110
 
111
  def to_dict(self):
112
  """Converts the Eval Result to a dict compatible with our dataframe display"""