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
15c186b7
Commit
15c186b7
authored
Jul 04, 2023
by
lintangsutawika
Browse files
change variable name
parent
e5306ea6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lm_eval/tasks/super_glue/wsc/preprocess_wsc.py
lm_eval/tasks/super_glue/wsc/preprocess_wsc.py
+7
-7
No files found.
lm_eval/tasks/super_glue/wsc/preprocess_wsc.py
View file @
15c186b7
...
...
@@ -18,14 +18,14 @@ def t5_prompt_doc_to_text(x):
return
text
def
default_doc_to_text
(
doc
):
raw_passage
=
doc
[
"text"
]
def
default_doc_to_text
(
x
):
raw_passage
=
x
[
"text"
]
# NOTE: HuggingFace span indices are word-based not character-based.
pre
=
" "
.
join
(
raw_passage
.
split
()[:
doc
[
"span2_index"
]])
post
=
raw_passage
[
len
(
pre
)
+
len
(
doc
[
"span2_text"
])
+
1
:]
passage
=
general_detokenize
(
pre
+
" *{}*"
.
format
(
doc
[
"span2_text"
])
+
post
)
noun
=
doc
[
"span1_text"
]
pronoun
=
doc
[
"span2_text"
]
pre
=
" "
.
join
(
raw_passage
.
split
()[:
x
[
"span2_index"
]])
post
=
raw_passage
[
len
(
pre
)
+
len
(
x
[
"span2_text"
])
+
1
:]
passage
=
general_detokenize
(
pre
+
" *{}*"
.
format
(
x
[
"span2_text"
])
+
post
)
noun
=
x
[
"span1_text"
]
pronoun
=
x
[
"span2_text"
]
text
=
(
f
"Passage:
{
passage
}
\n
"
+
f
'Question: In the passage above, does the pronoun "*
{
pronoun
}
*" refer to "*
{
noun
}
*"?
\n
'
...
...
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