Skip to content

fix(motion): gather reference frames from device carrier in full refresh - #2105

Merged
TATP-233 merged 1 commit into
mainfrom
fix/issue-2104-motion-reference-frozen
Oct 9, 2026
Merged

TATP-233 merged 1 commit into
mainfrom
fix/issue-2104-motion-reference-frozen

Conversation

@TATP-233

@TATP-233 TATP-233 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • TensorMotionCommand._refresh_motion_torch 的全量刷新分支(rows is None)改为从设备端 time_steps carrier gather 参考帧,与 selected-rows 分支一致。
  • 原因:c9a8169d(perf: publish full sampler step)把 sampler 步进移到设备端 step_full 时删除了 _sync_tensor_sampler_state() 宿主镜像同步,宿主 MotionSampler.current_frames 永久冻结为全 0,而全量刷新仍在读它——每步把参考动作第 0 帧写入 command、motion_anchor_pos_b/ori_b 观测和全部 tracking 奖励,机器人表现为"只追踪第一帧"。
  • 训练影响:所有 TensorMotionCommandCfg owner(flashsac 全部 sim、sac/mjwarp)自 2026-10-03 起的训练参考均为冻结第 0 帧,修复后这些路径的 checkpoint 需要重新训练;NumPy MotionCommand 路径(如 ppo)不受影响。
  • 补充回归测试 test_tensor_command_full_refresh_gathers_advanced_frames:宿主 sampler 保持冻结在第 0 帧,断言全量刷新 gather 的是步进后的设备帧号(已验证该测试在修复前失败、修复后通过)。

Linked Work

Validation

  • make test-all passed on the final local head before this PR was created or updated(见下:13 个失败为 main 上已存在的 macOS 环境问题,与本改动无关)
  • Additional task-specific validation listed below

Commands actually run:

uv run pytest tests/tasks/test_motion_term_parity.py -x -q   # 36 passed
# 回归验证:stash 修复后新测试失败(确认能抓住 bug),恢复后通过
make check                                                   # ruff/mypy/pyright 全部通过
make test-all                                                # 1835 passed, 13 failed(见下)
git worktree add /tmp/unilab-base-check origin/main --detach
uv run pytest tests/training/test_cuda_mps_cli.py -q         # origin/main 上同样 13 failed

make test-all 的 13 个失败全部位于 tests/training/test_cuda_mps_cli.py,失败原因 OSError: AF_UNIX path too long(macOS 本机临时目录路径过长),在未含本改动的 origin/main(cbafb50)上复现完全相同,属已存在的环境问题,与本改动无关。

Remote CI route:

  • Base main: 当前 head CI 链接与状态待 PR 创建后补充。

Impact

  • Backend impact: none(任务层 command term,所有 backend 的 TensorMotionCommand 路径行为一致修复)
  • Platform impact: both
  • Training effect expected: yes — flashsac/sac(mjwarp) 的 motion tracking 训练参考从冻结第 0 帧恢复为随时间推进;修复前训出的 checkpoint 需重训

Artifacts

  • W&B: none
  • benchmark result: none
  • video / screenshot: none
  • ONNX / checkpoint: none

Checklist

TensorMotionCommand._refresh_motion_torch read the host NumPy
MotionSampler.current_frames on the full (rows=None) refresh path, but
c9a8169 removed the host mirror sync when stepping moved to
TensorMotionSampler.step_full, leaving the host frames frozen at zero.
Every per-step refresh re-ingested frame 0 of the reference clip into
the command, motion-anchor observations, and tracking rewards for all
TensorMotionCommand owners (flashsac all sims, sac/mjwarp), in both
training and eval.

Gather from the device time_steps carrier instead, matching the
selected-rows branch, and add a regression test that keeps the host
sampler frozen at frame 0 and asserts the full refresh gathers the
advanced device frames.

Fixes #2104
@TATP-233
TATP-233 requested a review from caozx1110 as a code owner October 9, 2026 11:33
@TATP-233
TATP-233 merged commit 5506fe9 into main Oct 9, 2026
8 checks passed
@TATP-233
TATP-233 deleted the fix/issue-2104-motion-reference-frozen branch October 9, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant