def test_from_aspired_model(aspired_models): asp_1, asp_2 = aspired_models asp_1.load_type = LoadType.local l = Loader.from_aspired_model(asp_1, '{}/data/model_load_dir'.format(dir_path)) asp_2.load_type = 'TEST' with pytest.raises(NotImplementedError): l = Loader.from_aspired_model( asp_2, '{}/data/model_load_dir'.format(dir_path))
def __init__(self, aspired_model: AspiredModel, model_dir: str = 'data/models'): logging.debug('Initialize servable {}'.format(aspired_model.model_name)) self.model_dir = model_dir self.aspired_model = aspired_model self.loader = Loader.from_aspired_model(aspired_model=aspired_model, model_dir=model_dir) self.meta_data: ServableMetaData = None self.model: ModelWrapper = None self.status = ServableStatus.NOT_LOADED self.update()