ShardedDataset
Constructor
str
required
Path to the dataset directory.
Methods
__len__
get_shard_length
int
required
Shard index.
get_shard
int
required
Shard index to load.
set_processor
BaseProcessor
required
Processor instance to use for data processing.
get_dataset_statistics
dict[str, Any]
Dictionary containing statistics for each modality and joint group.
ShardedSingleStepDataset
- Loading episodes using LeRobotEpisodeLoader
- Splitting episodes into individual timesteps
- Organizing timesteps into balanced shards for efficient loading
- Supporting episode subsampling for data efficiency
Constructor
str | Path
required
Path to LeRobot format dataset directory.
EmbodimentTag
required
Embodiment identifier for cross-embodiment training.
dict[str, ModalityConfig]
required
Configuration for each modality (sampling, keys). Should include “video”, “state”, “action”, and optionally “language”.
str
default:"torchcodec"
Video decoding backend (‘torchcodec’, ‘decord’, etc.).
dict[str, Any] | None
default:"None"
Additional arguments for video backend.
int
default:"1024"
Target number of timesteps per shard.
float
default:"0.1"
Fraction of episode timesteps to use (for efficiency). Value of 0.1 means 10% of timesteps are sampled.
int
default:"42"
Random seed for reproducible sharding and sampling.
bool
default:"False"
Whether to allow padding of indices to valid range [0, max_length - 1].
Usage example
ShardedMixtureDataset
- Combines multiple ShardedDataset instances with specified mixing weights
- Implements intelligent shard sampling that accounts for dataset sizes
- Provides efficient background shard caching for continuous data loading
- Handles distributed training across multiple workers and processes
- Merges dataset statistics for consistent normalization
Constructor
list[ShardedDataset]
required
List of ShardedDataset instances to combine.
list[float]
required
Mixing weights for each dataset (will be normalized to sum to 1.0).
BaseProcessor
required
Data processor to apply to all datasets.
int
default:"42"
Random seed for reproducible sampling.
bool
default:"True"
Whether in training mode (affects sampling strategy). In training mode, samples shards randomly. In eval mode, samples every shard once.
int
default:"100000"
Number of shards to sample per epoch during training.
bool
default:"False"
Whether to override pretraining statistics with merged statistics.
Methods
merge_statistics
get_dataset_statistics
dict[str, dict[str, dict[str, list[float]]]]
Nested dictionary:
{embodiment_tag: {modality: {joint_group: {stat_type: values}}}}reset_seed
int
required
New random seed to use.
print_dataset_statistics
get_initial_actions
list
Combined list of initial actions from all constituent datasets.
Usage example
LeRobotEpisodeLoader
Constructor
str | Path
required
Path to dataset root directory containing meta/ and data files.
dict[str, ModalityConfig]
required
Dictionary mapping modality names to ModalityConfig objects that specify temporal sampling and data keys to load.
str
default:"torchcodec"
Video decoding backend (‘torchcodec’, ‘decord’, etc.).
dict[str, Any] | None
default:"None"
Additional arguments for the video backend.
Methods
__getitem__
int
required
Episode index to load.
pd.DataFrame
DataFrame with columns for all modalities and timestamps, with video frames as PIL Images.
get_dataset_statistics
dict[str, Any]
Nested dictionary:
{modality: {joint_group: {stat_type: values}}}get_initial_actions
list
List containing initial action dictionaries, or empty list if not available.