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
4a3c1f19
Commit
4a3c1f19
authored
May 16, 2023
by
lintangsutawika
Browse files
set template_aliases as conditional
parent
7d6b39ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lm_eval/api/task.py
lm_eval/api/task.py
+7
-7
No files found.
lm_eval/api/task.py
View file @
4a3c1f19
...
@@ -44,11 +44,10 @@ class TaskConfig(dict):
...
@@ -44,11 +44,10 @@ class TaskConfig(dict):
test_split
:
str
=
None
test_split
:
str
=
None
fewshot_split
:
str
=
None
# TODO: assert that this not None if num_fewshot > 0. (?) assert if this is same split as one evaling (?)
fewshot_split
:
str
=
None
# TODO: assert that this not None if num_fewshot > 0. (?) assert if this is same split as one evaling (?)
template_aliases
:
str
=
""
template_aliases
:
str
=
None
doc_to_text
:
Union
[
Callable
,
str
]
=
None
doc_to_text
:
Union
[
Callable
,
str
]
=
None
doc_to_target
:
Union
[
Callable
,
str
]
=
None
doc_to_target
:
Union
[
Callable
,
str
]
=
None
num_fewshot
:
int
=
0
num_fewshot
:
int
=
0
batch_size
:
int
=
1
batch_size
:
int
=
1
repeats
:
int
=
1
repeats
:
int
=
1
...
@@ -57,7 +56,7 @@ class TaskConfig(dict):
...
@@ -57,7 +56,7 @@ class TaskConfig(dict):
gold_alias
:
str
=
None
gold_alias
:
str
=
None
output_type
:
str
=
"greedy_until"
output_type
:
str
=
"greedy_until"
delimiter
:
str
=
"
\n\n
"
delimiter
:
str
=
"
\n\n
"
filters
:
str
=
None
#TODO: need to make this typehint `list`?
filters
:
Union
[
str
,
list
]
=
None
normalization
:
str
=
None
# TODO: add length-normalization of various types, mutual info
normalization
:
str
=
None
# TODO: add length-normalization of various types, mutual info
should_decontaminate
:
bool
=
False
should_decontaminate
:
bool
=
False
doc_to_decontamination_query
:
str
=
None
doc_to_decontamination_query
:
str
=
None
...
@@ -69,11 +68,12 @@ class TaskConfig(dict):
...
@@ -69,11 +68,12 @@ class TaskConfig(dict):
# allow user-specified aliases so that users can
# allow user-specified aliases so that users can
# force prompt-compatibility for some prompt regardless of
# force prompt-compatibility for some prompt regardless of
# field names in prompt
# field names in prompt
if
type
(
self
.
doc_to_text
)
==
str
:
if
self
.
template_aliases
!=
None
:
self
.
doc_to_text
=
self
.
template_aliases
+
self
.
doc_to_text
if
type
(
self
.
doc_to_text
)
==
str
:
self
.
doc_to_text
=
self
.
template_aliases
+
self
.
doc_to_text
if
type
(
self
.
doc_to_target
)
==
str
:
if
type
(
self
.
doc_to_target
)
==
str
:
self
.
doc_to_target
=
self
.
template_aliases
+
self
.
doc_to_target
self
.
doc_to_target
=
self
.
template_aliases
+
self
.
doc_to_target
# set "task_name" metadata field based on the "primary" name set
# set "task_name" metadata field based on the "primary" name set
if
self
.
names
:
if
self
.
names
:
...
...
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