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
f2166089
Commit
f2166089
authored
Jun 07, 2023
by
lintangsutawika
Browse files
MODEL_REGISTRY to registry.py
parent
9e75a84d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
26 deletions
+0
-26
lm_eval/api/model.py
lm_eval/api/model.py
+0
-26
No files found.
lm_eval/api/model.py
View file @
f2166089
...
...
@@ -4,32 +4,6 @@ from typing import Union
from
lm_eval
import
utils
MODEL_REGISTRY
=
{}
def
register_model
(
*
names
):
# either pass a list or a single alias.
# function receives them as a tuple of strings
def
decorate
(
cls
):
for
name
in
names
:
assert
issubclass
(
cls
,
LM
),
f
"Model '
{
name
}
' (
{
cls
.
__name__
}
) must extend LM class"
assert
(
name
not
in
MODEL_REGISTRY
),
f
"Model named '
{
name
}
' conflicts with existing model! Please register with a non-conflicting alias instead."
MODEL_REGISTRY
[
name
]
=
cls
return
cls
return
decorate
def
get_model
(
model_name
):
return
MODEL_REGISTRY
[
model_name
]
class
LM
(
abc
.
ABC
):
def
__init__
(
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