nvflare.client.model_registry module

class ModelRegistry(config: ClientConfig, rank: str | None = None, flare_agent: FlareAgent | None = None)[source]

Bases: TaskRegistry

Gets and submits FLModel.

get_model(timeout: float | None = None) FLModel | None[source]

Gets a model from FLARE client.

This method gets the task from FLARE client, and extract the task.data out.

Parameters:

timeout (float, optional) – If specified, this call is blocked only for the specified amount of time. If not specified, this call is blocked forever until a task has been received or agent has been closed.

Returns:

None if flare agent is None; or an FLModel object if a task is available within timeout.

submit_model(model: FLModel) None[source]

Submits a model to FLARE client.

Parameters:

model (FLModel) – Trained local model to be submitted.