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
gaoqiong
lm-evaluation-harness
Commits
a7362d8b
"examples/vscode:/vscode.git/clone" did not exist on "9d44e2fb6600e80f410b2c05139c001fb0fa9794"
Commit
a7362d8b
authored
Oct 08, 2025
by
Baber
Browse files
add `parse_generations` to OpenAIChatCompletion
parent
3e28eed1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
lm_eval/models/openai_completions.py
lm_eval/models/openai_completions.py
+12
-0
No files found.
lm_eval/models/openai_completions.py
View file @
a7362d8b
...
@@ -295,3 +295,15 @@ class OpenAIChatCompletion(LocalChatCompletion):
...
@@ -295,3 +295,15 @@ class OpenAIChatCompletion(LocalChatCompletion):
elif
"o3"
in
self
.
model
:
elif
"o3"
in
self
.
model
:
output
.
pop
(
"temperature"
)
output
.
pop
(
"temperature"
)
return
output
return
output
@
staticmethod
def
parse_generations
(
outputs
:
Union
[
Dict
,
List
[
Dict
]],
**
kwargs
)
->
List
[
str
]:
res
=
[]
if
not
isinstance
(
outputs
,
list
):
outputs
=
[
outputs
]
for
out
in
outputs
:
tmp
=
[
None
]
*
len
(
out
[
"choices"
])
for
choices
in
out
[
"choices"
]:
tmp
[
choices
[
"index"
]]
=
choices
[
"message"
][
"content"
]
res
=
res
+
tmp
return
res
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