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
020abc86
Commit
020abc86
authored
Sep 13, 2023
by
lintangsutawika
Browse files
add qasper in scrolls
parent
c87703f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
lm_eval/tasks/scrolls/metrics.py
lm_eval/tasks/scrolls/metrics.py
+34
-0
lm_eval/tasks/scrolls/qasper/boolean_task.yaml
lm_eval/tasks/scrolls/qasper/boolean_task.yaml
+15
-0
lm_eval/tasks/scrolls/qasper/freeform_task.yaml
lm_eval/tasks/scrolls/qasper/freeform_task.yaml
+14
-0
No files found.
lm_eval/tasks/scrolls/metrics.py
0 → 100644
View file @
020abc86
import
evaluate
rouge_fn
=
evaluate
.
load
(
'rouge'
)
def
rouge1
(
predictions
,
references
):
results
=
rouge_fn
.
compute
(
predictions
=
predictions
,
references
=
references
)
return
results
[
'rouge1'
]
def
rouge2
(
predictions
,
references
):
results
=
rouge_fn
.
compute
(
predictions
=
predictions
,
references
=
references
)
return
results
[
'rouge2'
]
def
rougeL
(
predictions
,
references
):
results
=
rouge_fn
.
compute
(
predictions
=
predictions
,
references
=
references
)
return
results
[
'rougeL'
]
squad_metric
=
evaluate
.
load
(
"squad_v2"
)
def
agg_f1
(
samples
):
predictions
,
references
=
zip
(
*
samples
)
# unzip, if you will
computed
=
squad_metric
.
compute
(
predictions
=
predictions
,
references
=
references
)
return
computed
[
"f1"
]
def
_download_metric
():
import
os
import
shutil
from
huggingface_hub
import
hf_hub_download
scrolls_metric_path
=
hf_hub_download
(
repo_id
=
"tau/scrolls"
,
repo_type
=
"dataset"
,
filename
=
"metrics/scrolls.py"
)
updated_scrolls_metric_path
=
(
os
.
path
.
dirname
(
scrolls_metric_path
)
+
os
.
path
.
basename
(
scrolls_metric_path
).
replace
(
"."
,
"_"
)
+
".py"
)
shutil
.
copy
(
scrolls_metric_path
,
updated_scrolls_metric_path
)
return
updated_scrolls_metric_path
\ No newline at end of file
lm_eval/tasks/scrolls/qasper/boolean_task.yaml
0 → 100644
View file @
020abc86
group
:
scrolls
task
:
scrolls_qasper_boolean
dataset_path
:
tau/scrolls
dataset_name
:
qasper
output_type
:
multiple_choice
training_split
:
train
validation_split
:
validation
process_docs
:
!function
../preprocessors.process_docs_prepended_question
doc_to_text
:
"
{{text}}
\n\n
Hypothesis:
{{question}}
\n
Conclusion:"
doc_to_target
:
"
{{outputs[0]}}"
doc_to_choice
:
[
"
yes"
,
"
no"
]
should_decontaminate
:
true
doc_to_decontamination_query
:
input
metric_list
:
-
metric
:
f1
lm_eval/tasks/scrolls/qasper/freeform_task.yaml
0 → 100644
View file @
020abc86
group
:
scrolls
task
:
scrolls_qasper_freeform
dataset_path
:
tau/scrolls
dataset_name
:
qasper
output_type
:
greedy_until
training_split
:
train
validation_split
:
validation
process_docs
:
!function
../preprocessors.process_docs_prepended_question
doc_to_text
:
"
{{text}}
\n\n
Hypothesis:
{{question}}
\n
Conclusion:"
doc_to_target
:
"
{{outputs[0]}}"
should_decontaminate
:
true
doc_to_decontamination_query
:
input
metric_list
:
-
metric
:
f1
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