sh1gechan commited on
Commit
70a5d78
1 Parent(s): 2fda72a

Update src/leaderboard/read_evals.py

Browse files
Files changed (1) hide show
  1. src/leaderboard/read_evals.py +9 -40
src/leaderboard/read_evals.py CHANGED
@@ -189,46 +189,15 @@ def get_request_file_for_model(requests_path, model_name, precision):
189
  # Select correct request file (precision)
190
  request_file = ""
191
  request_files = sorted(request_files, reverse=True)
192
-
193
- if precision == "Unknown":
194
- print("Precision is Unknown, selecting the first available FINISHED request file.")
195
- for tmp_request_file in request_files:
196
- try:
197
- with open(tmp_request_file, "r") as f:
198
- req_content = json.load(f)
199
- print(f"Request file content: {req_content}") # デバッグ: ファイルの内容を表示
200
- # 精度に関係なくFINISHEDステータスのファイルを優先
201
- if req_content["status"] == "FINISHED":
202
- request_file = tmp_request_file
203
- break # 最初に見つけたFINISHEDのファイルを使用
204
- except Exception as e:
205
- print(f"Error reading request file {tmp_request_file}: {e}")
206
- else:
207
- # 正しい precision のリクエストファイルを探す
208
- for tmp_request_file in request_files:
209
- try:
210
- with open(tmp_request_file, "r") as f:
211
- req_content = json.load(f)
212
- print(f"Request file content: {req_content}") # デバッグ: ファイルの内容を表示
213
- if req_content["status"] == "FINISHED" and req_content["precision"] == precision.split(".")[-1]:
214
- request_file = tmp_request_file
215
- break # 適切なファイルを見つけたらループを抜ける
216
- except Exception as e:
217
- print(f"Error reading request file {tmp_request_file}: {e}")
218
-
219
- # for tmp_request_file in request_files:
220
- # with open(tmp_request_file, "r") as f:
221
- # req_content = json.load(f)
222
- # print(f"Request file content: {req_content}")
223
- # if (
224
- # req_content["status"] in ["FINISHED"]
225
- # and req_content["precision"] == precision.split(".")[-1]
226
- # ):
227
- # request_file = tmp_request_file
228
- if request_file:
229
- print(f"Using request file: {request_file}")
230
- else:
231
- print("No matching request file found.")
232
  return request_file
233
 
234
  def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResult]:
 
189
  # Select correct request file (precision)
190
  request_file = ""
191
  request_files = sorted(request_files, reverse=True)
192
+ for tmp_request_file in request_files:
193
+ with open(tmp_request_file, "r") as f:
194
+ req_content = json.load(f)
195
+ print(f"Request file content: {req_content}")
196
+ if (
197
+ req_content["status"] in ["FINISHED"]
198
+ and req_content["precision"] == precision.split(".")[-1]
199
+ ):
200
+ request_file = tmp_request_file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  return request_file
202
 
203
  def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResult]: