create_zarr_arrays
create_zarr_arrays
¶
Shared zarr replay buffer creation utilities.
Provides a unified pipeline for creating zarr stores from any dataset schema, with WebP compression for uint8 images and lz4 for numerical arrays.
is_uint8_image_spec
¶
Check if a zarr array spec corresponds to a uint8 image array.
create_zarr_arrays
¶
Create zarr arrays with codec selection based on data type.
Uses WebP compression for uint8 image arrays and Blosc/lz4 for numerical arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_group
|
Group
|
Zarr group to create arrays in. |
required |
schema
|
DatasetSchema
|
Dataset schema providing array specifications. |
required |
image_codec
|
WebPCodec
|
WebP codec for uint8 image arrays. |
required |
numeric_compressor
|
BloscCodec
|
Blosc codec for numerical arrays. |
required |
Source code in src/versatil/data/preprocessing/create_zarr_arrays.py
create_zarr_replay_buffer
¶
Create a zarr replay buffer from an iterable of episodes.
Handles store creation, array setup with proper codecs, episode insertion, and metadata. Uses WebP for uint8 images and lz4 for numerical data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
DatasetSchema
|
Dataset schema with zarr_path and array specs. |
required |
episodes
|
Iterable[dict[str, ndarray]]
|
Iterable yielding episode dicts mapping keys to arrays. |
required |
total_episodes
|
int | None
|
Total number of episodes for progress reporting. |
None
|