nvflare.edge.assessors.model_manager module

class ModelManager[source]

Bases: FLComponent, ABC

Abstract base class for model managers in federated learning.

This class defines the interface that all model managers must implement. Model managers are responsible for handling model updates, aggregation, and version control in federated learning workflows.

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.

abstract generate_new_model(fl_ctx: FLContext) None[source]

Generate a new model version based on accumulated updates.

Parameters:
  • fl_ctx – FLContext object

  • Returns – none

get_current_model(fl_ctx: FLContext) Any[source]

Get the current model.

Parameters:

fl_ctx – FLContext object

Returns:

The current model

abstract initialize_model(model: Any, fl_ctx: FLContext) None[source]

Initialize the model manager with an initial model.

Parameters:
  • model – The initial model

  • fl_ctx – FLContext object

  • Returns – none

abstract process_updates(model_updates: Any, fl_ctx: FLContext) bool[source]

Process incoming model updates from clients.

Parameters:
  • model_updates – updates collected from clients

  • fl_ctx – FLContext object

Returns:

Whether the updates were successfully processed

Return type:

bool

abstract prune_model_versions(versions_to_keep: Set[int], fl_ctx: FLContext) None[source]

Prune the model versions that are no longer active.

Parameters:
  • versions_to_keep – Set of model versions to keep

  • fl_ctx – FLContext object

  • Returns – none