sourced.ml.core.models.model_converters.base

Module Contents

class sourced.ml.core.models.model_converters.base.Model2Base(num_processes: int = 0, log_level: int = logging.DEBUG, overwrite_existing: bool = True)[source]

Bases:sourced.ml.core.utils.pickleable_logger.PickleableLogger

Base class for model -> model conversions.

MODEL_FROM_CLASS[source]
MODEL_TO_CLASS[source]
convert(self, models_path: List[str], destdir: str)[source]

Performs the model -> model conversion. Runs the conversions in a pool of processes.

Parameters:
  • models_path – List of Models path.
  • destdir – The directory where to store the models. The directory structure is preserved.
Returns:

The number of converted files.

convert_model(self, model: Model)[source]

This must be implemented in the child classes.

Parameters:model – The model instance to convert.
Returns:The converted model instance or None if it is not needed.
finalize(self, index: int, destdir: str)[source]

Called for each worker in the end of the processing.

Parameters:
  • index – Worker’s index.
  • destdir – The directory where to store the models.