Macrodata_Labs
AboutBlogDemo
Announcing MacroHands, our SOTA model for 3D hands and camera path from egocentric video!
// Docs›
Quickstart
Running pipelines
  • In-process debugging
  • Local launcher
Reading data
  • Reader model
  • Sharding
  • LeRobot reader
  • HDF5 reader
  • Zarr reader
  • MCAP reader
  • Tabular files
  • Files and videos
  • Hugging Face
  • TensorFlow
  • Lance
  • Custom readers
Episode data
  • Episode rows
  • Frames and videos
  • Metadata, tasks, and stats
  • Converting to robot rows
Transforms
  • Row transforms
  • Async and batch transforms
  • Vectorized transforms
  • Expressions
  • Schemas and DTypes
Episode operations
  • Motion trimming
  • Subtask annotation
Inference
  • Generate text
  • Multimodal and structured output
  • Inference providers
  • Pooling
Writing data
  • Writer model
  • LeRobot writer
  • Zarr writer
  • Parquet and JSONL writers
  • Lance
  • Media assets and reducers
Examples
  • ALOHA HDF5
  • robomimic HDF5
  • Zarr replay buffer
  • MCAP Franka
  • LIBERO HDF5
  • Merge LeRobot datasets
  • Annotate subtasks
Reference
  • Path formats
  • Optional dependencies
// Docs
Quickstart
Running pipelines
  • In-process debugging
  • Local launcher
Reading data
  • Reader model
  • Sharding
  • LeRobot reader
  • HDF5 reader
  • Zarr reader
  • MCAP reader
  • Tabular files
  • Files and videos
  • Hugging Face
  • TensorFlow
  • Lance
  • Custom readers
Episode data
  • Episode rows
  • Frames and videos
  • Metadata, tasks, and stats
  • Converting to robot rows
Transforms
  • Row transforms
  • Async and batch transforms
  • Vectorized transforms
  • Expressions
  • Schemas and DTypes
Episode operations
  • Motion trimming
  • Subtask annotation
Inference
  • Generate text
  • Multimodal and structured output
  • Inference providers
  • Pooling
Writing data
  • Writer model
  • LeRobot writer
  • Zarr writer
  • Parquet and JSONL writers
  • Lance
  • Media assets and reducers
Examples
  • ALOHA HDF5
  • robomimic HDF5
  • Zarr replay buffer
  • MCAP Franka
  • LIBERO HDF5
  • Merge LeRobot datasets
  • Annotate subtasks
Reference
  • Path formats
  • Optional dependencies

Custom readers

Create custom Refiner sources for data systems not covered by built-in readers

Use a custom source when your data cannot be described by a built-in reader. Custom sources are most useful for internal databases, generated tasks, or special storage layouts.

Minimal source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from collections.abc import Iterator

import refiner as mdr
from refiner.pipeline.sources import BaseSource
from refiner.pipeline.data.row import DictRow
from refiner.pipeline.data.shard import Shard


class EpisodesSource(BaseSource):
    name = "episodes"

    def list_shards(self) -> list[Shard]:
        return [Shard.from_row_range(start=0, end=10)]

    def read_shard(self, shard: Shard) -> Iterator[DictRow]:
        for episode_id in range(shard.descriptor.start, shard.descriptor.end):
            yield DictRow({"episode_id": str(episode_id), "frames": []})


pipeline = mdr.from_source(EpisodesSource())

The exact shard descriptor you use depends on how your source can be divided.

Keep planning cheap

list_shards() should not download the dataset or decode media. It should do only the work needed to create units that workers can read independently.

Describe the source

If your source appears in pipeline plans, implement a useful describe() method:

1
2
def describe(self) -> dict[str, object]:
    return {"path": "internal://episodes", "count": 10}

Descriptions should help users understand the job. Do not include secrets.

Related pages

  • Reader Model
  • Sharding
  • Converting to Robot Rows

// Table of Contents

  1. Minimal source
  2. Keep planning cheap
  3. Describe the source
  4. Related pages
Macrodata_Labs
TermsPrivacyContact
  • GitHub
  • LinkedIn
  • X
  • HuggingFace
  • Discord