"test/algo/compression/assets/__init__.py" did not exist on "6aaca5f7ad2f0f169cc9439407a2137c44a25de9"
__init__.py 663 Bytes
Newer Older
Jason Phang's avatar
gpt3  
Jason Phang committed
1
2
import importlib
import os
Jason Phang's avatar
lib  
Jason Phang committed
3
from lm_eval.base import Registry
Jason Phang's avatar
gpt3  
Jason Phang committed
4
5
6
7
8
9
10
11
12
13
14
15

MODEL_REGISTRY = Registry(registry_name="models")
# Load all modules in models directory to populate registry
models_dir = os.path.dirname(__file__)
for file in os.listdir(models_dir):
    path = os.path.join(models_dir, file)
    if (
        not file.startswith('_')
        and not file.startswith('.')
        and (file.endswith('.py') or os.path.isdir(path))
    ):
        module_name = file[:file.find('.py')] if file.endswith('.py') else file
Jason Phang's avatar
lib  
Jason Phang committed
16
        module = importlib.import_module('lm_eval.models.' + module_name)
Jason Phang's avatar
gpt3  
Jason Phang committed
17
18
19
20


def get_model(model_name):
    return MODEL_REGISTRY.registry[model_name]