florist.api.clients.clients module¶
Implementation of the clients and the Client enumeration.
- class Client(value)[source]¶
- Bases: - Enum- Enumeration of supported clients. - FEDAVG = 'FedAvg'¶
 - FEDPROX = 'FedProx'¶
 - get_client_class()[source]¶
- Return the class for this client. - Return type:
- Returns:
- (type[LocalDataClient]) A subclass of LocalDataClient corresponding to the this client. 
- Raises:
- ValueError – if the client is not supported. 
 
 
- class FedProxLocalDataClient(data_path, metrics, device, loss_meter_type=LossMeterType.AVERAGE, checkpoint_and_state_module=None, reporters=None, progress_bar=False, client_name=None)[source]¶
- Bases: - FedProxClient,- LocalDataClient- Implementation of the FedProx client that uses a model with data stored locally. - get_data_loaders(config)[source]¶
- Return the data loader for FedProx on model with data stored locally. - Parameters:
- config ( - dict[- str,- Union[- bool,- bytes,- float,- int,- str]]) – (Config) the Config object for this client.
- Return type:
- tuple[- DataLoader[- TensorDataset],- DataLoader[- TensorDataset]]
- Returns:
- (Tuple[DataLoader[TensorDataset], DataLoader[TensorDataset]]) a tuple with the train data loader and validation data loader respectively. 
 
 
- class LocalDataClient(data_path, metrics, device, loss_meter_type=LossMeterType.AVERAGE, checkpoint_and_state_module=None, reporters=None, progress_bar=False, client_name=None)[source]¶
- Bases: - BasicClient- Implementation of a client that uses a model with data stored locally. - get_data_loaders(config)[source]¶
- Return the data loader for the model with local data. - Parameters:
- config ( - dict[- str,- Union[- bool,- bytes,- float,- int,- str]]) – (Config) the Config object for this client.
- Return type:
- tuple[- DataLoader[- TensorDataset],- DataLoader[- TensorDataset]]
- Returns:
- (Tuple[DataLoader[TensorDataset], DataLoader[TensorDataset]]) a tuple with the train data loader and validation data loader respectively. 
 
 - set_model(model)[source]¶
- Set the model to be used for training with local data. - Parameters:
- model ( - LocalDataModel) – (LocalModel) An instance of the model to be used for training.
- Return type: