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
d9862c58
Commit
d9862c58
authored
May 10, 2023
by
lintangsutawika
Browse files
moved registry processes here
parent
484fa090
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
lm_eval/utils.py
lm_eval/utils.py
+29
-5
No files found.
lm_eval/utils.py
View file @
d9862c58
import
os
import
pathlib
import
re
import
collections
import
functools
import
inspect
import
sys
import
yaml
import
inspect
import
pathlib
import
functools
import
subprocess
import
collections
from
typing
import
List
from
omegaconf
import
OmegaConf
...
...
@@ -253,8 +256,29 @@ def get_git_commit_hash():
return
git_hash
env
=
Environment
(
loader
=
BaseLoader
,
undefined
=
StrictUndefined
)
def
get_yaml_config
(
yaml_path
):
with
open
(
yaml_path
,
"r"
)
as
f
:
return
yaml
.
load
(
f
,
yaml
.
Loader
)
def
RegistryDecorator
():
registry
=
{}
def
registrar
(
func
):
if
func
.
TASK_NAME
is
None
:
name
=
func
.
__name__
else
:
name
=
func
.
TASK_NAME
registry
[
name
]
=
func
return
func
registrar
.
all
=
registry
return
registrar
register_task
=
RegistryDecorator
()
env
=
Environment
(
loader
=
BaseLoader
,
undefined
=
StrictUndefined
)
def
apply_template
(
template
,
doc
):
rtemplate
=
env
.
from_string
(
template
)
...
...
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