taps.apps.fedlearn.client¶
create_clients
¶
create_clients(
num_clients: int,
data_name: DataChoices,
train: bool,
train_data: Dataset,
data_alpha: float,
rng: Generator,
) -> list[Client]
Create many clients with disjoint sets of data.
Parameters:
-
num_clients
(int
) –Number of clients to create.
-
data_name
(DataChoices
) –The name of the data used. Used for initializing the corresponding model.
-
train
(bool
) –If the application is using the no-op training task, then this function skips the step for giving each client their own subset of data.
-
train_data
(Dataset
) –The original dataset that will be split across the clients.
-
data_alpha
(float
) –The Dirichlet distribution alpha value for the number of samples across clients.
-
rng
(Generator
) –Random number generator.
Returns:
Source code in taps/apps/fedlearn/client.py
unweighted_module_avg
¶
unweighted_module_avg(
selected_clients: list[Client],
) -> OrderedDict[str, Tensor]
Compute the unweighted average of models.