nvflare.app_common.workflows.initialize_global_weights module

class InitializeGlobalWeights(task_name: str = 'get_weights', min_responses_required: int = 0, wait_time_after_min_received: int = 0, task_timeout: int = 0, weights_prop_name='global_model', weight_method: str = 'first', weights_client_name: List[str] | str | None = None)[source]

Bases: BroadcastAndProcess

A controller for initializing global model weights based on reported weights from clients.

Parameters:
  • task_name – name of the task to be sent to clients to collect their model weights

  • min_responses_required – min number of responses required. 0 means all clients.

  • wait_time_after_min_received – how long (secs) to wait after min responses are received

  • task_timeout – max amount of time to wait for the task to end. 0 means never time out.

  • weights_prop_name – name of the FL Context property to store the global weights

  • weight_method – method for determining global model weights. Defaults to WeightMethod.FIRST.

  • weights_client_name – name of the client if the method is “client”. Defaults to None. If None, the task will be sent to all clients (to be used with weight_method=WeightMethod.FIRST). If list of client names, the task will be only be sent to the listed clients.