personalitylinmult.data.datamodule

Lightning DataModule over the built FI HDF5 file.

Attributes

logger

Module-level logger.

Classes

FiDataModule

Serves the FI splits from the single HDF5 artifact.

Functions

seed_worker(→ None)

Seed a dataloader worker's RNGs from torch's per-worker seed.

Module Contents

personalitylinmult.data.datamodule.logger

Module-level logger.

personalitylinmult.data.datamodule.seed_worker(worker_id: int) → None[source]

Seed a dataloader worker’s RNGs from torch’s per-worker seed.

Without this, every worker inherits the parent’s numpy seed and augmentation draws repeat across workers.

Parameters:

worker_id (int) – Worker index, unused but required by the hook.

class personalitylinmult.data.datamodule.FiDataModule(config: personalitylinmult.train.config.DataConfig, target_names: list[str])[source]

Bases: lightning.LightningDataModule

Serves the FI splits from the single HDF5 artifact.

Parameters:
  • config (DataConfig) – Dataloader configuration.

  • target_names (list[str]) – Label columns for the active task, in head order.

prepare_data_per_node

If True, each LOCAL_RANK=0 will call prepare data. Otherwise only NODE_RANK=0, LOCAL_RANK=0 will prepare data.

allow_zero_length_dataloader_with_multiple_devices

If True, dataloader with zero length within local rank is allowed. Default value is False.

setup(stage: str | None = None) → None[source]

Construct the datasets needed for a stage.

Parameters:

stage (str | None) – "fit", "validate", "test", or None for all.

train_dataloader() → torch.utils.data.DataLoader[source]

Training loader.

Returns:

Shuffled, drop-last loader over the train split.

Return type:

DataLoader

Raises:

RuntimeError – If called before setup.

val_dataloader() → torch.utils.data.DataLoader[source]

Validation loader.

Returns:

Deterministic loader over the valid split.

Return type:

DataLoader

Raises:

RuntimeError – If called before setup.

test_dataloader() → torch.utils.data.DataLoader[source]

Test loader.

Returns:

Deterministic loader over the test split.

Return type:

DataLoader

Raises:

RuntimeError – If called before setup.