episodic_dataset
episodic_dataset
¶
EpisodicDataset
¶
EpisodicDataset(zarr_path, action_space, observation_space, dataloader_config, pred_horizon, obs_horizon, train=True, seed=42, augment_images=None, replay_buffer=None)
Bases: Dataset
PyTorch Dataset for episodic robot demonstration data.
This class orchestrates modular components for: - Action processing - Data augmentation - Sample building - Episode splitting and management
Initialize episodic dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zarr_path
|
str
|
Path to zarr replay buffer |
required |
action_space
|
ActionSpace
|
TaskSpace action space config (what to predict and how) |
required |
observation_space
|
ObservationSpace
|
TaskSpace observation space config (what to use as observation data) |
required |
dataloader_config
|
DataLoaderConfig
|
Data loading settings (splits, normalization types, augmentation pipelines, downsampling, padding). |
required |
pred_horizon
|
int
|
Prediction horizon, i.e. chunk size. |
required |
obs_horizon
|
int
|
Observation horizon, i.e. history size. |
required |
train
|
bool
|
Whether to use training mode. |
True
|
seed
|
int
|
Random seed of the experiment. |
42
|
augment_images
|
bool | None
|
Whether image augmentations are enabled. Defaults
to |
None
|
replay_buffer
|
ReplayBuffer | None
|
Already-loaded replay buffer to reuse, avoiding a second in-memory copy when train and validation datasets share one store. |
None
|
Source code in src/versatil/data/episodic_dataset.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
__len__
¶
__getitem__
¶
Get a training sample.
Source code in src/versatil/data/episodic_dataset.py
get_normalizer_and_tokenizer
¶
get_normalizer_and_tokenizer(device=None, winsorize_depth=True, depth_winsorize_quantiles=(0.01, 0.99), winsorize_kinematics=False, kinematics_winsorize_quantiles=(0.01, 0.99), tokenization_config=None, clamp_kinematics_range=True, min_kinematics_std=0.02, min_kinematics_range=0.04, action_sample_size=2048)
Get normalizer and optionally tokenizer for this dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device
|
device | None
|
Target device for tensors |
None
|
winsorize_depth
|
bool
|
Apply winsorization to depth values |
True
|
depth_winsorize_quantiles
|
tuple[float, float] | None
|
Quantiles for depth winsorization |
(0.01, 0.99)
|
winsorize_kinematics
|
bool
|
Apply winsorization to kinematics |
False
|
kinematics_winsorize_quantiles
|
tuple[float, float] | None
|
Quantiles for kinematics winsorization |
(0.01, 0.99)
|
tokenization_config
|
TokenizationConfig | None
|
Tokenization configuration. If None, no tokenizer created. |
None
|
clamp_kinematics_range
|
bool
|
Whether to clamp std/range to minimum values. |
True
|
min_kinematics_std
|
float
|
Minimum std for Gaussian mode when clamp_kinematics_range=True. |
0.02
|
min_kinematics_range
|
float
|
Minimum range for MinMax mode when clamp_kinematics_range=True. |
0.04
|
action_sample_size
|
int
|
Number of action rows to stash on the normalizer per action key for downstream data-aware initialization. Set to 0 to disable. |
2048
|
Returns:
| Type | Description |
|---|---|
tuple[LinearNormalizer, Tokenizer | None]
|
Tuple of (normalizer, tokenizer) where tokenizer is None if not configured |
Source code in src/versatil/data/episodic_dataset.py
set_tokenizer
¶
Set tokenizer for the sample builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokenizer
|
Tokenizer | None
|
Unified tokenizer containing observation and action tokenizers |
required |
Source code in src/versatil/data/episodic_dataset.py
set_normalizer
¶
Set normalizer for the dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
normalizer
|
LinearNormalizer
|
Normalizer for observations and actions |
required |
get_gripper_positive_class_imbalance_weight
¶
Get class imbalance weight for binary gripper actions.
This is only meaningful for binary grippers where we want to compute the ratio of negative to positive samples for class-weighted BCE loss.
Returns:
| Type | Description |
|---|---|
float
|
Weight for positive class (ratio of negative to positive samples) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If gripper is not configured or is not binary type |