Datamodules
Reference information for the Datamodule
classes and functions.
eva.data.DataModule
Bases: LightningDataModule
DataModule encapsulates all the steps needed to process data.
It will initialize and create the mapping between dataloaders and
datasets. During the prepare_data
, setup
and teardown
, the
datamodule will call the respective methods from all datasets,
given that they are defined.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datasets |
DatasetsSchema | None
|
The desired datasets. |
None
|
dataloaders |
DataloadersSchema | None
|
The desired dataloaders. |
None
|
Source code in src/eva/core/data/datamodules/datamodule.py
default_datasets: schemas.DatasetsSchema
property
Returns the default datasets.
default_dataloaders: schemas.DataloadersSchema
property
Returns the default dataloader schema.
eva.data.datamodules.call.call_method_if_exists
Calls a desired method
from the datasets if exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
objects |
Iterable[Any]
|
An iterable of objects. |
required |
method |
str
|
The dataset method name to call if exists. |
required |
Source code in src/eva/core/data/datamodules/call.py
eva.data.datamodules.schemas.DatasetsSchema
dataclass
Datasets schema used in DataModule.
train: TRAIN_DATASET = None
class-attribute
instance-attribute
Train dataset.
val: EVAL_DATASET = None
class-attribute
instance-attribute
Validation dataset.
test: EVAL_DATASET = None
class-attribute
instance-attribute
Test dataset.
predict: EVAL_DATASET = None
class-attribute
instance-attribute
Predict dataset.
tolist
Returns the dataclass as a list and optionally filters it given the stage.