Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
opencompass
Commits
7cd65d49
Unverified
Commit
7cd65d49
authored
Jan 03, 2024
by
bittersweet1999
Committed by
GitHub
Jan 03, 2024
Browse files
[Fix] Fix small bug in alignbench (#764)
* fix small bugs * fix small bugs
parent
3eb225a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
opencompass/summarizers/alignmentbench.py
opencompass/summarizers/alignmentbench.py
+4
-1
tools/convert_alignmentbench.py
tools/convert_alignmentbench.py
+0
-2
No files found.
opencompass/summarizers/alignmentbench.py
View file @
7cd65d49
...
@@ -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
'
,
''
)
...
...
tools/convert_alignmentbench.py
View file @
7cd65d49
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment