nvflare.app_opt.pt.job_config.base_fed_job module

class BaseFedJob(initial_model: Module | None = None, name: str = 'fed_job', min_clients: int = 1, mandatory_clients: List[str] | None = None, key_metric: str = 'accuracy')[source]

Bases: FedJob

PyTorch BaseFedJob.

Configures server side FedAvg controller, persistor with initial model, and widgets.

User must add executors.

Parameters:
  • initial_model (nn.Module) – initial PyTorch Model. Defaults to None.

  • name (name, optional) – name of the job. Defaults to “fed_job”.

  • min_clients (int, optional) – the minimum number of clients for the job. Defaults to 1.

  • mandatory_clients (List[str], optional) – mandatory clients to run the job. Default None.

  • key_metric (str, optional) – Metric used to determine if the model is globally best. if metrics are a dict, key_metric can select the metric used for global model selection. Defaults to “accuracy”.

set_up_client(target: str)[source]

Setup routine called by FedJob when first sending object to a client target.

Parameters:

target – the target to perform setup.

Returns: