blazefl.core.ServerHandler#
- class blazefl.core.ServerHandler[source]#
Bases:
ABC
,Generic
[UplinkPackage
,DownlinkPackage
]Abstract base class for server-side operations in federated learning.
This class defines the essential methods that a server handler must implement to manage communication and coordination with clients during federated learning processes. It uses generic types UplinkPackage and DownlinkPackage to define the types of data exchanged between the server and clients.
- Raises:
NotImplementedError – If any of the methods are not implemented in a subclass.
- __init__()#
Methods
__init__
()Prepare the data package to be sent from the server to clients.
global_update
(buffer)Update the global model based on the aggregated data from clients.
if_stop
()Determine whether the federated learning process should be terminated.
load
(payload)Load a given payload into the server's state.
Select a list of client IDs to participate in the current training round.
- abstract downlink_package() DownlinkPackage [source]#
Prepare the data package to be sent from the server to clients.
- Returns:
The data package intended for client consumption.
- Return type:
DownlinkPackage
- abstract global_update(buffer: list[UplinkPackage]) None [source]#
Update the global model based on the aggregated data from clients.
- Parameters:
buffer (list[UplinkPackage]) – A list containing data sent by clients,
gradients. (typically representing model updates or)
- Returns:
None
- abstract if_stop() bool [source]#
Determine whether the federated learning process should be terminated.
- Returns:
True if the process should stop; False otherwise.
- Return type:
bool