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
eb29b97b
Commit
eb29b97b
authored
Jun 30, 2023
by
Benjamin Fattori
Browse files
pubmed_qa implemented and tested
parent
e50c8c70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
lm_eval/tasks/pubmedqa/preprocess_pubmedqa.py
lm_eval/tasks/pubmedqa/preprocess_pubmedqa.py
+16
-0
lm_eval/tasks/pubmedqa/pubmedqa.yaml
lm_eval/tasks/pubmedqa/pubmedqa.yaml
+20
-0
No files found.
lm_eval/tasks/pubmedqa/preprocess_pubmedqa.py
0 → 100644
View file @
eb29b97b
def
doc_to_text
(
doc
):
ctxs
=
"
\n
"
.
join
(
doc
[
"context"
][
"contexts"
])
return
"Abstract: {}
\n
Question: {}
\n
Answer:"
.
format
(
ctxs
,
doc
[
"question"
],
doc
[
"final_decision"
]
)
def
doc_to_target
(
doc
):
return
" {}"
.
format
(
doc
[
"final_decision"
])
def
gold_alias
(
doc
):
dict_to_label
=
{
'yes'
:
0
,
'no'
:
1
,
'maybe'
:
2
}
return
dict_to_label
[
doc
[
"final_decision"
]]
\ No newline at end of file
lm_eval/tasks/pubmedqa/pubmedqa.yaml
View file @
eb29b97b
group
:
-
multiple_choice
task
:
pubmed_qa
dataset_path
:
pubmed_qa
dataset_name
:
pqa_labeled
output_type
:
multiple_choice
training_split
:
null
validation_split
:
null
test_split
:
train
template_aliases
:
"
{%
set
answer_choices
=
['yes',
'no',
'maybe']
%}{%
set
gold
=
final_decision
%}"
doc_to_text
:
!function
preprocess_pubmedqa.doc_to_text
doc_to_target
:
!function
preprocess_pubmedqa.doc_to_target
gold_alias
:
!function
preprocess_pubmedqa.gold_alias
metric_list
:
-
metric
:
acc
aggregation
:
mean
higher_is_better
:
true
-
metric
:
acc_norm
aggregation
:
mean
higher_is_better
:
true
\ No newline at end of file
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