Repository navigation
refactor(lerobot_act): migrate to Task SDK - #1941
Conversation
LeRobot ACT implemented the retired robot_control interface. It now implements the semantic Task SDK: bundles declare image_state_to_action_chunk, which predicts one action chunk, and the runtime also binds image_state_action_queue, whose sessions replace the retired act() and reset() queue. Images may be Float32 in [0, 1] or UInt8 in [0, 255]. The engine graph, preprocessing and postprocessing are unchanged. Bundles that declare robot_control are refused with a rebuild hint. The family E2E adds public C and C++ SDK consumers whose actions must equal the CLI and qualification actions exactly, and the qualification binary now uses the public C++ SDK. Thresholds are unchanged. Outside the family, the recorded-control example README drops its pending-migration note, and the AIPerf Task defaults map image_state_to_action_chunk to the robot_control defaults so ACT qualification keeps resolving. Closes NVIDIA#1470 Signed-off-by: chaofengw <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Task declaration and bundle acceptance apps/aiperf_qual/config/tasks.yaml, families/lerobot_act/model.py, families/lerobot_act/support.py, families/lerobot_act/runtime/plugin.cpp, families/lerobot_act/tests/manifests/*, families/lerobot_act/tests/test_model.py, families/lerobot_act/tests/test_support.py, examples/models/lerobot_act/recorded_control/README.md |
Support, build validation, and the manifest use image_state_to_action_chunk. The plugin rejects bundles with another declared task. The README describes the SDK path and states that older robot_control bundles must be rebuilt. |
Chunk inference and action queue families/lerobot_act/runtime/pipeline.h, families/lerobot_act/runtime/pipeline.cpp, families/lerobot_act/runtime/CMakeLists.txt, families/lerobot_act/tests/cpp/test_pipeline.cpp, families/lerobot_act/tests/cpp/test_task_contract.cpp |
Pipeline implements image-state chunk inference and queued action sessions. It validates image and state inputs, supports Float32 and UInt8 images, and returns action chunks with schema and training-bound status. The task-contract tests cover queue behavior, resets, configuration rejection, and invalid inputs. |
SDK consumers and qualification families/lerobot_act/runtime/CMakeLists.txt, families/lerobot_act/tests/sdk_consumer.c, families/lerobot_act/tests/sdk_consumer.cpp, families/lerobot_act/tests/cpp/qualification.cpp |
The C and C++ consumers exercise chunk inference and action queues. The qualification executable uses the typed task API and reads action values and dimensions from the returned matrix. |
End-to-end SDK comparison families/lerobot_act/tests/test_e2e.py |
The E2E test runs both SDK consumers and compares their action arrays and training-bound results with native CLI output. It also checks task, image format, action shape, schema, and queue replay count. |
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Refactor
Sequence Diagram(s)
sequenceDiagram
participant SDKConsumer
participant ImageStateToActionChunk
participant Pipeline
participant ACTModule
SDKConsumer->>ImageStateToActionChunk: submit image and state request
ImageStateToActionChunk->>Pipeline: run chunk request
Pipeline->>ACTModule: infer from image and state tensors
ACTModule-->>Pipeline: return action tensor
Pipeline-->>ImageStateToActionChunk: return action chunk
ImageStateToActionChunk-->>SDKConsumer: provide chunk result
Suggested reviewers: yifeif-nv
Merge Risk: 
Minimal · up to f80b6
-
No actionable issue remains from this review. The migration is mergeable after normal checks.
Pre-merge checks: 
8 · 
1
-
Failed checks: 1 warning Passed checks: 8 passed-
Full details: Description check
-
Explanation
The description is complete and follows the required template. It covers background, exit criteria, implementation, change categories, validation commands and results, environment, remaining gaps, self-review, compatibility notes, and risk.
Full details: Linked Issues check
-
Explanation
Issue
#1470coding requirements are met. The family bindsimage_state_to_action_chunkas the primary Task andimage_state_action_queueas the secondary Task. The implementation preserves chunk results, queue replay and refill, reset, observation validation, schema, bounds, and inference timing. Support, build checks, and the manifest use the new primary Task. The CPU contract test and public C/C++ consumers cover configuration rejection, invalid inputs, lifecycle behavior, independent sessions, and result lifetime. The reported E2E keeps the existing oracle and thresholds. The reported CLI, example, benchmark, and qualification paths run on a rebuilt bundle. The plugin rejects oldrobot_controlbundles with a rebuild message, and the PR records tested revisions, commands, results, and known gaps.
Full details: Out of Scope Changes check
-
Explanation
The changes remain connected to issue
#1470. The README update documents the new Task path and the rebuild requirement for old bundles. The AIPerf configuration alias supplies the existingaction_parityand performance defaults for the new Task name, which supports validation of the migrated ACT catalog entry. The runtime, support, manifest, tests, and example changes directly implement or verify the migration. No unrelated behavior change is demonstrated.
Full details: Family Ownership Boundary
-
Explanation
No cross-family ownership violation is introduced. The changed implementation and validation code remains under
families/lerobot_act/; its references are to shared Task SDK headers such astrtmc/internal/action.handtrtmc/action.hpp, sharedtrtmc_c, and sharedthird_party/stb/stb_image.h. The new validation and reference paths are family-owned. The only changes outside the family are the example README and the model-agnostic AIPerf task catalog alias atapps/aiperf_qual/config/tasks.yaml:256,261; neither is another family, a family registry, switch, source list, or strategy map. The root CMake setup confirms family targets are discovered by directory convention and does not require a central source or target-list edit (CMakeLists.txt:306-320). No changed file imports or links implementation, fixtures, comparators, or reference artifacts owned by another model family.
Full details: Shared Semantic Neutrality
-
Explanation
PASS. The only changed shared configuration adds
image_state_to_action_chunk: *controlinapps/aiperf_qual/config/tasks.yaml. It reuses the existing genericaction_parityandparity_numericpolicy withcount_rtol: 0.01; it adds no family name, tensor name, topology, threshold, probe, dataset, or runtime strategy. The semantic Task contract supplies the specialization for affected consumers. The README change is family-specific documentation and adds no shared behavior.
Full details: Benchmark Validation Integrity
-
Explanation
The PR changes the LeRobot ACT qualification and E2E paths, but the compared measurements retain equivalent accounting. The qualification still performs the same load timing, two warmups, ten inference samples, p50/p95 calculation, chunk throughput, 50 Hz replay, jitter, deadlines, memory, and startup checks. The new Task SDK path copies the same 100x14 chunk and validates it against the CLI output and reference output. The AIPerf configuration aliases
image_state_to_action_chunkto the existingrobot_controlpolicy, so absoluteaction_parityand performanceparity_numericchecks withcount_rtol: 0.01remain unchanged. The benchmark adapters already provide the semantic action-chunk route and preserve its control operation and request shape.
Full details: Shared Change Blast Radius
-
Explanation
PASS. The PR changes the shared AIPerf Task catalog in
apps/aiperf_qual/config/tasks.yaml, so the check applies. The need is model-agnostic: AIPerf documents Task settings as non-model-specific, andmodels.resolve_model()requires every manifest Task to exist in this central catalog before it merges family overrides. The manifest now declaresimage_state_to_action_chunk, so a family-only change could not register that Task for AIPerf. The PR description identifies the semantic Task migration, affected CLI/example/benchmark and SDK paths, preserved chunk/queue/reset behavior, rebuild impact for old bundles, and CPU, SDK, qualification, and recorded-checkpoint validation. The shared config aliases the new Task to the existing parity and performance policy while retainingrobot_control, which limits compatibility impact. Repository evidence also shows the plugin rejects old bundles with a rebuild message and the README documents that migration.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 19.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 42 functions across 12 files. (4 skipped: 4 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Background
Closes #1470 (epic #1430). This migrates
lerobot_actto the semantic Task SDK introduced by #1226.The family declared the retired
robot_controlmode and implementedIRobotControlfromtrtmc/task.h.predict_action_chunk()returned one 100-step chunk, andact()/reset()drove a per-step queue over that chunk. The CLIcontrolcommand, the recorded-control example and the benchmarkcontrolworkload reached it through the legacy task path.lerobot_pi05andlerobot_grootalready implement the action Tasks this PR maps to.Exit Criteria
image_state_to_action_chunk. The runtime binds it as the primary Task andimage_state_action_queueas a secondary Task on the same bundle, both without runtime Config fields.tests/test_support.pyasserts the default Task, astools/tests/test_architecture.pyrequires.IRobotControland its remaining shared callers (see Notes).Implementation
Task mapping
IRobotControlpredict_action_chunk()image_state_to_action_chunk(IImageStateToActionChunk::run)lerobot.act, normalizationunnormalized),within_training_boundsandinference_ms.act()/reset()image_state_action_queue(IImageStateActionQueue::create_action_session, then the session'sact/reset)started_new_chunkandinference_msare set only on the refilling step.reset()clears the queue and the policy's execution context. Each session owns its queue, so a chunk run neither consumes nor replaces a live session.Changes
runtime/pipeline.h,pipeline.cppPipelineimplementsinternal::IModel,IImageStateToActionChunkandIImageStateActionQueue.task_bindings()binds both Tasks without Config fields. Any Config is rejected withinternal::ConfigError.[0, 1]or UInt8 in[0, 255]. UInt8 is divided by 255, as the CLI's image reader does.runtime/plugin.cpp: a bundle whose header declares any other Task is refused with "rebuild it for image_state_to_action_chunk".support.py,model.py,tests/manifests/act-aloha-sim-transfer-cube.json: the primary Task isimage_state_to_action_chunk, andbuild()refusesrobot_control.tests/cpp/test_task_contract.cppreplacestest_pipeline.cpp. It is a CPU contract test with a recording fake engine and covers:tests/sdk_consumer.c(UInt8 image) andtests/sdk_consumer.cpp(Float32 image) are public C and C++ SDK consumers. Each one:tests/test_e2e.py:tests/cpp/qualification.cppuses the public C++ SDK (trtmc::Model::load,ImageStateToActionChunk) instead of the internal task loader. Its metrics output is unchanged.tests/test_model.py,tests/test_support.py(new): support andbuild()Task checks, and dependency-free identity resolution.Outside the family:
examples/models/lerobot_act/recorded_control/README.md: the example code is unchanged, because it already chooses the SDK path from the bundle's primary Task. The README no longer says ACT keepsIRobotControluntil it migrates, and it tells owners ofrobot_controlbundles to rebuild.apps/aiperf_qual/config/tasks.yaml:image_state_to_action_chunkreuses therobot_controldefaults (action_parity). Without this alias, AIPerf qualification of the ACT catalog entry stops with "no Task defaults".Compatibility
Bundles built before this change declare
robot_control. This family refuses them with a rebuild hint, so they must be rebuilt. The bundle format is otherwise unchanged.Change categories
Validation
Commands and Results
Build. Against TensorRT 11.4.0.106 and, separately, 11.1.0.106:
CPU tests. Run with both TensorRT versions:
Source quality. The Community CPU source-quality stage, reproduced with the CI image's ruff 0.16.4 and clang-format 22.1.8:
GPU E2E. Offline, on the selected premerge case:
In both runs:
image_state_to_action_chunk, and the TensorRT 11.4 bundle recordstensorrt_version11.4.0.106.Shared applications. Run on the E2E bundle:
AIPerf configuration. CPU only:
image_state_to_action_chunkto theaction_paritydefaults.python -m pytest apps/aiperf_qual/tests --ignore apps/aiperf_qual/tests/test_accuracy_alignment.pygives 433 passed and 19 failed. That file is skipped because it needs theaiperfpackage, which the image lacks.Hardware, Environment, and Revisions
7680cbd7f.Dockerfile, the image CI builds: CUDA 13.4.3, TensorRT 11.4.0.106, torch 2.12.0+cu130, transformers 5.2.0.-DICU_ROOT.NVIDIA_DISABLE_REQUIRE=1and CUDA minor-version compatibility.lerobot/act_aloha_sim_transfer_cube_human@ba73b2766f1371cdc133ca4efb97eb090d744625, FP32, batch 1.huggingface/lerobot@3c0a209f9fac4d2a57617e686a7f2a2309144ba2, the pinnedtests/reference-source.json, run in PyTorch on the same GPU.Not Run / Remaining Gaps
qualification/gb300-trt11.1-fp32.json) was not regenerated. The README says that it predates the migration.Contributor Self-Review
Notes For Future Readers
runtime/pipeline.h/.cpp(bindings, the session queue, observation validation);plugin.cpp;test_task_contract.cpp, the SDK consumers, thentest_e2e.py.robot_controlmust be rebuilt, and the plugin's error says so.robot_control. To keep this migration family-scoped, its remaining shared callers are left to the epic's retirement step:IRobotControlincore/runtime/include/trtmc/task.h;robot_controlbranch inexamples/models/lerobot_act/recorded_control/main.cpp;robot_controladapter;robot_controldefaults, which this PR aliases.Risk level
The change stays inside
families/lerobot_act/, apart from one README paragraph and a one-line configuration alias. The engine graph and numerics are unchanged:Old bundles fail closed with a rebuild message instead of loading.