model.repository.model_repository
Module Contents
Classes
Model repository allows user to persist and load model to different storage system. |
Functions
|
Helper function to create a tar archive |
|
Helper function to extract a tar archive |
Attributes
- model.repository.model_repository.SEP = ::
- class model.repository.model_repository.ModelSerDe
- STATS_PATH = stats.joblib
- METRICS_PATH = metrics.joblib
- RULE_DETAILS_PATH = rule_details.joblib
- RULE_ENGINE_PATH = rule_engine.joblib
- METAINFO_FILE = METAINFO.yaml
- _is_builtin_class_instance(self, obj)
- _serialize_basic_obj(self, d, path, obj_file)
- _deserialize_basic_obj(self, path, obj_file)
- _serialize_dict(self, d, path, dict_file)
- _deserialize_dict(self, path, dict_file)
- _get_rule_engine_type(self, rules)
- _get_model_type(self, model)
- _get_supported_rule_engines(self)
- _serialize_rule_engine(self, rules, path, rules_name='rules')
- _deserialize_rule_engine(self, model, path, rule_engine_type, rules_path)
- _serialize_single_model(self, model, path, model_name='model')
- _deserialize_single_model(self, model, path, model_type, model_path)
- serialize(self, model, path)
Serialize a H1ST model’s model property to disk.
- Parameters
model – H1ST Model
path – path to save models to
- deserialize(self, model, path)
Populate a H1ST model’s model property with saved atomic models.
- Parameters
model – H1ST Model
path – path to model folder
- class model.repository.model_repository.ModelRepository(storage=None)
Model repository allows user to persist and load model to different storage system.
Model repository uses
ModelSerDer
to serialize a model into a temporary folder and then create a tar archive to store on storage. For loading, the repo retrieve the tar archive from the storage and then extract to temporary folder for restoring the model object.- _NAMESPACE = _models
- _DEFAULT_STORAGE
- persist(self, model, version=None)
Save a model to the model repository
- Parameters
model – target model
version – version name, leave blank for autogeneration
- Returns
model version
- load(self, model, version=None)
Restore the model from the model repository
- Parameters
model – target model
version – version name, leave blank to load the latest version
- delete(self, model, version)
Delete a model from model repository
- Parameters
model – model instance or the model class
version – target version
- download(self, model, version, path)
Download a model archive to local disk
- Parameters
model – model instance or model class
version – version name
path – target folder to extract the model archive
- _get_key(self, model, version)
- classmethod get_model_repo(cls, ref=None)
Retrieve the default model repository for the project
- Parameters
ref – target model
- Returns
Model repository instance
- model.repository.model_repository._tar_create(target, source)
Helper function to create a tar archive
- model.repository.model_repository._tar_extract(source, target)
Helper function to extract a tar archive