Repository navigation
fix(dynamo): save programs with no inputs, keep attention masks that are not plain causal, fix uint8 shape ops and views left to PyTorch, show the runtime TensorRT build number, keep plugins that run PyTorch out of ExecuTorch programs - #4953
Merged
Merged
Conversation
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 2, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw at most one starting noise, and
compute the same chunk twice from the same frame and noise; it refuses
others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953, not in a release yet, and the backend refuses an
older Torch-TensorRT, which would ignore the setting without a word. An
installed package named lerobot_backend_* adds a backend, the way
lerobot_runtime_* adds a runtime. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill would
keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that is killed leaves no folder behind.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra. ExecuTorch 1.6, which
the runtime needs, and torchao 0.19 are not on PyPI yet, so the `export`
extra is left out of pyproject.toml for now, with a note.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused. They also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting reaches Torch-TensorRT, that an older
Torch-TensorRT is refused, and that a backend from
--backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 2, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving a program without inputs with `executorch_tensorrt` needs pytorch/TensorRT#4953, which is not in a release yet. The docs say so. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 2, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw at most one starting noise, and
compute the same chunk twice from the same frame and noise; it refuses
others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953, not in a release yet, and the backend refuses an
older Torch-TensorRT, which would ignore the setting without a word. An
installed package named lerobot_backend_* adds a backend, the way
lerobot_runtime_* adds a runtime. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill would
keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that is killed leaves no folder behind.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra. ExecuTorch 1.6, which
the runtime needs, and torchao 0.19 are not on PyPI yet, so the `export`
extra is left out of pyproject.toml for now, with a note.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused. They also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting reaches Torch-TensorRT, that an older
Torch-TensorRT is refused, and that a backend from
--backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 2, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving a program without inputs with `executorch_tensorrt` needs pytorch/TensorRT#4953, which is not in a release yet. The docs say so. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
5had3z
approved these changes
Nov 2, 2026
5had3z
left a comment
Collaborator
There was a problem hiding this comment.
The copy-transpose function is the main thing that stood out to me as something that could be a performance concern. I played with the idea of detecting and inserting explicit permute layer instead of performing the transpose copy. TensorRT can then fuse this with the next layer. However, the blast radius of this feature is quite large. This is worth it for transposing high-resolution images BCHW->BHWC, but less so for the efficient attention transpose BSHD->BHSD.
Otherwise generally lgtm.
Collaborator
shoumikhin
force-pushed
the
uint8-select-fallback
branch
from
November 3, 2026 03:32
6fa7d1b to
de4cfc0
Compare
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend, the way lerobot_runtime_* adds a runtime. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The following commit runs the XNNPACK and CUDA rows in CI. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend, the way lerobot_runtime_* adds a runtime. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The following commit runs the XNNPACK and CUDA rows in CI. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend, the way lerobot_runtime_* adds a runtime. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 5, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The following commit runs the XNNPACK and CUDA rows in CI. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 13, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend, the way lerobot_runtime_* adds a runtime. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step, and that each
backend's install command brings the modules a bundle imports. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 13, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 13, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The following commit runs the XNNPACK and CUDA rows in CI. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The export jobs in CI run the XNNPACK and CUDA rows. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The export jobs in CI run the XNNPACK and CUDA rows. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 23, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The export jobs in CI run the XNNPACK and CUDA rows. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
This was referenced Nov 23, 2026
Closed
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 24, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 24, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 24, 2026
…d drive a robot with the bundle The export tests compared bundles with their PyTorch policies, mostly with the PyTorch test backend. Nothing exported the main policies with every backend that ExecuTorch runs, checked where their programs run, or ran `lerobot-rollout --bundle.path` on a bundle that a real compiler wrote. `tests/export/test_export_backends.py` exports tiny ACT, Diffusion Policy, pi0, pi0.5, SmolVLA and GR00T checkpoints with `executorch_xnnpack`, `executorch_cuda` and `executorch_tensorrt`. The export itself only writes a bundle that reproduces the PyTorch policy's test case within the bundle's tolerance. Then, for each bundle: - Each program runs where its backend runs it. Every XNNPACK program holds only `XnnpackBackend` delegates, every CUDA program only `CudaBackend` ones, and every TensorRT program `TensorRTBackend` or `CudaBackend` ones, with `TensorRTBackend` somewhere in the bundle. A GPU program leaves no operator on the CPU, and its inputs and outputs stay in GPU memory. - `lerobot-rollout --bundle.path` drives a recording robot for at least 12 actions, which takes several chunks, in a process that never loads PyTorch. The recording robot can now show a bundle's test case: with `--robot.frames=<test case file>` it has a camera for each image of the test case, so a bundle of a policy with cameras can drive it. Each backend takes its skip mark from `tests/export/backends.py`, so a row that a released ExecuTorch or Torch-TensorRT cannot run yet skips and says which fix it needs. One kind of row fails on every wheel released so far, so it skips up to the version with the bug and runs again on a newer one: pi0 and pi0.5 with TensorRT. TensorRT 11.4.0.106 cannot build an engine for the tiny policies' concatenations. The full-size policies build. Tested on Linux x86_64: - XNNPACK, on the CPU: all 6 policies, 12 passed. - CUDA and TensorRT, on an A100, with ExecuTorch 1.6 and Torch-TensorRT 2.15 built from source, the latter with pytorch/TensorRT#4953: 20 passed, and the 4 tiny pi0 and pi0.5 TensorRT tests skipped as described above. The export jobs in CI run the XNNPACK and CUDA rows. No CI job installs Torch-TensorRT yet, so the TensorRT rows skip there.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 24, 2026
lerobot-export compiles a trained policy into a bundle that
`lerobot-rollout --bundle.path=<folder>` runs:
lerobot-export \
--policy.path=outputs/train/act_so101/checkpoints/last/pretrained_model \
--backend.type=executorch_tensorrt
Three pieces, each knowing one thing:
- A recipe knows the policy, never the compiler. It turns the policy into
parts (a module, example inputs, and the names of its inputs and outputs)
and makes the test case. The default recipe makes one part that does
what lerobot-rollout does for one chunk: image conversion, the saved
preprocessor, predict_action_chunk trimmed to the actions rollout plays,
and the saved postprocessor. It takes the robot's frame and the starting
noise, and returns actions in robot units. It covers policies that keep
the chunk_inference_spec contract, draw a starting noise they take in
one draw, and compute the same chunk twice from the same frame and noise;
it refuses others with the reason. A policy that reads the task holds it, tokenized
once at export. A policy that needs something else adds its own recipe
in export_<type>.py beside its configuration, and the factory finds it
there. The pieces a recipe shares (the robot's frame from the policy or
its dataset, a random frame, the action scale) are plain functions.
- A backend knows the compiler, never the policy. It is a config class
chosen with --backend.type. executorch_tensorrt compiles each part with
Torch-TensorRT into an ExecuTorch program whose inputs and outputs stay
in GPU memory, with TensorRT's TF32 off so float32 stays float32. It
keeps out of TensorRT any operation whose TensorRT plugin would need
PyTorch at run time (Torch-TensorRT's fallback_pytorch_plugin_ops), since
ExecuTorch programs run without PyTorch. That setting comes with
pytorch/TensorRT#4953 (Torch-TensorRT 2.15). An installed package named lerobot_backend_*
adds a backend. A backend given with
--backend.discover_packages_path is loaded in every step that needs it.
- The bundle holds the programs, the manifest (written once, after the
last part is compiled), the test case, and the policy config as a record.
lerobot-export itself never imports PyTorch. It traces the policy in one
process, compiles each part in a process of its own, and checks the bundle
in another, so each step starts with the memory the one before it used
given back. Like an installed command, each of those processes skips the
current folder when it looks for modules (`python -P`), so a .py file
there, for example in a downloaded checkpoint folder, cannot load in place
of one. The checkpoint loads like in lerobot-rollout, at
--policy.pretrained_revision and with PEFT adapters folded into the base
weights, onto the CPU; the recipe moves what it compiles to the backend's
device. The load is strict: a weight the checkpoint does not fill, or a
PEFT adapter weight missing from its file, would keep its random value, and the export's own check compares the bundle with
that same policy, so it could not tell. PyTorch's TF32 is off in every step, so the test case is the
policy's float32 arithmetic. Each part is traced non-strictly, which is
PyTorch 2.15's default, on every PyTorch: PyTorch 2.7 traces strictly by
default and cannot trace some policies, such as ACT. Tracing and compiling run without autograd,
which nothing there needs and which some of ExecuTorch's passes cannot
record (complex views). The tolerance is in normalized action units:
each action's scale is measured from the saved postprocessor and stored in
the manifest. The bundle is written to a temporary folder, checked in a new
process the way lerobot-rollout checks it, and only then moved to the
output folder. If the actions differ too much, or the check crashes,
nothing is written, and a step that crashes or is killed leaves no folder
behind. The parent folders the export made for the output folder are
removed too, when nothing else is in them. An output folder that appears while the export runs, such as from
a second export to the same folder, is left alone, and this export removes
its own bundle. An output path that is a link, even one to nothing,
counts as taken. A SIGKILL of lerobot-export itself ends it before it can
clean up.
Torch-TensorRT is not added to an extra: it pins one torch minor version,
which uv's single lock would impose on every extra.
The tests export a tiny ACT through the command with a test backend, added
as a plugin package, and check that the bundle plays the same actions as
SyncInferenceEngine, that the command never imports PyTorch, and that a checkpoint missing a
weight is refused, and so is a PEFT adapter missing one. They also run an export from a folder holding .py files
named like modules the steps import, make the output folder while an
export runs, and check that --help writes nothing. The tests also cover the recipe's
task, noise, image, camera and same-chunk rules on small policies, and
check that the plugin setting always reaches Torch-TensorRT, and that a
backend from --backend.discover_packages_path reaches the compile step. Also tested
by hand on NVIDIA GPUs: ACT, SmolVLA and pi0 exported with
executorch_tensorrt and passed the check.
shoumikhin
added a commit
to shoumikhin/lerobot
that referenced
this pull request
Nov 24, 2026
A policy that starts from a random noise, such as pi0.5, SmolVLA or GR00T, got that noise from the host: the engine drew it with NumPy and copied it to the GPU for every chunk. On a GPU backend the export now adds a small program without inputs that draws the noise on the GPU, and the bundle runs it first. So a chunk copies only the robot's frame to the GPU. The bundle's own check still gives the test case's recorded noise to the same `noise` input and skips the draw, so the check against PyTorch does not change. Since the check skips that whole run, a run that draws the noise must write nothing else, and the engine refuses one that does. ExecuTorch 1.6 cannot seed a draw on the GPU, so such a draw cannot be replayed exactly; replays use noise from the host, as the check does. Saving the noise program with `executorch_tensorrt` needs the `fallback_pytorch_plugin_ops` setting of pytorch/TensorRT#4953, which Torch-TensorRT 2.15 carries. A test on a GPU counts every copy between the host and the GPU while the bundle runs: each chunk copies only the frame to the GPU and the actions back.
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
truncate_double=True).permutefailed to build. Comparisons andwherewith out-of-range integers follow PyTorch.int_tensor ** 0.5gave 1.x * (n / 2)widened float16 to float32 for dynamicn.aten._reshape_copy, which ExecuTorch's CUDA backend lacks.offload_module_to_cpu=Truefailed on some complex-number graphs.index_put,indexandexpandcould give wrong results or fail.is_causal=True; now kept for fixed lengths up to 4096. The attention decomposition ignoredtorch_executed_ops. A fully masked FP32 query gave NaN, not zeros; masked FP32 attention now runs as matmuls and softmax (about 17% slower with an additive mask). TensorRT-RTX lost accuracy on constant-scale attention.truncate_double=Truealso copied to the GPU.New behavior
requires_pytorch_plugin=True), or with no record of them (older release, or hand-wrapped withoutpytorch_plugin_ops).libnvinfer_plugin, reorders a non-row-major input on every call (slow for channels-last), and returnsInvalidArgumentif the engine updates such an input in place.attn_bias_is_causal="proven"replaces only a bias the compiler proves causal. Default staysTrue;Noneraises.Opt-in settings
fallback_pytorch_plugin_ops: ops whose plugins run PyTorch stay in PyTorch; accumulatingindex_putuses ScatterElements where it can.collapse_high_rank_permutes: static reshape and permute chains over 8 dims run in TensorRT.convert_antialiased_resize: static antialiased bilinear and bicubicF.interpolateruns in TensorRT.What was tested
Linux x86_64 (A100, H100), TensorRT 11.4; Windows and TensorRT-RTX only in CI. Nearly every fix adds or updates a test.
Overlaps with #4815, #4817, #4880, #4958. #4819 handles uint8 another way; maintainers should pick one.