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
e2112196
Unverified
Commit
e2112196
authored
Mar 25, 2021
by
Leo Gao
Committed by
GitHub
Mar 25, 2021
Browse files
Update fewshot_examples
parent
e3769082
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lm_eval/tasks/hendrycks_test.py
lm_eval/tasks/hendrycks_test.py
+5
-2
No files found.
lm_eval/tasks/hendrycks_test.py
View file @
e2112196
...
@@ -100,9 +100,12 @@ class GeneralHendrycksTest(MultipleChoiceTask):
...
@@ -100,9 +100,12 @@ class GeneralHendrycksTest(MultipleChoiceTask):
return
self
.
_load_docs
(
filename
)
return
self
.
_load_docs
(
filename
)
def
fewshot_examples
(
self
,
k
):
def
fewshot_examples
(
self
,
k
):
assert
k
<=
5
,
"Maximum 5 few shot examples."
# fewshot_examples is not just sampling from train_docs because dev is
# in the same distribution as val/test but auxiliary_train isn't
filename
=
self
.
DATASET_PATH
/
"dev"
/
f
"
{
self
.
subject
}
_dev.csv"
filename
=
self
.
DATASET_PATH
/
"dev"
/
f
"
{
self
.
subject
}
_dev.csv"
return
random
.
sample
(
list
(
self
.
_load_docs
(
filename
)),
k
)
rnd
=
random
.
Random
()
rnd
.
seed
(
42
)
return
rnd
.
sample
(
list
(
self
.
_load_docs
(
filename
)),
k
)
def
fewshot_description
(
self
):
def
fewshot_description
(
self
):
subject
=
self
.
subject
.
replace
(
"_"
,
" "
)
subject
=
self
.
subject
.
replace
(
"_"
,
" "
)
...
...
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