You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
563 B
Python
23 lines
563 B
Python
8 months ago
|
# -*- coding: utf-8 -*-
|
||
|
# @Time : 2019/8/23 21:55
|
||
|
# @Author : zhoujun
|
||
|
import copy
|
||
|
from .model import Model
|
||
|
from .losses import build_loss
|
||
|
|
||
|
__all__ = ["build_loss", "build_model"]
|
||
|
support_model = ["Model"]
|
||
|
|
||
|
|
||
|
def build_model(config):
|
||
|
"""
|
||
|
get architecture model class
|
||
|
"""
|
||
|
copy_config = copy.deepcopy(config)
|
||
|
arch_type = copy_config.pop("type")
|
||
|
assert (
|
||
|
arch_type in support_model
|
||
|
), f"{arch_type} is not developed yet!, only {support_model} are support now"
|
||
|
arch_model = eval(arch_type)(copy_config)
|
||
|
return arch_model
|