nvflare.app_common.abstract.fl_model module

class FLModel(params_type: None | str | ParamsType = None, params: Any | None = None, optimizer_params: Any | None = None, metrics: Dict | None = None, start_round: int | None = 0, current_round: int | None = None, total_rounds: int | None = None, meta: Dict | None = None)[source]

Bases: object

FLModel is a standardize data structure for NVFlare to communicate with external systems.

Parameters:
  • params_type – type of the parameters. It only describes the “params”. If params_type is None, params need to be None. If params is provided but params_type is not provided, then it will be treated as FULL.

  • params – model parameters, for example: model weights for deep learning.

  • optimizer_params – optimizer parameters. For many cases, the optimizer parameters don’t need to be transferred during FL training.

  • metrics – evaluation metrics such as loss and scores.

  • current_round – the current FL rounds. A round means round trip between client/server during training. None for inference.

  • total_rounds – total number of FL rounds. A round means round trip between client/server during training. None for inference.

  • meta – metadata dictionary used to contain any key-value pairs to facilitate the process.

summary()[source]
class FLModelConst[source]

Bases: object

CURRENT_ROUND = 'current_round'
META = 'meta'
METRICS = 'metrics'
OPTIMIZER_PARAMS = 'optimizer_params'
PARAMS = 'params'
PARAMS_TYPE = 'params_type'
START_ROUND = 'start_round'
TOTAL_ROUNDS = 'total_rounds'
class MetaKey[source]

Bases: FLMetaKey

class ParamsType(value)[source]

Bases: str, Enum

An enumeration.

DIFF = 'DIFF'
FULL = 'FULL'