nvflare.edge.updaters.emd module

class AggregatorFactory[source]

Bases: ABC

abstract get_aggregator() Aggregator[source]
class EdgeModelUpdater(aggr_factory_id: str | AggregatorFactory, max_model_versions: int)[source]

Bases: Updater

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.

end_task(fl_ctx: FLContext)[source]

This is called by HUG at the end of the task.

Parameters:

fl_ctx – FLContext object

Returns: None

prepare_update_for_parent(fl_ctx: FLContext) Shareable | None[source]

This is called by HUG to prepare update report to be sent to the parent.

Parameters:

fl_ctx – FLContext object

Returns: a Shareable object for the update report; or None if no update

process_child_update(update: ~nvflare.apis.shareable.Shareable, fl_ctx: ~nvflare.apis.fl_context.FLContext) -> (<class 'bool'>, typing.Optional[nvflare.apis.shareable.Shareable])[source]

This is called by HUG to process an update report from a child.

Parameters:
  • update – the update report from the child

  • fl_ctx – FLContext object

Returns: a tuple of (whether the update is accepted, reply to the child)

process_parent_update_reply(reply: Shareable, fl_ctx: FLContext)[source]

This is called by HUG to process the reply received from the parent for the update report sent to it. The reply typically contains information for how to update the current state of this Updater.

Parameters:
  • reply – the reply from the parent

  • fl_ctx – FLContext object

Returns: None

start_task(task_data: Shareable, fl_ctx: FLContext) Any[source]

This is called by HUG at the start of a task.

Parameters:
  • task_data – the task received from parent

  • fl_ctx – FLContext object

Returns: initialized task data

class ModelAggrState(aggregator: Aggregator, model_version: int)[source]

Bases: object

accept(contribution: Shareable, devices: Dict[str, float], fl_ctx: FLContext) bool[source]
reset(fl_ctx: FLContext)[source]
to_model_update(fl_ctx: FLContext) ModelUpdate[source]