start_numpy_client

start_numpy_client(*, server_address: str, client: NumPyClient, grpc_max_message_length: int = 536870912, root_certificates: bytes | None = None, insecure: bool | None = None, transport: str | None = None) None[소스]

gRPC 서버에 연결되는 Flower NumPyClient를 시작합니다.

경고

이 함수는 1.7.0부터 더 이상 사용되지 않습니다. 대신 flwr.client.start_client`를 사용하고 먼저 :code:`to_client() 메서드를 실행하여 NumPyClient`를 :code:`flwr.client.Client 유형으로 변환합니다.

매개변수:
  • server_address (str) – 서버의 IPv4 또는 IPv6 주소입니다. Flower 서버가 포트 8080의 동일한 컴퓨터에서 실행되는 경우 `서버_주소`는 `”[::]:8080”`이 됩니다.

  • client (flwr.client.NumPyClient) – 추상 베이스 클래스 `flwr.client.NumPyClient`의 구현입니다.

  • grpc_max_message_length (int (default: 536_870_912, this equals 512MB)) – Flower 서버와 교환할 수 있는 gRPC 메시지의 최대 길이입니다. 기본값은 대부분의 모델에 충분합니다. 매우 큰 모델을 훈련하는 사용자는 이 값을 늘려야 할 수도 있습니다. Flower 서버는 동일한 값으로 시작해야 하며(flwr.server.start_server 참조), 그렇지 않으면 증가된 제한을 알지 못해 더 큰 메시지를 차단합니다.

  • root_certificates (bytes (default: None)) – 바이트 문자열 또는 경로 문자열로 PEM 인코딩된 루트 인증서. 제공하면 인증서를 사용하여 SSL이 활성화된 Flower 서버에 보안 연결이 설정됩니다.

  • insecure (Optional[bool] (default: None)) – True일 경우 안전하지 않은 gRPC 연결을 시작합니다. root_certificates`가 None인 경우 시스템 인증서를 사용하여 False일 때 HTTPS 연결을 활성화합니다.

  • transport (Optional[str] (default: None)) – 전송 계층을 구성합니다. 허용되는 값입니다: - ‘grpc-bidi’: gRPC, 양방향 스트리밍 - ‘grpc-rere’: gRPC, 요청-응답(실험적) - ‘rest’: HTTP(실험적)

예제

안전하지 않은 서버 연결로 gRPC 클라이언트 시작하기:

>>> start_numpy_client(
>>>     server_address=localhost:8080,
>>>     client=FlowerClient(),
>>> )

시스템 인증서를 사용하여 SSL 사용 gRPC 클라이언트를 시작합니다:

>>> start_numpy_client(
>>>     server_address=localhost:8080,
>>>     client=FlowerClient(),
>>>     insecure=False,
>>> )

제공된 인증서를 사용하여 SSL 지원 gRPC 클라이언트를 시작합니다:

>>> from pathlib import Path
>>>
>>> start_numpy_client(
>>>     server_address=localhost:8080,
>>>     client=FlowerClient(),
>>>     root_certificates=Path("/crts/root.pem").read_bytes(),
>>> )