nvflare.app_common.shareablegenerators package

Submodules

Module contents

class FullModelShareableGenerator[source]

Bases: ShareableGenerator

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.

learnable_to_shareable(model_learnable: ModelLearnable, fl_ctx: FLContext) Shareable[source]

Convert ModelLearnable to Shareable.

Parameters:
  • model_learnable (ModelLearnable) – model to be converted

  • fl_ctx (FLContext) – FL context

Returns:

a shareable containing a DXO object.

Return type:

Shareable

shareable_to_learnable(shareable: Shareable, fl_ctx: FLContext) ModelLearnable[source]

Convert Shareable to ModelLearnable.

Supporting TYPE == TYPE_WEIGHT_DIFF or TYPE_WEIGHTS

Parameters:
  • shareable (Shareable) – Shareable that contains a DXO object

  • fl_ctx (FLContext) – FL context

Returns:

A ModelLearnable object

Raises:
  • TypeError – if shareable is not of type shareable

  • ValueError – if data_kind is not DataKind.WEIGHTS and is not DataKind.WEIGHT_DIFF