manager#

Module Contents#

ClientManager

Base class for ClientManager.

ClientPassiveManager

Passive communication NetworkManager for client in synchronous FL pattern.

ClientActiveManager

Active communication NetworkManager for client in asynchronous FL pattern.

class ClientManager(network, trainer)#

Bases: fedlab.core.network_manager.NetworkManager

Base class for ClientManager.

ClientManager defines client activation for different communication stages.

Parameters
  • network (DistNetwork) – Network configuration.

  • trainer (ClientTrainer) – Subclass of ClientTrainer. Provides train() and model. Define local client training procedure.

setup(self)#

Initialization stage.

ClientManager reports number of clients simulated by current client process.

class ClientPassiveManager(network, trainer, logger=Logger())#

Bases: ClientManager

Passive communication NetworkManager for client in synchronous FL pattern.

Parameters
  • network (DistNetwork) – network configuration.

  • trainer (ClientTrainer) – Subclass of ClientTrainer. Provides train() and model. Define local client training procedure.

  • logger (Logger) – object of Logger.

main_loop(self)#

Actions to perform when receiving a new message, including local training.

Main procedure of each client:
  1. client waits for data from server (PASSIVELY).

  2. after receiving data, client start local model training procedure.

  3. client synchronizes with server actively.

synchronize(self)#

Synchronize local model with server

class ClientActiveManager(network, trainer, logger=Logger())#

Bases: ClientManager

Active communication NetworkManager for client in asynchronous FL pattern.

Parameters
  • network (DistNetwork) – network configuration.

  • trainer (ClientTrainer) – Subclass of ClientTrainer. Provides train() and model. Define local client training procedure.

  • logger (Logger, optional) – object of Logger.

main_loop(self)#

Actions to perform on receiving new message, including local training

  1. client requests data from server (ACTIVE)

  2. after receiving data, client will train local model

  3. client will synchronize with server actively

synchronize(self)#

Synchronize local model with server