manager#
Module Contents#
Base class for ClientManager. |
|
Passive communication |
|
Active communication |
- class ClientManager(network: fedlab.core.network.DistNetwork, trainer: fedlab.core.model_maintainer.ModelMaintainer)#
Bases:
fedlab.core.network_manager.NetworkManager
Base class for ClientManager.
ClientManager
defines client activation in different communication stages.- Parameters:
network (DistNetwork) – Network configuration and interfaces.
trainer (ModelMaintainer) – Subclass of
ClientTrainer
orSerialClientTrainer
. Provideslocal_process()
anduplink_package
. Define local client training procedure.
- setup()#
Initialization stage.
ClientManager
reports number of clients simulated by current client process.
- class PassiveClientManager(network: fedlab.core.network.DistNetwork, trainer: fedlab.core.model_maintainer.ModelMaintainer, logger: fedlab.utils.Logger = None)#
Bases:
ClientManager
Passive communication
NetworkManager
for client in synchronous FL pattern.- Parameters:
network (DistNetwork) – Network configuration and interfaces.
trainer (ModelMaintainer) – Subclass of
ClientTrainer
orSerialClientTrainer
. Provideslocal_process()
anduplink_package
. Define local client training procedure.logger (Logger, optional) – Object of
Logger
.
- main_loop()#
Actions to perform when receiving a new message, including local training.
- Main procedure of each client:
client waits for data from server (PASSIVELY).
after receiving data, client start local model training procedure.
client synchronizes with server actively.
- synchronize()#
Synchronize with server.
- class ActiveClientManager(network: fedlab.core.network.DistNetwork, trainer: fedlab.core.client.trainer.ClientTrainer, logger: fedlab.utils.Logger = None)#
Bases:
ClientManager
Active communication
NetworkManager
for client in asynchronous FL pattern.- Parameters:
network (DistNetwork) – Network configuration and interfaces.
trainer (ClientTrainer) – Subclass of
ClientTrainer
. Provideslocal_process()
anduplink_package
. Define local client training procedure.logger (Logger, optional) – Object of
Logger
.
- main_loop()#
Actions to perform on receiving new message, including local training.
client requests data from server (ACTIVELY).
after receiving data, client will train local model.
client will synchronize with server actively.
- request()#
Client request.
- synchronize()#
Synchronize with server.