TridentDataModule

The default configuration (configs/datamodule/default.yaml) for a tridentdatamodule defines how training and evaluation datasets are instantiated. Each split is a dictionary of TridentDataspec.

_target_: trident.TridentDataModule
_recursive_: false

misc:
    # reserved key for general TridentDataModule configuration
train:
    # DictConfig of TridentDataspec
val:
    # DictConfig of TridentDataspec
test:
    # DictConfig of TridentDataspec

API

Methods

The below methods are user-facing TridentDataModule methods. Since TridentDataModule sub-classes the LightningDataModule, all methods, attributes, and hooks of the LightningDataModule are also available.

Important: You should not override the following methods:

  • train_dataloader

  • val_dataloader

  • test_dataloader

since the TridentDataModule automatically returns the dataloaders for the TridentDataspec enclosed in the configuration of the corresponding split.

setup

TridentDataModule.setup(stage=None)[source]
Return type:

None

get

TridentDataModule.get(split, default=None)[source]

Retrieve the TridentDataspecs for the given split.

This method attempts to fetch a dataspec associated with a specific split. If the split is not found, it returns a default value.

Parameters:
  • split (Split) – The Split used to retrieve the dataspec.

  • default (Optional[Any]) – The default value to return if the split is not found.

Return type:

Optional[DictList[TridentDataspec]]

Returns:

The DictList of TridentDataspec for the given split or None.

train_dataloader

TridentDataModule.train_dataloader()[source]
Return type:

Union[DataLoader, CombinedLoader]

val_dataloader

TridentDataModule.val_dataloader()[source]
Return type:

Union[DataLoader, CombinedLoader]

test_dataloader

TridentDataModule.test_dataloader()[source]
Return type:

Union[DataLoader, CombinedLoader]

predict_dataloader

TridentDataModule.predict_dataloader()[source]
Return type:

Union[DataLoader, CombinedLoader]