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
b2838b8d
Commit
b2838b8d
authored
Apr 26, 2022
by
cjlovering
Browse files
Rename task specific to
parent
1dcca55c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
lm_eval/base.py
lm_eval/base.py
+5
-3
lm_eval/tasks/coqa.py
lm_eval/tasks/coqa.py
+1
-1
lm_eval/tasks/drop.py
lm_eval/tasks/drop.py
+1
-1
lm_eval/tasks/glue.py
lm_eval/tasks/glue.py
+1
-1
No files found.
lm_eval/base.py
View file @
b2838b8d
...
@@ -652,10 +652,12 @@ class PromptSourceTask(Task):
...
@@ -652,10 +652,12 @@ class PromptSourceTask(Task):
super
().
__init__
(
data_dir
,
cache_dir
,
download_mode
)
super
().
__init__
(
data_dir
,
cache_dir
,
download_mode
)
self
.
prompt
=
prompt
self
.
prompt
=
prompt
def
end_of_generation_sequence
(
self
):
def
stopping_criteria
(
self
):
"""Denote where the generation should
be split
.
"""Denote where the generation should
end
.
For example, for coqa, this is '
\n
Q:' and for drop '.'.
For example, for coqa, this is '
\n
Q:' and for drop '.'.
By default, its None, meaning to generate up to max or EOT, whichever comes first.
"""
"""
return
None
return
None
...
@@ -716,7 +718,7 @@ class PromptSourceTask(Task):
...
@@ -716,7 +718,7 @@ class PromptSourceTask(Task):
_requests
.
append
(
ll_answer_choice
)
_requests
.
append
(
ll_answer_choice
)
else
:
else
:
# TODO(Albert): What is the stop symbol? Is it model specific?
# TODO(Albert): What is the stop symbol? Is it model specific?
cont_request
=
rf
.
greedy_until
(
ctx
,
[
self
.
end_of_generation_sequence
()])
cont_request
=
rf
.
greedy_until
(
ctx
,
[
self
.
stopping_criteria
()])
_requests
.
append
(
cont_request
)
_requests
.
append
(
cont_request
)
return
_requests
return
_requests
...
...
lm_eval/tasks/coqa.py
View file @
b2838b8d
...
@@ -90,7 +90,7 @@ class CoQA(PromptSourceTask):
...
@@ -90,7 +90,7 @@ class CoQA(PromptSourceTask):
"f1"
:
f1_sum
/
max
(
1
,
len
(
gold_list
)),
"f1"
:
f1_sum
/
max
(
1
,
len
(
gold_list
)),
}
}
def
end_of_generation_sequence
(
self
):
def
stopping_criteria
(
self
):
return
"
\n
Q:"
return
"
\n
Q:"
# def construct_requests(self, doc, ctx):
# def construct_requests(self, doc, ctx):
...
...
lm_eval/tasks/drop.py
View file @
b2838b8d
...
@@ -92,7 +92,7 @@ class DROP(PromptSourceTask):
...
@@ -92,7 +92,7 @@ class DROP(PromptSourceTask):
# """
# """
# conts = [rf.greedy_until(ctx, ["."])]
# conts = [rf.greedy_until(ctx, ["."])]
# return conts
# return conts
def
end_of_generation_sequence
(
self
):
def
stopping_criteria
(
self
):
return
"."
return
"."
def
process_results
(
self
,
doc
,
results
):
def
process_results
(
self
,
doc
,
results
):
...
...
lm_eval/tasks/glue.py
View file @
b2838b8d
...
@@ -236,7 +236,7 @@ class MRPC(PromptSourceTask):
...
@@ -236,7 +236,7 @@ class MRPC(PromptSourceTask):
def
has_test_docs
(
self
):
def
has_test_docs
(
self
):
return
False
return
False
def
end_of_generation_sequence
(
self
):
def
stopping_criteria
(
self
):
return
"
\n
"
return
"
\n
"
def
training_docs
(
self
):
def
training_docs
(
self
):
...
...
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