服务器#
- class Server(*, client_manager: ClientManager, strategy: Strategy | None = None)[源代码]#
基类:
object
Flower 服务器。
Methods
Return ClientManager.
disconnect_all_clients
(timeout)Send shutdown signal to all clients.
evaluate_round
(server_round, timeout)Validate current global model on a number of clients.
fit
(num_rounds, timeout)Run federated averaging for a number of rounds.
fit_round
(server_round, timeout)Perform a single round of federated averaging.
set_max_workers
(max_workers)Set the max_workers used by ThreadPoolExecutor.
set_strategy
(strategy)Replace server strategy.
- client_manager() ClientManager [源代码]#
Return ClientManager.
- evaluate_round(server_round: int, timeout: float | None) Tuple[float | None, Dict[str, bool | bytes | float | int | str], Tuple[List[Tuple[ClientProxy, EvaluateRes]], List[Tuple[ClientProxy, EvaluateRes] | BaseException]]] | None [源代码]#
Validate current global model on a number of clients.
- fit(num_rounds: int, timeout: float | None) Tuple[History, float] [源代码]#
Run federated averaging for a number of rounds.
- fit_round(server_round: int, timeout: float | None) Tuple[Parameters | None, Dict[str, bool | bytes | float | int | str], Tuple[List[Tuple[ClientProxy, FitRes]], List[Tuple[ClientProxy, FitRes] | BaseException]]] | None [源代码]#
Perform a single round of federated averaging.