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
49be8ea2
"src/include/ConstantTensorDescriptor.hpp" did not exist on "50b96745c68d17c3c03b4492d23867eb5e859aa7"
Commit
49be8ea2
authored
Jan 19, 2024
by
lintangsutawika
Browse files
moved constructor process to inside load_yaml_config
parent
60a7af8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
lm_eval/utils.py
lm_eval/utils.py
+11
-2
No files found.
lm_eval/utils.py
View file @
49be8ea2
...
@@ -489,11 +489,20 @@ def import_function(loader, node):
...
@@ -489,11 +489,20 @@ def import_function(loader, node):
return
function
return
function
# Add the import_function constructor to the YAML loader
def
ignore_constructor
(
loader
,
node
):
yaml
.
add_constructor
(
"!function"
,
import_function
)
return
node
def
simple_load_yaml_config
(
yaml_path
=
None
,
yaml_config
=
None
,
yaml_dir
=
None
):
yaml
.
add_constructor
(
"!function"
,
ignore_constructor
)
with
open
(
yaml_path
,
"rb"
)
as
file
:
yaml_config
=
yaml
.
full_load
(
file
)
return
yaml_config
def
load_yaml_config
(
yaml_path
=
None
,
yaml_config
=
None
,
yaml_dir
=
None
):
def
load_yaml_config
(
yaml_path
=
None
,
yaml_config
=
None
,
yaml_dir
=
None
):
# Add the import_function constructor to the YAML loader
yaml
.
add_constructor
(
"!function"
,
import_function
)
if
yaml_config
is
None
:
if
yaml_config
is
None
:
with
open
(
yaml_path
,
"rb"
)
as
file
:
with
open
(
yaml_path
,
"rb"
)
as
file
:
yaml_config
=
yaml
.
full_load
(
file
)
yaml_config
=
yaml
.
full_load
(
file
)
...
...
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