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
f2e3950b
Unverified
Commit
f2e3950b
authored
Oct 03, 2023
by
Hailey Schoelkopf
Committed by
GitHub
Oct 03, 2023
Browse files
Merge pull request #889 from tmabraham/master
Fix PubMedQA on master
parents
e1a8b2fa
27ddebd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
lm_eval/tasks/pubmedqa.py
lm_eval/tasks/pubmedqa.py
+18
-9
No files found.
lm_eval/tasks/pubmedqa.py
View file @
f2e3950b
...
@@ -33,34 +33,43 @@ _CITATION = """
...
@@ -33,34 +33,43 @@ _CITATION = """
class
Pubmed_QA
(
Task
):
class
Pubmed_QA
(
Task
):
VERSION
=
0
VERSION
=
0
DATASET_PATH
=
"pubmed_qa"
DATASET_PATH
=
"
bigbio/
pubmed_qa"
DATASET_NAME
=
"pqa_labeled"
DATASET_NAME
=
"p
ubmed_
qa_labeled
_fold0_source
"
def
has_training_docs
(
self
):
def
has_training_docs
(
self
):
return
Fals
e
return
Tru
e
def
has_validation_docs
(
self
):
def
has_validation_docs
(
self
):
return
Fals
e
return
Tru
e
def
has_test_docs
(
self
):
def
has_test_docs
(
self
):
return
True
return
True
def
training_docs
(
self
):
if
self
.
has_training_docs
():
if
self
.
_training_docs
is
None
:
self
.
_training_docs
=
self
.
dataset
[
"train"
]
return
self
.
_training_docs
def
validation_docs
(
self
):
if
self
.
has_validation_docs
():
return
self
.
dataset
[
"validation"
]
def
test_docs
(
self
):
def
test_docs
(
self
):
if
self
.
has_test_docs
():
if
self
.
has_test_docs
():
# HF is labelled as train but its really just for testing
return
self
.
dataset
[
"test"
]
return
self
.
dataset
[
"train"
]
def
doc_to_text
(
self
,
doc
):
def
doc_to_text
(
self
,
doc
):
ctxs
=
"
\n
"
.
join
(
doc
[
"
context"
][
"contexts
"
])
ctxs
=
"
\n
"
.
join
(
doc
[
"
CONTEXTS
"
])
return
"Abstract: {}
\n
Question: {}
\n
Answer:"
.
format
(
return
"Abstract: {}
\n
Question: {}
\n
Answer:"
.
format
(
ctxs
,
doc
[
"
question
"
],
doc
[
"final_decision"
]
ctxs
,
doc
[
"
QUESTION
"
],
doc
[
"final_decision"
]
)
)
def
should_decontaminate
(
self
):
def
should_decontaminate
(
self
):
return
True
return
True
def
doc_to_decontamination_query
(
self
,
doc
):
def
doc_to_decontamination_query
(
self
,
doc
):
return
doc
[
"question"
]
+
" "
+
"
\n
"
.
join
(
doc
[
"
context"
][
"contexts
"
])
return
doc
[
"question"
]
+
" "
+
"
\n
"
.
join
(
doc
[
"
CONTEXTS
"
])
def
doc_to_target
(
self
,
doc
):
def
doc_to_target
(
self
,
doc
):
return
" {}"
.
format
(
doc
[
"final_decision"
])
return
" {}"
.
format
(
doc
[
"final_decision"
])
...
...
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