unienv_data.integrations.lerobot¶
Classes:
| Name | Description |
|---|---|
LeRobotAsUniEnvDataset |
Wraps a local LeRobot dataset directory as a UniEnv BatchBase. |
LeRobotAsUniEnvDataset
¶
LeRobotAsUniEnvDataset(
dataset_dir: str,
schema: LeRobotSchema,
index: LeRobotIndex,
space: DictSpace,
_backend: ComputeBackend,
_device: Optional[Any] = None,
decode_video: bool = True,
video_backend: Literal["pyav", "torchcodec", "auto"] = "auto",
include_features: Optional[List[str]] = None,
exclude_features: Optional[List[str]] = None,
video_hwaccel: Optional[Any] = "auto",
)
Bases: BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
Wraps a local LeRobot dataset directory as a UniEnv BatchBase.
Parses the LeRobot on-disk format natively (no lerobot package required).
Supports v2.0, v2.1, and v3.0 dataset formats.
Usage::
from unienv_interface.backends.numpy import NumpyComputeBackend
dataset = LeRobotAsUniEnvDataset.from_local(
"/path/to/lerobot/dataset",
backend=NumpyComputeBackend,
)
frame = dataset[42]
batch = dataset[0:100]
Methods:
| Name | Description |
|---|---|
from_local |
Load a LeRobot dataset from a local directory. |
from_hub |
Download a LeRobot dataset from HuggingFace Hub and load it. |
get_at |
|
get_at_with_metadata |
|
get_column |
Return a view over a single feature column, joining nested keys with dots. |
get_episode |
Load all frames for a single episode. |
close |
|
get_flattened_at |
Fetch samples as flattened backend arrays. |
get_flattened_at_with_metadata |
Fetch flattened samples together with optional per-sample metadata. |
set_flattened_at |
Overwrite existing samples using flattened data. |
append_flattened |
Append one flattened sample to the batch. |
extend_flattened |
Append a batched block of flattened samples. |
set_at |
Overwrite existing samples using structured data. |
remove_at |
Remove one or more samples from the batch. |
append |
Append one structured sample to the batch. |
extend |
Append a batched block of structured samples. |
extend_from |
Copy data from another batch in bounded-size chunks. |
get_slice |
Create a lazy view over a subset of indices. |
Attributes:
| Name | Type | Description |
|---|---|---|
is_mutable |
|
|
num_episodes |
int
|
|
fps |
int
|
|
schema |
LeRobotSchema
|
|
episode_metadata |
List[EpisodeMetadata]
|
|
single_space |
|
|
single_metadata_space |
|
|
backend |
ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
device |
Optional[BDeviceType]
|
|
from_local
staticmethod
¶
from_local(
dataset_dir: str,
backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType],
device: Optional[BDeviceType] = None,
include_features: Optional[List[str]] = None,
exclude_features: Optional[List[str]] = None,
decode_video: bool = True,
video_backend: Literal["pyav", "torchcodec", "auto"] = "auto",
video_hwaccel: Optional[Any] = "auto",
) -> LeRobotAsUniEnvDataset[BArrayType, BDeviceType, BDtypeType, BRNGType]
Load a LeRobot dataset from a local directory.
video_hwaccel is passed to the video readers: "auto" (default) uses a hardware
decoder when one is available, None decodes in software, which is cheaper to open
and often faster for small frames read at random positions (the usual training case).
from_hub
staticmethod
¶
from_hub(
repo_id: str,
backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType],
device: Optional[BDeviceType] = None,
revision: Optional[str] = None,
local_dir: Optional[str] = None,
**kwargs,
) -> LeRobotAsUniEnvDataset[BArrayType, BDeviceType, BDtypeType, BRNGType]
Download a LeRobot dataset from HuggingFace Hub and load it.
Uses huggingface_hub.snapshot_download (not the lerobot package).
get_at_with_metadata
¶
get_at_with_metadata(
idx: Union[IndexableType, BArrayType],
) -> Tuple[BatchT, Dict[str, Any]]
get_column
¶
get_column(nested_keys: Sequence[str]) -> BatchBase
Return a view over a single feature column, joining nested keys with dots.
get_flattened_at
¶
get_flattened_at(idx: Union[IndexableType, BArrayType]) -> BArrayType
Fetch samples as flattened backend arrays.
get_flattened_at_with_metadata
¶
get_flattened_at_with_metadata(
idx: Union[IndexableType, BArrayType],
) -> Tuple[BArrayType, Optional[Dict[str, Any]]]
Fetch flattened samples together with optional per-sample metadata.
set_flattened_at
¶
set_flattened_at(idx: Union[IndexableType, BArrayType], value: BArrayType) -> None
Overwrite existing samples using flattened data.
append_flattened
¶
Append one flattened sample to the batch.
extend_flattened
¶
Append a batched block of flattened samples.
set_at
¶
set_at(idx: Union[IndexableType, BArrayType], value: BatchT) -> None
Overwrite existing samples using structured data.
remove_at
¶
remove_at(idx: Union[IndexableType, BArrayType]) -> None
Remove one or more samples from the batch.
extend_from
¶
extend_from(
other: BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType],
chunk_size: int = 8,
tqdm: bool = False,
) -> None
Copy data from another batch in bounded-size chunks.
get_slice
¶
get_slice(
idx: Union[IndexableType, BArrayType],
) -> BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
Create a lazy view over a subset of indices.