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
17396935
Commit
17396935
authored
Aug 05, 2024
by
lintangsutawika
Browse files
merged
parents
cd8642e7
458342e2
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
lm_eval/tasks/mmlu_pro/mmlu_pro_physics.yaml
lm_eval/tasks/mmlu_pro/mmlu_pro_physics.yaml
+5
-0
lm_eval/tasks/mmlu_pro/mmlu_pro_psychology.yaml
lm_eval/tasks/mmlu_pro/mmlu_pro_psychology.yaml
+5
-0
lm_eval/tasks/mmlu_pro/utils.py
lm_eval/tasks/mmlu_pro/utils.py
+63
-0
No files found.
lm_eval/tasks/mmlu_pro/mmlu_pro_physics.yaml
0 → 100644
View file @
17396935
description
:
"
The
following
are
multiple
choice
questions
(with
answers)
about
physics.
Think
step
by
step
and
then
finish
your
answer
with
\"
the
answer
is
(X)
\"
where
X
is
the
correct
letter
choice."
include
:
"
_default_template_yaml"
task
:
"
mmlu_pro_physics"
task_alias
:
"
physics"
process_docs
:
!function
utils.process_physics
lm_eval/tasks/mmlu_pro/mmlu_pro_psychology.yaml
0 → 100644
View file @
17396935
description
:
"
The
following
are
multiple
choice
questions
(with
answers)
about
psychology.
Think
step
by
step
and
then
finish
your
answer
with
\"
the
answer
is
(X)
\"
where
X
is
the
correct
letter
choice."
include
:
"
_default_template_yaml"
task
:
"
mmlu_pro_psychology"
task_alias
:
"
psychology"
process_docs
:
!function
utils.process_psychology
lm_eval/tasks/mmlu_pro/utils.py
0 → 100644
View file @
17396935
from
functools
import
partial
choices
=
[
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
]
def
format_cot_example
(
example
,
including_answer
=
True
):
prompt
=
"Question:
\n
"
question
=
example
[
"question"
]
options
=
example
[
"options"
]
prompt
+=
question
+
"
\n
"
prompt
+=
"Options:
\n
"
for
i
,
opt
in
enumerate
(
options
):
prompt
+=
"{}. {}
\n
"
.
format
(
choices
[
i
],
opt
)
if
including_answer
:
cot_content
=
example
[
"cot_content"
].
replace
(
"A: Let's think step by step."
,
"Answer: Let's think step by step."
)
prompt
+=
cot_content
+
"
\n\n
"
else
:
prompt
+=
"Answer: Let's think step by step."
return
prompt
doc_to_text
=
partial
(
format_cot_example
,
including_answer
=
False
)
fewshot_to_text
=
partial
(
format_cot_example
,
including_answer
=
True
)
def
process_docs
(
dataset
,
subject
):
return
dataset
.
filter
(
lambda
x
:
x
[
"category"
]
==
subject
)
process_biology
=
partial
(
process_docs
,
subject
=
"biology"
)
process_business
=
partial
(
process_docs
,
subject
=
"business"
)
process_chemistry
=
partial
(
process_docs
,
subject
=
"chemistry"
)
process_computer_science
=
partial
(
process_docs
,
subject
=
"computer_science"
)
process_economics
=
partial
(
process_docs
,
subject
=
"economics"
)
process_engineering
=
partial
(
process_docs
,
subject
=
"engineering"
)
process_health
=
partial
(
process_docs
,
subject
=
"health"
)
process_history
=
partial
(
process_docs
,
subject
=
"history"
)
process_law
=
partial
(
process_docs
,
subject
=
"law"
)
process_math
=
partial
(
process_docs
,
subject
=
"math"
)
process_other
=
partial
(
process_docs
,
subject
=
"other"
)
process_philosophy
=
partial
(
process_docs
,
subject
=
"philosophy"
)
process_physics
=
partial
(
process_docs
,
subject
=
"physics"
)
process_psychology
=
partial
(
process_docs
,
subject
=
"psychology"
)
Prev
1
2
Next
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