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
72d7cc0c
"vscode:/vscode.git/clone" did not exist on "dabf0a2614fb9c353577c1437065fc523fa47495"
Commit
72d7cc0c
authored
Dec 31, 2021
by
rokosbasilisk
Browse files
remove _strip_bracket function
parent
04635731
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
lm_eval/tasks/asdiv.py
lm_eval/tasks/asdiv.py
+3
-15
No files found.
lm_eval/tasks/asdiv.py
View file @
72d7cc0c
...
@@ -56,19 +56,6 @@ class Asdiv(Task):
...
@@ -56,19 +56,6 @@ class Asdiv(Task):
out_doc
=
self
.
_convert_standard
(
problem
)
out_doc
=
self
.
_convert_standard
(
problem
)
yield
out_doc
yield
out_doc
def
_strip_bracket
(
self
,
test_str
):
ret
=
''
skip1c
=
0
skip2c
=
0
for
i
in
test_str
:
if
i
==
'('
:
skip2c
+=
1
elif
i
==
')'
and
skip2c
>
0
:
skip2c
-=
1
elif
skip1c
==
0
and
skip2c
==
0
:
ret
+=
i
return
ret
def
has_training_docs
(
self
):
def
has_training_docs
(
self
):
return
False
return
False
...
@@ -105,11 +92,12 @@ class Asdiv(Task):
...
@@ -105,11 +92,12 @@ class Asdiv(Task):
def
doc_to_target
(
self
,
doc
):
def
doc_to_target
(
self
,
doc
):
# TODO: add formula
# TODO: add formula
answer
=
self
.
_strip_bracket
(
doc
[
'answer'
])
answer
=
doc
[
'answer'
].
split
(
' ('
)[
0
]
print
(
answer
)
if
len
(
answer
)
>
0
:
# check if answer is present only in brackets
if
len
(
answer
)
>
0
:
# check if answer is present only in brackets
return
answer
return
answer
else
:
else
:
return
" "
+
doc
[
'answer'
]
return
doc
[
'answer'
]
def
construct_requests
(
self
,
doc
,
ctx
):
def
construct_requests
(
self
,
doc
,
ctx
):
ll
,
is_greedy
=
rf
.
loglikelihood
(
ctx
,
self
.
doc_to_target
(
doc
))
ll
,
is_greedy
=
rf
.
loglikelihood
(
ctx
,
self
.
doc_to_target
(
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