コード例 #1
0
    def load_trainer(self):
        """Setting up the global model to be trained via federated learning."""
        if self.trainer is None:
            self.trainer = trainers_registry.get(model=self.model)

        self.trainer.set_client_id(0)

        if self.algorithm is None:
            self.algorithm = algorithms_registry.get(self.trainer)
コード例 #2
0
    def configure(self) -> None:
        """Prepare this client for training."""
        super().configure()

        if self.trainer is None:
            self.trainer = trainers_registry.get(self.model)
        self.trainer.set_client_id(self.client_id)

        if self.algorithm is None:
            self.algorithm = algorithms_registry.get(self.trainer)
        self.algorithm.set_client_id(self.client_id)

        # Pass inbound and outbound data payloads through processors for
        # additional data processing
        self.outbound_processor, self.inbound_processor = processor_registry.get(
            "Client", client_id=self.client_id, trainer=self.trainer)