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
c37268bb
Commit
c37268bb
authored
May 18, 2023
by
lintangsutawika
Browse files
update fewshot_docs
parent
b7f896c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
lm_eval/api/task.py
lm_eval/api/task.py
+15
-5
No files found.
lm_eval/api/task.py
View file @
c37268bb
...
@@ -289,7 +289,7 @@ class Task(abc.ABC):
...
@@ -289,7 +289,7 @@ class Task(abc.ABC):
doc
,
self
.
_config
.
num_fewshot
,
rnd
=
random
.
Random
()
doc
,
self
.
_config
.
num_fewshot
,
rnd
=
random
.
Random
()
)
)
# TODO: hardcoded for now: # of runs on each input to be 2. # TODO: we should override this if doing greedy gen so users don't waste time+compute
# TODO: hardcoded for now: # of runs on each input to be 2. # TODO: we should override this if doing greedy gen so users don't waste time+compute
inst
=
self
.
construct_requests
(
doc
=
doc
,
ctx
=
fewshot_ctx
,
metadata
=
(
self
.
_config
[
"task_name"
],
doc_id
,
1
))
inst
=
self
.
construct_requests
(
doc
=
doc
,
ctx
=
fewshot_ctx
,
metadata
=
(
self
.
_config
[
"task_name"
],
doc_id
,
self
.
_config
.
repeats
))
if
not
isinstance
(
inst
,
list
):
if
not
isinstance
(
inst
,
list
):
inst
=
[
inst
]
inst
=
[
inst
]
...
@@ -507,8 +507,18 @@ class ConfigurableTask(Task):
...
@@ -507,8 +507,18 @@ class ConfigurableTask(Task):
kwargs
kwargs
])
])
filter_pipeline
=
build_filter_ensemble
(
filter_name
,
components
)
filter_pipeline
=
build_filter_ensemble
(
filter_name
,
components
)
self
.
_filters
.
append
(
filter_pipeline
)
self
.
_filters
.
append
(
filter_pipeline
)
else
:
self
.
_filters
=
[
build_filter_ensemble
(
"take_first"
,
[[
"take_first"
,
None
]]
)
]
if
self
.
fewshot_docs
()
!=
None
:
if
self
.
fewshot_docs
()
!=
None
:
self
.
sampler
=
samplers
.
Sampler
(
list
(
self
.
fewshot_docs
()),
self
,
rnd
=
random
.
Random
())
# TODO: pass the correct docs in here
self
.
sampler
=
samplers
.
Sampler
(
list
(
self
.
fewshot_docs
()),
self
,
rnd
=
random
.
Random
())
# TODO: pass the correct docs in here
...
@@ -546,12 +556,12 @@ class ConfigurableTask(Task):
...
@@ -546,12 +556,12 @@ class ConfigurableTask(Task):
def
fewshot_docs
(
self
):
def
fewshot_docs
(
self
):
if
(
self
.
_config
.
num_fewshot
>
0
)
and
(
self
.
_config
.
fewshot_split
==
None
):
if
(
self
.
_config
.
num_fewshot
>
0
)
and
(
self
.
_config
.
fewshot_split
==
None
):
eval_logger
.
warning
(
eval_logger
.
warning
(
"num_fewshot > 0 but fewshot_split is None"
,
"num_fewshot > 0 but fewshot_split is None
.
"
"using preconfigured rule."
"using preconfigured rule."
)
)
return
super
().
fewshot_docs
()
return
super
().
fewshot_docs
()
if
self
.
_config
.
fewshot_split
:
el
if
self
.
_config
.
fewshot_split
!=
None
:
return
self
.
dataset
[
self
.
_config
.
fewshot_split
]
return
self
.
dataset
[
self
.
_config
.
fewshot_split
]
def
should_decontaminate
(
self
):
def
should_decontaminate
(
self
):
...
...
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