nvflare.app_common.app_defined.model_persistor module¶
- class AppDefinedModelPersistor[source]¶
Bases:
ModelPersistor
,ComponentBase
,ABC
Abstract class. Implementations will need to implement the load_model() and save_model() methods to persist & load the current ModelLearnable.
- Parameters:
filter_id – Optional string that defines a filter component that is applied to prepare the model to be saved, e.g. for serialization of custom Python objects.
- load_model(fl_ctx: FLContext) ModelLearnable [source]¶
Initialize and load the model.
- Parameters:
fl_ctx – FLContext
- Returns:
Model object
- save_model(learnable: ModelLearnable, fl_ctx: FLContext)[source]¶
Persist the model object.
- Parameters:
model – Model object to be saved
fl_ctx – FLContext