experanto.dataloaders.get_multisession_dataloader

get_multisession_dataloader(paths, configs=None, shuffle_keys=False, **kwargs)[source]

Create a multi-session dataloader from multiple experiment paths.

By default, creates a ChunkDataset for each path and wraps them in a LongCycler that yields (session_key, batch) pairs. The cycler continues until the longest session is exhausted.

Parameters:
  • paths (list of str) – Paths to experiment directories.

  • configs (dict, DictConfig, list, optional) – Configuration for each dataset. If a single config is provided, it will be applied to all datasets. If a list is provided, it should match the length of paths. Each config should have dataset and dataloader keys.

  • shuffle_keys (bool, default=False) – Whether to shuffle the order of session keys.

  • **kwargs – Additional keyword arguments. Supports config as an alias for configs.

Returns:

A dataloader-like object that yields (session_key, batch) tuples. Iterates until the longest session is exhausted.

Return type:

LongCycler

See also

get_multisession_concat_dataloader

Alternative that concatenates sessions.

LongCycler

The underlying multi-session iterator.

Examples

>>> from experanto.dataloaders import get_multisession_dataloader
>>> from experanto.configs import DEFAULT_CONFIG
>>> paths = ['/path/to/exp1', '/path/to/exp2']
>>> loader = get_multisession_dataloader(paths, configs=DEFAULT_CONFIG)
>>> for session_key, batch in loader:
...     print(f"Session: {session_key}, batch shape: {batch['responses'].shape}")