qumphy.data.attractor module

File: qumphy/data/attractor.py Project: 22HLT01 QUMPHY Contact: oskar.pfeffer@ptb.de Gitlab: https://gitlab.com/qumphy Description: Attractor image dataset and lightning data module .

class qumphy.data.attractor.AttractorDataModule(data_directory, batch_size, num_workers)[source]

Bases: LightningDataModule

LightningDataModule implementation for the DeepBeat dataset.

setup(stage)[source]

Called at the beginning of fit (train + validate), validate, test, or predict. This is a good hook when you need to build models dynamically or adjust something about them. This hook is called on every process when using DDP.

Parameters:

stage – either 'fit', 'validate', 'test', or 'predict'

Example:

class LitModel(...):
    def __init__(self):
        self.l1 = None

    def prepare_data(self):
        download_data()
        tokenize()

        # don't do this
        self.something = else

    def setup(self, stage):
        data = load_data(...)
        self.l1 = nn.Linear(28, data.num_classes)
test_dataloader()[source]

Create the test dataloader.

Returns:

Dataloader for the test dataset.

Return type:

torch.utils.data.DataLoader

train_dataloader()[source]

Create the training dataloader.

Returns:

Dataloader for the training dataset.

Return type:

torch.utils.data.DataLoader

val_dataloader()[source]

Create the validation dataloader.

Returns:

Dataloader for the validation dataset.

Return type:

torch.utils.data.DataLoader

class qumphy.data.attractor.AttractorDataset(data_directory, subset)[source]

Bases: Dataset