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', validation_json_generator: ValidationJsonGenerator | None = None, intime_model_selector: IntimeModelSelector | None = None, convert_to_fed_event: bool | ConvertToFedEvent | None = None, analytics_receiver: bool | ConvertToFedEvent | None = None, model_persistor: ModelPersistor | None = None, model_locator: ModelLocator | None = None)[source]¶
Bases:
FedJobPyTorch BaseFedJob.
Configures ValidationJsonGenerator, IntimeModelSelector, AnalyticsReceiver, ConvertToFedEvent.
User must add controllers and 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”.
validation_json_generator (ValidationJsonGenerator, optional) – A component for generating validation results. if not provided, a ValidationJsonGenerator will be configured.
intime_model_selector – (IntimeModelSelector, optional): A component for select the model. if not provided, an IntimeModelSelector will be configured.
convert_to_fed_event – (bool, ConvertToFedEvent, None): A component to covert certain events to fed events. if not provided, a ConvertToFedEvent object will be created.
analytics_receiver (bool, AnalyticsReceiver, None) – Receive analytics. If not provided, a TBAnalyticsReceiver will be configured.
model_persistor (optional, ModelPersistor) – how to persistor the model.
model_locator (optional, ModelLocator) – how to locate the model.