"...composable_kernel-1.git" did not exist on "b53e9d08ed5a9f80d8c13cf8bedd86155cc7c244"
Unverified Commit 7cd65d49 authored by bittersweet1999's avatar bittersweet1999 Committed by GitHub
Browse files

[Fix] Fix small bug in alignbench (#764)

* fix small bugs

* fix small bugs
parent 3eb225a5
...@@ -70,7 +70,10 @@ def post_process_alignbench(judgement: str, ...@@ -70,7 +70,10 @@ def post_process_alignbench(judgement: str,
pattern = rf"({'|'.join(possible_keys)}): (\d+(\.\d{{1,2}})?)" pattern = rf"({'|'.join(possible_keys)}): (\d+(\.\d{{1,2}})?)"
match = re.search(pattern, text) match = re.search(pattern, text)
if match: if match:
return float(match.group(1)) try:
return float(match.group(1))
except ValueError:
return -1
return -1 return -1
judgement = judgement.replace('\n', '') judgement = judgement.replace('\n', '')
......
...@@ -28,8 +28,6 @@ def extract_predictions_from_json(input_folder): ...@@ -28,8 +28,6 @@ def extract_predictions_from_json(input_folder):
# when only one complete file # when only one complete file
print(e) print(e)
json_paths = [os.path.join(model_folder, 'alignment_bench.json')] json_paths = [os.path.join(model_folder, 'alignment_bench.json')]
else:
raise FileNotFoundError
all_predictions = [] all_predictions = []
for json_ in json_paths: for json_ in json_paths:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment