# Dataset format

> The LeRobotDataset layout the hub reads, which versions the episode viewer supports, and what it does with the rest.

Prompt for your AI: Read https://mousemouse.ai/docs/dataset-format.md first. Check whether the dataset in this folder is one the hub can read, and tell me what to fix if it is not. Ask me before anything that costs money or moves a robot.

A dataset repo on MouseMouse is just files. Upload whatever you like. If the
layout is a [LeRobotDataset](https://huggingface.co/docs/lerobot), the hub
recognises it and the repo page gets an **Episodes** tab. It shows the recorded
video and the robot posed in MuJoCo side by side, with per-joint charts grouped
by limb underneath, all on one clock. Click a chart to seek.

The **Sim replay** pane poses the robot the data was recorded on, when the hub
can tell which robot that is. [How the hub finds the robot](#which-robot-recorded-it)
is below.

LeRobot's format is the spec, and its docs are the reference. This page says
what the hub does with it.

## The layout the hub looks for

```
meta/info.json          the manifest — fps, features, and the path templates
meta/episodes.jsonl     one line per episode: index, length, tasks
data/chunk-000/episode_000000.parquet
videos/chunk-000/observation.images.cam/episode_000000.mp4
```

**Nothing is version-sniffed.** The hub reads `info.json`'s own `data_path`
and `video_path` templates, formats them, and checks the result against the
files actually in the repo. A layout that follows its own manifest works, even
if it is not exactly any released version; a layout that contradicts its
manifest is reported as such rather than half-rendered.

Two families are supported:

- **Per-episode** (v2.0 / v2.1): one parquet and one mp4 per episode.
- **Shared** (a v1 monolith, or a v3 data file): one parquet holds many
  episodes, and the rows are found by the `episode_index` column. Parquet
  row-group statistics are used to skip groups that cannot contain the
  episode, so reading one episode out of a fifty-episode file does not read
  the file.

Measured on a 50-episode, 15,254,503-byte shared parquet: **one episode costs
505,164 bytes, 3.3% of the file, in six ranged GETs.** Nothing downloads a
dataset to draw a chart.

## Shared video files (v3.0)

In LeRobot v3.0, one mp4 per camera holds many episodes back to back. The hub
reads each episode's start and end time in that file from the dataset's own
episode table. The Episodes tab plays only that window, on the same clock as
the charts.

## Which robot recorded it

The Sim replay pane reads `info.json`'s `robot_type`. It looks for a robot repo
with that slug under the same owner, then any public robot with that slug. That
robot's card supplies the MJCF. Its embodiment interface supplies the joint
order that the `observation.state` columns map to, by name, or by position when
the columns are unnamed and the counts match. Its `parts[]` group the charts.

When a link in that chain is missing, the pane says which one. The charts then
group by feature. A `robot_type` of `unknown`, which LeRobot writes when the
recorder did not say, names no robot.

## When something is wrong

Everything else degrades to a stated reason. A repo whose files are not a
readable dataset answers `409` with what was wrong (`meta/info.json` missing,
templates that resolve to files that are not there, an empty episode index),
and the tab shows that sentence rather than an empty state or a crash.

## What the charts actually show

The API returns a flat `{t, name, value}` series for one episode, grouped into
`observation.state` and `action`. Two decisions worth knowing:

- **Downsampling keeps the minimum and maximum of each bucket.** Taking every
  nth point would drop a one-frame torque spike, which is what you opened an
  episode viewer to find. Every point returned is a real sample; `downsample` and
  `sampled_points` in the response say exactly what happened.
- **A read budget is enforced per request** (`DATASET_READ_BUDGET_BYTES`,
  64 MiB by default). A pathological file answers `409`, never an OOM.

Channel colour is assigned per group, so `knee` in the positions chart and
`knee` in the actions chart below it are the same hue. That pairing is the
whole reason the two charts are stacked.

## Uploading one

```bash
lucen push you/my-dataset ./my-dataset --kind dataset --public
```

Order does not matter, and neither does completeness. The tab appears as soon
as the manifest and the files it names are both present. Identical bytes are
stored once across every repo on the hub. So uploading a dataset you downloaded
from someone else moves no bytes at all.

Dataset-level metadata (`episode_count`, `total_frames`, `fps`) is a separate
write. See `PUT /v1/datasets/{owner}/{repo}/meta` in the
[API reference](/docs/api). It is what the repo cards in listings show, and it
is independent of the files, so a dataset can advertise its size before every
shard has landed.

## The hub's checks

When a dataset is uploaded, the hub opens its parquet and video files and
checks four things. It reads them by range, so a large dataset never fills
the hub's memory. The dataset page lists what it found under **Checks**.

- **Layout.** The files `meta/info.json` names exist and read. The rows
  match the episode index.
- **Dropped frames.** Within an episode, no two timestamps are more than 1.5
  frames apart, and none goes backwards.
- **Joint limits.** Every `observation.state` value lies inside the limits on
  the robot's card. An overshoot within 5% of a joint's range is a warning.
  Encoders and joints at their stops do that.
- **Time sync.** Each episode's video has as many frames as it has rows, give
  or take one.

A check that could not run says why, such as a dataset with no camera. When a
dataset is too large to read in one check, each line says how many episodes
it covered. Run it again after a change:

```bash
lucen datasets check you/my-dataset
```

## Recorded while a policy ran

[`lerobot-rollout`](https://huggingface.co/docs/lerobot/inference) records what
a robot did while a policy ran. With `--strategy.type=dagger` it marks the
frames where a person took over. Upload its output folder with the policy that
ran:

```bash
lucen datasets import ./eval_my-policy --policy you/my-policy --yes
```

The dataset page then says which policy ran, on which of your robots, and how
the recording was made. The hub counts the corrections itself from the
`intervention` column. Add `--device` with your robot's id and
`--policy-sha256` with the policy file's digest when you have them. A
recording without corrections needs `--strategy sentry` or `--strategy
episodic`. `lerobot-rollout` can upload only to Hugging Face. Sending it here
from the robot is not built into LeRobot.

## Importing one from Hugging Face

A LeRobot dataset that already lives on the Hugging Face Hub comes across in
one command. The import reads the dataset's `meta/info.json` first and refuses
anything the hub would not read, with the reason. [Import a dataset from
Hugging Face](/docs/import-from-hugging-face) shows the command, the plan it
prints and what it records.

## Upstream

- [LeRobot documentation](https://huggingface.co/docs/lerobot): the format, the recorders, the policies.
- [LeRobotDataset v3](https://huggingface.co/docs/lerobot/en/lerobot-dataset-v3): the current layout and what changed from v2.1.
