taps.apps.fedlearn.modules¶
CifarModule
¶
CifarModule(num_classes: int)
Bases: Module
Cifar model.
Source: https://www.kaggle.com/code/shadabhussain/cifar-10-cnn-using-pytorch
Source code in taps/apps/fedlearn/modules.py
MnistModule
¶
Bases: Module
Model for MNIST and FashionMNIST data.
Source code in taps/apps/fedlearn/modules.py
forward
¶
create_model
¶
create_model(data: DataChoices) -> Module
Create a model suitable for the dataset choice.
Note
The currently supported dataset options are MNIST
, FashionMNIST
,
CIFAR10
, and CIFAR100
.
Parameters:
-
data
(DataChoices
) –Name of dataset that will be used for training (and testing).
Returns:
-
Module
–PyTorch model.
Raises:
-
ValueError
–If an unsupported value for
data
is provided.
Source code in taps/apps/fedlearn/modules.py
load_data
¶
load_data(
data_name: DataChoices,
root: Path,
train: bool,
download: bool = False,
) -> Dataset
Load dataset for training.
Parameters:
-
data_name
(DataChoices
) –Dataset choice.
-
root
(Path
) –Root dataset directory.
-
train
(bool
) –Flag for if training.
-
download
(bool
, default:False
) –Should the dataset be downloaded.
Returns:
-
Dataset
(Dataset
) –description