Spaces:
Runtime error
Runtime error
christodoulos.constantinides@ibm.com
commited on
Commit
·
d32b9f6
1
Parent(s):
f4362fc
read evals
Browse files
src/leaderboard/read_evals.py
CHANGED
|
@@ -159,8 +159,6 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
| 159 |
model_result_filepaths = []
|
| 160 |
print(results_path)
|
| 161 |
for root, _, files in os.walk(results_path):
|
| 162 |
-
print(root)
|
| 163 |
-
print(files)
|
| 164 |
# We should only have json files in model results
|
| 165 |
if len(files) == 0 or any([not f.endswith(".json") for f in files]):
|
| 166 |
continue
|
|
@@ -173,12 +171,15 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
| 173 |
|
| 174 |
for file in files:
|
| 175 |
model_result_filepaths.append(os.path.join(root, file))
|
| 176 |
-
|
| 177 |
eval_results = {}
|
| 178 |
for model_result_filepath in model_result_filepaths:
|
|
|
|
| 179 |
# Creation of result
|
| 180 |
eval_result = EvalResult.init_from_json_file(model_result_filepath)
|
|
|
|
| 181 |
eval_result.update_with_request_file(requests_path)
|
|
|
|
| 182 |
|
| 183 |
# Store results of same eval together
|
| 184 |
eval_name = eval_result.eval_name
|
|
@@ -191,8 +192,10 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResu
|
|
| 191 |
for v in eval_results.values():
|
| 192 |
try:
|
| 193 |
v.to_dict() # we test if the dict version is complete
|
|
|
|
| 194 |
results.append(v)
|
| 195 |
except KeyError: # not all eval values present
|
|
|
|
| 196 |
continue
|
| 197 |
|
| 198 |
return results
|
|
|
|
| 159 |
model_result_filepaths = []
|
| 160 |
print(results_path)
|
| 161 |
for root, _, files in os.walk(results_path):
|
|
|
|
|
|
|
| 162 |
# We should only have json files in model results
|
| 163 |
if len(files) == 0 or any([not f.endswith(".json") for f in files]):
|
| 164 |
continue
|
|
|
|
| 171 |
|
| 172 |
for file in files:
|
| 173 |
model_result_filepaths.append(os.path.join(root, file))
|
| 174 |
+
print(model_result_filepaths)
|
| 175 |
eval_results = {}
|
| 176 |
for model_result_filepath in model_result_filepaths:
|
| 177 |
+
print(f'creation of result {model_result_filepath}')
|
| 178 |
# Creation of result
|
| 179 |
eval_result = EvalResult.init_from_json_file(model_result_filepath)
|
| 180 |
+
print(eval_result)
|
| 181 |
eval_result.update_with_request_file(requests_path)
|
| 182 |
+
print(eval_result)
|
| 183 |
|
| 184 |
# Store results of same eval together
|
| 185 |
eval_name = eval_result.eval_name
|
|
|
|
| 192 |
for v in eval_results.values():
|
| 193 |
try:
|
| 194 |
v.to_dict() # we test if the dict version is complete
|
| 195 |
+
print(f'to dict value {str(v)}')
|
| 196 |
results.append(v)
|
| 197 |
except KeyError: # not all eval values present
|
| 198 |
+
print('error key')
|
| 199 |
continue
|
| 200 |
|
| 201 |
return results
|