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
8a0ce59d
Commit
8a0ce59d
authored
May 14, 2024
by
Konrad
Browse files
added comments
parent
d01032d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
lm_eval/api/task.py
lm_eval/api/task.py
+3
-0
No files found.
lm_eval/api/task.py
View file @
8a0ce59d
...
...
@@ -1054,8 +1054,10 @@ class ConfigurableTask(Task):
if
not
self
.
multiple_input
:
if
isinstance
(
example
,
str
):
labeled_examples
.
append
({
"role"
:
"user"
,
"content"
:
example
})
# for loglikelihood create a list of questions with appended choices
elif
isinstance
(
example
,
list
):
labeled_examples_list
=
[]
# copy chat history for each example and append the answer
for
ex
in
example
:
chat
=
deepcopy
(
labeled_examples
)
chat
.
append
({
"role"
:
"user"
,
"content"
:
ex
})
...
...
@@ -1063,6 +1065,7 @@ class ConfigurableTask(Task):
self
.
convert_chat_history_to_string
(
chat
,
tokenizer
)
)
return
labeled_examples_list
# if example is an integer, append the choice or convert to string
elif
isinstance
(
example
,
int
):
if
self
.
config
.
doc_to_choice
is
not
None
:
choices
=
self
.
doc_to_choice
(
doc
)
...
...
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