lixuejing commited on
Commit
c623d2b
1 Parent(s): 9a7712d

add try to fix json load exception

Browse files
Files changed (1) hide show
  1. src/leaderboard/read_evals.py +16 -13
src/leaderboard/read_evals.py CHANGED
@@ -218,19 +218,22 @@ def get_raw_eval_results(results_path: str, requests_path: str, dynamic_path: st
218
 
219
  eval_results = {}
220
  for model_result_filepath in model_result_filepaths:
221
- # Creation of result
222
- eval_result = EvalResult.init_from_json_file(model_result_filepath)
223
- eval_result.update_with_request_file(requests_path)
224
- if eval_result.full_model in dynamic_data:
225
- eval_result.update_with_dynamic_file_dict(dynamic_data[eval_result.full_model])
226
-
227
- # Store results of same eval together
228
- eval_name = eval_result.eval_name
229
- if eval_name in eval_results.keys():
230
- eval_results[eval_name].results.update({k: v for k, v in eval_result.results.items() if v is not None})
231
- else:
232
- eval_results[eval_name] = eval_result
233
-
 
 
 
234
  results = []
235
  for v in eval_results.values():
236
  try:
 
218
 
219
  eval_results = {}
220
  for model_result_filepath in model_result_filepaths:
221
+ try:
222
+ # Creation of result
223
+ eval_result = EvalResult.init_from_json_file(model_result_filepath)
224
+ eval_result.update_with_request_file(requests_path)
225
+ if eval_result.full_model in dynamic_data:
226
+ eval_result.update_with_dynamic_file_dict(dynamic_data[eval_result.full_model])
227
+
228
+ # Store results of same eval together
229
+ eval_name = eval_result.eval_name
230
+ if eval_name in eval_results.keys():
231
+ eval_results[eval_name].results.update({k: v for k, v in eval_result.results.items() if v is not None})
232
+ else:
233
+ eval_results[eval_name] = eval_result
234
+ except:
235
+ print("model result json load exception, pleace check!", model_result_filepath)
236
+ continue
237
  results = []
238
  for v in eval_results.values():
239
  try: