start_driver#

start_driver(*, server_address: str = '[::]:9091', server: Server | None = None, config: ServerConfig | None = None, strategy: Strategy | None = None, client_manager: ClientManager | None = None, root_certificates: str | bytes | None = None, driver: Driver | None = None) History[源代码]#

Start a Flower Driver API server.

参数:
  • server_address (Optional[str]) -- The IPv4 or IPv6 address of the Driver API server. Defaults to "[::]:8080".

  • server (Optional[flwr.server.Server] (default: None)) -- A server implementation, either flwr.server.Server or a subclass thereof. If no instance is provided, then start_driver will create one.

  • config (Optional[ServerConfig] (default: None)) -- 目前支持的值有:`num_rounds`(int,默认值:1)和以秒为单位的`round_timeout`(float,默认值:无)。

  • strategy (Optional[flwr.server.Strategy] (default: None).) -- 抽象基类 flwr.server.strategy.Strategy 的实现。如果没有提供策略,start_server 将使用 flwr.server.strategy.FedAvg

  • client_manager (Optional[flwr.server.ClientManager] (default: None)) -- An implementation of the class flwr.server.ClientManager. If no implementation is provided, then start_driver will use flwr.server.SimpleClientManager.

  • root_certificates (Optional[Union[bytes, str]] (default: None)) -- 字节字符串或路径字符串形式的 PEM 编码根证书。如果提供,将使用这些证书与启用 SSL 的 Flower 服务器建立安全连接。

  • driver (Optional[Driver] (default: None)) -- The Driver object to use.

返回:

hist -- 包含训练和评估指标的对象。

返回类型:

flwr.server.history.History

示例

Starting a driver that connects to an insecure server:

>>> start_driver()

Starting a driver that connects to an SSL-enabled server:

>>> start_driver(
>>>     root_certificates=Path("/crts/root.pem").read_bytes()
>>> )