lecop 0.3.1

Fast health checks for LeRobot-format robot datasets (unofficial)
Documentation

Find the broken episodes in your LeRobot dataset in milliseconds, before they cost you a training run. At the speed of Rust and assembly.

Quick start

Install it with the tool you already use:

uv tool install lecop

Or run it once without installing: uvx lecop path/to/dataset.

pip install lecop      # or: pipx install lecop
cargo binstall lecop   # prebuilt binary, nothing to compile

Or cargo install lecop to compile it yourself. That build needs no extra tools and decodes AV1 (--decode) with rav1d's assembly on ARM (Apple Silicon, Linux aarch64) and on x86_64 Linux, Windows and macOS. On other targets --decode prints a note on stderr saying the build lacks the assembly.

Then run it on a dataset:

lecop path/to/dataset

No config, no dataset download, and the wheel is a single Rust binary: no Python dependencies. Exit code 0 means clean, 1 means errors, so it works as a step in a data pipeline (see In a pipeline). Every install (PyPI wheels, cargo binstall, the release binaries and cargo install) decodes AV1 with hand-written assembly on ARM and on x86_64 Linux, Windows and macOS.

In CI

A GitHub Actions step that checks a dataset in the repository (or one an earlier step downloaded) and shows each finding as an annotation on the pull request:

- uses: michele-xilo/leCop@v0
  with:
    path: path/to/dataset

Options and a pre-commit hook are in In a pipeline.

From Python

The PyPI wheel also installs a small lecop module that runs the bundled binary and returns the report:

import lecop

report = lecop.validate("path/to/dataset")
print(report["errors"], report["warnings"])
for issue in report["issues"]:
    print(issue["severity"], issue["code"], issue["episode"], issue["message"])

validate accepts a dataset or a directory that holds many, and decode, jobs, ignore and select options that match the CLI flags. Errors in the dataset are in the report; lecop.LecopError means there was no report (bad path or option). decode=True uses the AV1 assembly in the wheels. The cargo install build has no Python module: call the CLI with --format json.

From Rust

leCop is also a library crate. Add lecop to your Cargo.toml and call it:

use lecop::dataset::Dataset;
use lecop::validate::validate;

let ds = Dataset::open("path/to/dataset")?;
for issue in validate(&ds)? {
    println!("{:?} {} {}", issue.severity, issue.code, issue.message);
}

The issue codes and the CLI output are a stable contract; the Rust API can change in any 0.x release, so pin the version. Several datasets, --decode and the other options are in the crate documentation.

What it catches

  • A video with 591 frames for an episode of 588.
  • Timestamps that drift, or frames that went missing.
  • Totals in info.json that disagree with the data (and --fix repairs them).
  • A robot that sat idle for most of an episode, or whose action froze for seconds.
  • Statistics that do not match the data, constant or clipped signals, NaNs.
  • Missing, truncated or unreadable files.
  • With --decode: a camera that froze or went black.

58 checks in all, listed in docs/checks.md.

Why leCop

  • Fast. 8 to 28 ms per dataset without video decoding, 15x to 54x faster than lerobot-doctor on the same datasets. On RoboTwin (27,500 episodes, 75 GB), leCop takes 0.7 s, lerobot-doctor 50 minutes and physlint 4 h 42 min. Video is checked from the container, not by decoding frames, unless you ask for --decode.
  • Fast when it decodes, too. With --decode every frame is decoded, 3.5x to 114x faster than physlint (comparison). Videos are split at keyframes and decoded on every core, and AV1, the LeRobot default codec, goes through rav1d's hand-written assembly: 3 to 14 times faster than without it (ARM and x86_64 figures in usage), and included in every install on ARM and on x86_64 Linux, Windows and macOS, with no ffmpeg and no assembler to set up.
  • Nothing to set up. One binary. LeRobot v2.x and v3.x.
  • Made for pipelines. Run it after recording or conversion, or as a gate before training. Stable issue codes, --format json and GitHub annotations, a config file to ignore or re-grade findings.

Compared with lerobot-doctor and physlint, check by check, in docs/comparison.md.

More

Unofficial. Not affiliated with Hugging Face or the LeRobot project. Early stage: tested on synthetic fixtures and on 16 real Hub datasets (v2.1 and v3.0), one of them with real faults; no real v2.0 dataset yet.

Contributing

Contributions are welcome. CONTRIBUTING.md covers setup, tests, real test datasets and how to open a PR; code style is in STYLE_GUIDE.md.

License

Licensed under either of Apache License 2.0 or MIT license at your option.