tempor.utils.serialization module
Serialization utilities for models.
-
tempor.utils.serialization.save(model: Any) → bytes[source]
Save a model to bytes using cloudpickle. Companion to load.
- Parameters:
- model : Any
Model object to be saved.
- Returns:
Model serialized to bytes.
- Return type:
bytes
-
tempor.utils.serialization.load(buff: bytes) → Any[source]
Load a model from bytes using cloudpickle. Companion to save.
- Parameters:
- buff : bytes
Model as serialized to bytes (buffer), e.g. loaded from file.
- Returns:
The model object.
- Return type:
Any
-
tempor.utils.serialization.save_to_file(path: str | Path, model: Any) → None[source]
Save a model to file using cloudpickle. Companion to load_from_file.
- Parameters:
- path : Union[str, Path]
Path to save the model to.
- model : Any
The model object to be saved.
-
tempor.utils.serialization.load_from_file(path: str | Path) → Any[source]
Load a model from file using cloudpickle. Companion to save_to_file.
- Parameters:
- path : Union[str, Path]
The file path to load the model from.
- Returns:
The loaded model object.
- Return type:
Any