Skip to content

fix(lerobot): import every repeated --episode-index - #756

Merged
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
hoangchunghien:fix/episode-index-repeat
Oct 29, 2026
Merged

kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
hoangchunghien:fix/episode-index-repeat

Conversation

@hoangchunghien

@hoangchunghien hoangchunghien commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

hflow import lerobot now imports every --episode-index it is given. Repeating the option, as --camera already allows, used to keep only the last value: --episode-index 0 --episode-index 3 converted episode 3 alone, with no warning. This is one of the CLI rough edges from #742.

import_lerobot_dataset(episode_index=...) accepts a single index, as before, or a sequence of them. Every index is checked before any download or conversion: negative or non-integer values and duplicates raise ValueError, and an index past the last episode raises the existing out-of-range error naming that index.

Why

The silent drop is easy to miss: the command reports "converted 1 episode(s)" and the run looks fine. Accepting several values matches how --camera works and keeps a single --episode-index behaving exactly as it does today.

Validation

  • uv run pytest tests/test_cli.py tests/test_lerobot_converter.py -k "repeated_episode_index or every_requested_episode_index or invalid_arguments_before_network": 3 passed; all three fail on main (744166a).
    • test_import_lerobot_cli_passes_every_repeated_episode_index: the CLI passes [0, 4] for two repeats.
    • test_import_converts_every_requested_episode_index: [1, 0] on a two-episode archive converts both, in that order, and [0, 2] names index 2 as out of range.
    • test_import_refuses_invalid_arguments_before_network gains a negative index in a list, a duplicate, and an empty list.
  • uv run pytest -n 8: 2621 passed, 12 skipped, 2 failed; main gives 2619 passed with the same 2 failures (test_ffmpeg.py::test_linux_unsupported_machine_raises_instead_of_path_fallback and test_ffprobe_without_sibling_falls_back_to_path_with_warning, which depend on the local ffmpeg setup).
  • uv run ruff check, uv run ruff format --check, uv run ty check: pass.

Checklist

  • I added or updated outcome-focused tests for changed business logic.
  • I updated documentation for changed behavior, flags, formats, or requirements. (docs/how-to/import-lerobot-v3.md, examples/README.md)
  • I ran uv run ruff check --fix, uv run ruff format, and uv run ty check.
  • I ran the relevant pytest suite.
  • I did not add recordings, generated media, credentials, private URLs, or runtime artifacts.
  • I preserved stored-data compatibility or documented an explicit version change.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Repeating --episode-index kept only the last value and imported that one
episode without a warning. Make the option repeatable like --camera, and
let import_lerobot_dataset take a sequence of episode indexes, checked for
range and duplicates before anything is converted.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous finding is fixed and no new actionable issues were found.

Summary

The PR makes repeated --episode-index options import every requested episode.

  • LeRobot imports every episode index named on the command line.

No new actionable issues were found. Tests were inspected, not run.

Reviews (2) · Last reviewed commit: "fix(lerobot): keep ValueError for an epi..." · Reviewed by Greptile

Comment thread src/hflow/importers/lerobot.py Resolved
… or sequence

tuple(episode_index) raised TypeError for a float such as 1.5, where the
importer used to raise ValueError. Refuse anything that is neither an int
nor a non-string sequence with the same ValueError as a negative index.
@hoangchunghien

Copy link
Copy Markdown
Contributor Author

Good catch. episode_index=1.5 (or a string) now raises the same ValueError("episode_index must be zero or greater") as before, instead of a TypeError from tuple(): only an int or a non-string sequence is accepted. test_import_refuses_invalid_arguments_before_network covers 1.5 and "0"; both fail on the previous head.

uv run ruff check, uv run ruff format --check and uv run ty check pass, and uv run pytest -n 8 gives 2621 passed with the same 2 local ffmpeg failures as main.

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Ruff, ty, the episode-selection regressions, changed-page links, and both Python CI jobs pass. Merging.

@kstonekuan
kstonekuan merged commit 9f97c3e into Hebbian-Robotics:main Oct 29, 2026
3 checks passed
@kstonekuan kstonekuan mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants