Repository navigation
fix(libero): stop the LIBERO converter accumulating every episode in RAM - #1069
Open
akushonkamen wants to merge 1 commit into
Open
akushonkamen wants to merge 1 commit into
akushonkamen wants to merge 1 commit into
Conversation
LeRobotDataset.save_episode concatenates the new episode into the in-memory hf_dataset table on every call (lerobot@0cf8648, _save_episode_table), so convert_libero_data_to_lerobot.py held every written frame in RAM until long conversions OOMed (issue Physical-Intelligence#829). The conversion never reads hf_dataset, so reset it to an empty table after each episode; the parquet files on disk are unchanged. Adds scripts/convert_libero_data_to_lerobot_test.py: it drives the real main() against a fake RLDS dataset and asserts (1) the in-memory table no longer accumulates across episodes and (2) the converted dataset on disk still round-trips with all frames.
akushonkamen
requested review from
Michael-Equi,
jimmyt857 and
kvablack
as code owners
October 17, 2026 17:52
jimmyt857
removed their request for review
October 17, 2026 23:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #829
Root cause
The pinned lerobot revision (
lerobot@0cf8648) keeps every written episode in the in-memoryhf_datasettable:LeRobotDataset.save_episode→_save_episode_tableappends the new episode intoself.hf_datasetviaconcatenate_datasetson every call (lerobot/common/datasets/lerobot_dataset.py:914at that revision).examples/libero/convert_libero_data_to_lerobot.pynever readshf_dataset, so the table is pure overhead — RSS grows by ~150 MB per episode for the whole conversion and long conversions eventually OOM (#829).Fix
examples/libero/convert_libero_data_to_lerobot.py:91-97: after eachdataset.save_episode(), reset the in-memory table withdataset.hf_dataset = dataset.create_hf_dataset()— exactly whatLeRobotDataset.createinitializes it to. The parquet files already written to disk are unaffected, so the on-disk output is unchanged.Test
Adds
scripts/convert_libero_data_to_lerobot_test.py, which drives the realmain()against a fake RLDS dataset (with atfdsstub so no GPU /rldsdependency group is needed) and asserts:hf_datasettable no longer accumulates across episodes;Evidence on this branch:
Red proof (same test with the fix stashed — it fails on the accumulation assertion, confirming the test catches this bug):
Lint (ruff 0.8.6, the version pinned in
.pre-commit-config.yaml):Honest scope note: I did not run the repo-wide gate
uv run pytest --strict-markers -m "not manual"locally — the frozen lockfile does not install on macOS arm64 (jax-cuda12-pluginandtensorflow-cpu==2.15.0publish no macOS arm64 wheels;uv syncfailed twice). Local verification used a subset venv pinned to match the repo lock (lerobot@0cf8648,torch 2.7.1,datasets 3.6.0,pyarrow 20.0.0). The new test carries its owntfdsstub and needs neither GPU nor therldsgroup, so it should run as-is in CI.AI disclosure
This fix was developed with the assistance of an AI coding agent (Claude / GLM, working as a commit agent under the account owner's direction): the root-cause analysis, patch, and test were drafted by the agent and reviewed/verified by the account owner, with the evidence above reproduced locally. Claim and progress comments on #829 disclose the same.