nvflare.app_common.utils.fl_model_utils module

class FLModelUtils[source]

Bases: object

static from_dxo(dxo: DXO) FLModel[source]

Converts DXO to FLModel.

static from_shareable(shareable: Shareable, fl_ctx: FLContext | None = None) FLModel[source]

From NVFlare side shareable to FLModel.

This is a temporary solution to converts the shareable of existing style to FLModel, so that we can reuse the existing components we have.

In the future, we should be using the to_dxo, from_dxo directly. And all the components should be changed to accept the standard DXO.

static get_configs(model: FLModel) dict | None[source]
static get_meta_prop(model: FLModel, key: str, default=None)[source]
static set_meta_prop(model: FLModel, key: str, value: Any)[source]
static to_dxo(fl_model: FLModel) DXO[source]

Converts FLModel to a DXO.

static to_shareable(fl_model: FLModel) Shareable[source]

From FLModel to NVFlare side shareable.

This is a temporary solution to converts FLModel to the shareable of existing style, so that we can reuse the existing components we have.

In the future, we should be using the to_dxo, from_dxo directly. And all the components should be changed to accept the standard DXO.

static update_model(model: FLModel, model_update: FLModel, replace_meta: bool = True) FLModel[source]