def _build(cfg, **kwargs): logging.getLogger('tl').info(f"Building {cfg.name} ...") # REGISTRY._obj_map.clear() register_modules(register_modules=cfg.get('register_modules', {})) ret = REGISTRY.get(cfg.name)(cfg=cfg, **kwargs) # REGISTRY._obj_map.clear() return ret
def _build(cfg, kwargs_priority, cfg_to_kwargs, **kwargs): cfg = cfg.clone() logging.getLogger('tl').info(f"Building {cfg.name} ...") register_modules(register_modules=cfg.pop('register_modules', [])) print("") if not cfg_to_kwargs: ret = REGISTRY.get(cfg.name)(cfg=cfg, kwargs_priority=kwargs_priority, **kwargs) else: ret = build_from_cfg(cfg=cfg, registry=REGISTRY, kwargs_priority=kwargs_priority, default_args=kwargs) return ret