nvflare.app_common.np.np_model_persistor module

class NPModelPersistor(model_dir='models', model_name='server.npy')[source]

Bases: ModelPersistor

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(model_learnable: ModelLearnable, fl_ctx: FLContext)[source]

Persist the model object.

Parameters:
  • model – Model object to be saved

  • fl_ctx – FLContext