__init__.py 528 Bytes
Newer Older
Nianchen Deng's avatar
sync    
Nianchen Deng committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import importlib
import os
from .utils import *


# Automatically import model files this directory
package_dir = os.path.dirname(__file__)
package = os.path.basename(package_dir)
for file in os.listdir(package_dir):
    path = os.path.join(package_dir, file)
    if file.startswith('_') or file.startswith('.') or file == "utils.py":
        continue
    if file.endswith('.py') or os.path.isdir(path):
        model_name = file[:-3] if file.endswith('.py') else file
        importlib.import_module(f'{package}.{model_name}')