nvflare.app_common.abstract.model_persistor module

class ModelPersistor[source]

Bases: LearnablePersistor, ABC

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

get_model(model_file, fl_ctx: FLContext) object[source]
get_model_inventory(fl_ctx: FLContext) {<class 'str'>: <class 'nvflare.app_common.model_desc.ModelDescriptor'>}[source]

Get the model inventory of the ModelPersister.

Parameters

fl_ctx – FLContext

Returns: { model_kind: ModelDescriptor }

load(fl_ctx: FLContext)[source]

Load the Learnable object.

Parameters

fl_ctx – FLContext

Returns

Learnable object loaded

abstract load_model(fl_ctx: FLContext) Learnable[source]

Initialize and load the model.

Parameters

fl_ctx – FLContext

Returns

Model object

save(learnable: Learnable, fl_ctx: FLContext)[source]

Persist the Learnable object.

Parameters
  • learnable – the Learnable object to be saved

  • fl_ctx – FLContext

abstract save_model(model: Learnable, fl_ctx: FLContext)[source]

Persist the model object.

Parameters
  • model – Model object to be saved

  • fl_ctx – FLContext