Repository navigation
Conversation
Policy servers send a clip with one real frame and zero placeholder frames; the RoboLab server sends 1 + 32. _prepare_video resized and padded all of them on the CPU. Resize and reflection pad are per-frame, so resizing frame 0 and one zero frame and repeating the latter gives the same tensor. Other clips keep the full path. Signed-off-by: John Pohl <jpohl@nvidia.com>
Signed-off-by: John Pohl <jpohl@nvidia.com>
jpohl-nv
marked this pull request as ready for review
December 4, 2026 14:47
This branch has not been deployed
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.
Summary
The RoboLab policy server builds a 33-frame
uint8clip per request: the camera image in frame 0 and 32 zero placeholder frames, which keep the prompt's duration and the number of latent frames.ActionTransformPipeline._prepare_videoresizes and reflection-pads all 33 frames on the CPU, although 32 of them are identical zeros.This PR adds a fast path to the single-view branch of
_prepare_video. If the clip is[C,T,H,W]withT >= 3and every frame after the first is zero, it resizes frame 0 and one zero frame and repeats the resized zero frame. Resize and reflection pad are per-frame, and the video tensor is the only output ofvideo_resizethat depends onT, so the result is identical to resizing all frames. Clips with a non-zero later frame, shorter clips and the multi-cameracamera_videospath keep the existing code. The zero check costs about 0.1 ms per request.Impact
Measured with
nvidia/Cosmos3-Edge-Policy-DROIDand the RoboLab server's settings on an RTX PRO 6000 Blackwell:_build_sample: 27.1 → 10.4 ms per request, averaged over 301 recorded RoboLab requests.BananaInBowlTask: 277.6 → 254.5 ms per call (mean of 2 interleaved runs each, same session).Testing
transforms_test.py(L0,CPU):video_resizeon all frames, forT= 3, 4 and 33, at a size that needs both resize and reflection padding, and the fast path is actually taken;transforms_test.pyandaction_policy_server_robolab_test.pypass._build_sampleoutputs are identical to the full path in every field, and the policy's actions are bit-identical to the unchanged server (uncompiled bf16, recorded seeds).ruff formatandpyreflyare clean on the changed files.ruff checkreports twoI001import-order findings that are already onmain.