nvflare.app_common.np.np_model_persistor module¶
- class NPModelPersistor(model_dir='models', model_name='server.npy')[source]¶
Bases:
ModelPersistorModel persistor for numpy arrays.
Note
If the specified model can’t be found using “model_dir”/”model_name” Then default array of [[1, 2, 3], [4, 5, 6], [7, 8, 9]] is used.
- Parameters:
model_dir (str, optional) – model directory. Defaults to “models”.
model_name (str, optional) – model name. Defaults to “server.npy”.
- 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