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
3c895d56
Commit
3c895d56
authored
Jun 21, 2023
by
lintangsutawika
Browse files
reformat
parent
3262fb74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletion
+3
-1
lm_eval/tasks/hellaswag/hellaswag.yaml
lm_eval/tasks/hellaswag/hellaswag.yaml
+1
-1
lm_eval/utils.py
lm_eval/utils.py
+2
-0
No files found.
lm_eval/tasks/hellaswag/hellaswag.yaml
View file @
3c895d56
...
...
@@ -7,7 +7,7 @@ output_type: multiple_choice
training_split
:
train
validation_split
:
validation
test_split
:
null
template_aliases
:
"
{%
set
gold
=
label
%}{%
set
answer_choices
=
endings|map('regex_replace',
'
\\
[.*?
\\
]',
'')|map('replace',
'
[title]',
'.
')|map('replace',
'
',
'
')|list
%}"
template_aliases
:
"
{%
set
gold
=
label
%}{%
set
answer_choices
=
endings|map('regex_replace',
'
\\
[.*?
\\
]',
'')|map('replace',
'
[title]',
'.
')|map('replace',
'
',
'
')|list
%}"
doc_to_text
:
"
{%
set
text
=
activity_label
~
':
'
~
ctx_a
~
'
'
~
ctx_b.capitalize()
%}{{text|regex_replace('
\\
[.*?
\\
]',
'')|replace('
[title]',
'.
')|replace('
',
'
')}}"
doc_to_target
:
"
{{answer_choices[gold]}}"
gold_alias
:
"
{{gold}}"
...
...
lm_eval/utils.py
View file @
3c895d56
...
...
@@ -398,10 +398,12 @@ def load_yaml_config(yaml_path):
return
final_yaml_config
return
yaml_config
def
regex_replace
(
string
,
pattern
,
repl
,
count
=
0
):
"""Implements the `re.sub` function as a custom Jinja filter."""
return
re
.
sub
(
pattern
,
repl
,
string
,
count
=
count
)
env
=
Environment
(
loader
=
BaseLoader
,
undefined
=
StrictUndefined
)
env
.
filters
[
"regex_replace"
]
=
regex_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