Add outcome-aware dataset fragments - #547
Open
yuecideng wants to merge 2 commits into
Open
Conversation
Add stable per-segment outcomes and dense provenance annotations, persist accepted segments as independent LeRobot episodes, and constrain online sampling by acceptance and continuity. Checkpoint capture and resume remain intentionally deferred.
Resolve the Task Program migration while preserving segment outcome, fragment persistence, and retry semantics.
yuecideng
marked this pull request as ready for review
August 31, 2026 10:42
Greptile SummaryThis PR adds outcome-aware demonstration metadata and optional persistence of accepted Task Program segments as independent LeRobot episodes.
Confidence Score: 5/5The PR appears safe to merge; no concrete blocking or independently actionable non-blocking issue was identified. The changed execution, annotation, sampling, vector-row persistence, and recorder idempotency paths remain internally coordinated, and the investigated failure scenarios were contradicted or lacked a reachable erroneous behavior.
|
| Filename | Overview |
|---|---|
| embodichain/lab/gym/envs/demo.py | Adds execution configuration, outcome classification, attempt and continuity metadata, and fragment-count result semantics. |
| embodichain/lab/gym/envs/embodied_env.py | Writes dense outcome annotations and makes fragment-bearing rows eligible for dataset persistence. |
| embodichain/lab/gym/envs/managers/datasets.py | Splits eligible segment spans into independent payloads and adds recorder-local idempotent fragment commits. |
| embodichain/lab/gym/envs/managers/async_datasets.py | Expands cloned rows into fragment payloads while retaining single-worker ordered persistence and deferred error reporting. |
| embodichain/data_pipeline/engine/data.py | Propagates attempt IDs and prevents sampling rejected segments or windows crossing continuity boundaries. |
| embodichain/lab/scripts/run_env.py | Integrates fragment persistence into collection retries and explicit commit-or-abort handling. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Execute demonstration] --> B[Record per-frame segment metadata]
B --> C{Persistence mode}
C -->|continuous| D[Commit eligible complete episode]
C -->|segment_fragments| E[Slice eligible segment spans]
E --> F[Generate stable fragment IDs]
F --> G[Deduplicate recorder-local commits]
G --> H[Commit independent LeRobot episodes]
B --> I[Publish completed online rollout]
I --> J[Filter windows by acceptance and continuity]
Reviews (1): Last reviewed commit: "Merge main into outcome-aware dataset fr..." | Re-trigger Greptile
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.
Description
This PR adds stable per-segment outcome and provenance annotations to Task Program demonstration execution and lets collectors persist eligible program segments as independent LeRobot episodes.
The change preserves successful work from partially failed Task Programs without conflating segment quality with episode termination. The storage design follows the current LeRobot Dataset v3 episode/task model, while using EmbodiChain-owned names such as
segment_acceptedinstead of overloading policy/evaluation fields such asnext.success.Key changes:
DemoExecutionCfgwithcontinuousandsegment_fragmentspersistence modes;fragment_id, preserving earlier commits and preventing duplicate writes after partial post-commit failure;commit_env_idsbehavior frommainfor partial vector batches;Checkpoint capture, restore, and resume are intentionally deferred until an authoritative restore port exists. This PR records
continuity_idfor forward compatibility, with current executions remaining in continuity region zero.Design: Task Program segment outcome and resume plan
LeRobot references: Datasets v3 overview, current dataset API
Dependencies: None. The existing LeRobot version constraint is unchanged.
Issue: None.
Type of change
Screenshots
Not applicable; this change has no visual UI.
Validation
black --check --diff --color .— 824 files unchangedpython docs/scripts/check_api_docs.py— 1675/1675 exports documentedpython -m pytest -q tests/gym/envs tests/data_pipeline tests/lab/scripts/test_run_env.py tests/gym/utils/test_gym_utils.py -m "not requires_sim and not gpu" --disable-warnings --maxfail=20— 754 passed, 1 skipped, 23 deselectedpython -m pytest -q tests/test_agent_context_map.py --disable-warnings— 7 passedpython -m pytest -q tests/docs --confcutdir=tests/docs --disable-warnings— 20 passedgit diff main...HEAD --check— passedThe full simulator/GPU suite was not run locally; those markers were excluded from the proportional affected-area test run.
Checklist
python docs/scripts/check_api_docs.py).