task
task
¶
Task space definitions for runtime data requirements.
This module defines what data an experiment uses at runtime:
ActionSpace
¶
ActionSpace(actions_metadata, use_gripper_class_weights=False, denoise_actions=True, denoising_percentile=15.0)
Defines what actions the task will predict at runtime.
Attributes:
| Name | Type | Description |
|---|---|---|
actions_metadata |
Dict of all action metadata, indexed by zarr store key. Values are OnTheFlyActionMetadata or PrecomputedActionMetadata subclasses. |
|
use_gripper_class_weights |
Whether to use class weights for binary gripper. |
|
denoise_actions |
Whether to apply denoising to actions. |
|
denoising_percentile |
Percentile for denoising threshold. |
Source code in src/versatil/data/task.py
precomputed_actions
property
¶
Get precomputed actions loaded directly from zarr.
orientation_actions
property
¶
Get all orientation actions (precomputed or on-the-fly).
predicted_action_keys
property
¶
Return action keys predicted by the policy in metadata order.
predicted_action_dimensions
property
¶
Return predicted action dimensions keyed by action name.
total_prediction_dimension
property
¶
Return total predicted continuous action dimension.
has_on_the_fly_actions
property
¶
Check if there are any actions to compute on-the-fly.
has_precomputed_actions
property
¶
Check if there are any precomputed actions.
has_only_precomputed_actions
property
¶
Check if every action in the space is precomputed (no on-the-fly computation).
has_orientation_actions
property
¶
Check if there are any orientation actions.
get_total_action_dim
¶
validate_action_tensors
¶
Validate action tensors against this action-space schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions
|
dict[str, Tensor]
|
Action tensors keyed by action name. |
required |
prediction_horizon
|
int
|
Expected action chunk length. |
required |
owner_name
|
str
|
Name used in error messages. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, device]
|
Shared batch size and device. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If keys, ranks, dimensions, batch size, or devices are invalid. |
Source code in src/versatil/data/task.py
concatenate_action_tensors
¶
Concatenate predicted action tensors in action-space order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions
|
dict[str, Tensor]
|
Action tensors keyed by action name. |
required |
prediction_horizon
|
int
|
Expected action chunk length. |
required |
owner_name
|
str
|
Name used in validation errors. |
required |
dtype
|
dtype | None
|
Optional dtype for the returned tensor. |
None
|
device
|
device | None
|
Optional device for the returned tensor. |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Concatenated action tensor with shape |
Tensor
|
|
Source code in src/versatil/data/task.py
split_action_tensor
¶
Split a joint action tensor into action-space components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action_tensor
|
Tensor
|
Tensor with final dimension equal to the total predicted action dimension. |
required |
owner_name
|
str
|
Name used in validation errors. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Action tensors keyed by action name. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the final dimension does not match the action space. |
Source code in src/versatil/data/task.py
get_required_zarr_keys
¶
Get zarr keys needed for this action space.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of keys to load from replay buffer |
ObservationSpace
¶
Defines what observations the task will load at runtime.
Attributes:
| Name | Type | Description |
|---|---|---|
observations_metadata |
Dict of all observation metadata, indexed by zarr store key. Values are ObservationMetadata subclasses or CameraMetadata. |
Source code in src/versatil/data/task.py
proprioceptive_observations
property
¶
Get robot proprioceptive observations (position, orientation, gripper).
custom_observations
property
¶
Get custom observations (not position, orientation, gripper, or camera).
has_proprioceptive_state
property
¶
Check if any proprioceptive observations are included.
has_proprioceptive_position
property
¶
Check if any position observations are included.
has_proprioceptive_orientation
property
¶
Check if any orientation observations are included.
get_required_zarr_keys
¶
Get all zarr keys needed for this observation space.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of keys to load from replay buffer |
TaskSpace
¶
TaskSpace(dataset_schema, dataloader, action_space, observation_space, prediction_horizon=16, observation_horizon=1)
Combines action/observation space with dataset schema for runtime.
The task space validates that requested keys exist in the dataset schema and that metadata is consistent between the schema and task requirements.
Initialize task space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_schema
|
DatasetSchema
|
Schema defining what's in the zarr store. |
required |
dataloader
|
DataLoaderConfig
|
Data loading configuration. |
required |
action_space
|
ActionSpace
|
Actions to predict. |
required |
observation_space
|
ObservationSpace
|
Observations to load. |
required |
prediction_horizon
|
int
|
Number of timesteps to predict. |
16
|
observation_horizon
|
int
|
Number of history timesteps to load. |
1
|