__init__.py 563 B

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. # @Time : 2019/8/23 21:55
  3. # @Author : zhoujun
  4. import copy
  5. from .model import Model
  6. from .losses import build_loss
  7. __all__ = ["build_loss", "build_model"]
  8. support_model = ["Model"]
  9. def build_model(config):
  10. """
  11. get architecture model class
  12. """
  13. copy_config = copy.deepcopy(config)
  14. arch_type = copy_config.pop("type")
  15. assert (
  16. arch_type in support_model
  17. ), f"{arch_type} is not developed yet!, only {support_model} are support now"
  18. arch_model = eval(arch_type)(copy_config)
  19. return arch_model