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
4721379e
Unverified
Commit
4721379e
authored
Sep 05, 2023
by
Hailey Schoelkopf
Committed by
GitHub
Sep 05, 2023
Browse files
Merge branch 'big-refactor' into mypy
parents
a551c789
cc7828dd
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
1 deletion
+53
-1
lm_eval/tasks/wsc273/default.yaml
lm_eval/tasks/wsc273/default.yaml
+15
-0
lm_eval/tasks/wsc273/utils.py
lm_eval/tasks/wsc273/utils.py
+36
-0
main.py
main.py
+1
-0
setup.py
setup.py
+1
-1
No files found.
lm_eval/tasks/wsc273/default.yaml
0 → 100644
View file @
4721379e
task
:
wsc273
dataset_path
:
winograd_wsc
dataset_name
:
wsc273
output_type
:
multiple_choice
test_split
:
test
doc_to_text
:
label
process_docs
:
!function
utils.process_doc
doc_to_target
:
"
{%
set
index
=
pronoun_loc
+
pronoun
|
length
%}{{text[index:]}}"
doc_to_choice
:
"
{%
set
template
=
text[:pronoun_loc]
%}{{[template+options[0],
template+options[1]]}}"
should_decontaminate
:
true
doc_to_decontamination_query
:
text
metric_list
:
-
metric
:
acc
aggregation
:
mean
higher_is_better
:
true
lm_eval/tasks/wsc273/utils.py
0 → 100644
View file @
4721379e
upper_pronouns
=
[
"A"
,
"An"
,
"The"
,
"She"
,
"He"
,
"It"
,
"They"
,
"My"
,
"His"
,
"Her"
,
"Their"
,
]
def
process_doc
(
dataset
):
def
process_fn
(
doc
):
# The HF implementation of `wsc273` is not `partial evaluation` friendly.
doc
[
"text"
]
=
doc
[
"text"
].
replace
(
" "
,
" "
)
doc
[
"options"
][
0
]
=
__normalize_option
(
doc
,
doc
[
"options"
][
0
])
doc
[
"options"
][
1
]
=
__normalize_option
(
doc
,
doc
[
"options"
][
1
])
return
doc
return
dataset
.
map
(
process_fn
)
def
__normalize_option
(
doc
,
option
):
# Append `'s` to possessive determiner based options.
if
doc
[
"pronoun"
].
lower
()
in
[
"my"
,
"his"
,
"her"
,
"our"
,
"their"
]:
option
+=
"'s"
# Appropriately lowercase the pronoun in the option.
pronoun
=
option
.
split
()[
0
]
start_of_sentence
=
doc
[
"text"
][
doc
[
"pronoun_loc"
]
-
2
]
==
"."
if
not
start_of_sentence
and
pronoun
in
upper_pronouns
:
return
option
.
replace
(
pronoun
,
pronoun
.
lower
())
return
option
main.py
View file @
4721379e
...
@@ -11,6 +11,7 @@ from lm_eval import evaluator, utils
...
@@ -11,6 +11,7 @@ from lm_eval import evaluator, utils
from
lm_eval.api.registry
import
ALL_TASKS
from
lm_eval.api.registry
import
ALL_TASKS
from
lm_eval.logger
import
eval_logger
from
lm_eval.logger
import
eval_logger
from
lm_eval.tasks
import
include_task_folder
from
lm_eval.tasks
import
include_task_folder
from
lm_eval.benchmarks
import
include_benchmarks
os
.
environ
[
"TOKENIZERS_PARALLELISM"
]
=
"false"
os
.
environ
[
"TOKENIZERS_PARALLELISM"
]
=
"false"
...
...
setup.py
View file @
4721379e
...
@@ -53,7 +53,7 @@ setuptools.setup(
...
@@ -53,7 +53,7 @@ setuptools.setup(
],
],
python_requires
=
">=3.9"
,
python_requires
=
">=3.9"
,
install_requires
=
[
install_requires
=
[
"accelerate>=0.1
8
.0"
,
"accelerate>=0.
2
1.0"
,
"evaluate"
,
"evaluate"
,
"datasets>=2.0.0"
,
"datasets>=2.0.0"
,
"evaluate>=0.4.0"
,
"evaluate>=0.4.0"
,
...
...
Prev
1
2
3
Next
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