Skip to content

Draw one-step replay windows without scanning the buffer - #17

Open
Afloat16 wants to merge 3 commits into
HybridRobotics:mainfrom
Afloat16:afloat/20261111-next-singleton-replay
Open

Afloat16 wants to merge 3 commits into
HybridRobotics:mainfrom
Afloat16:afloat/20261111-next-singleton-replay

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 11, 2026 •

Copy link
Copy Markdown

Problem

One-frame actor start-state sampling still builds terminal masks and cumulative distributions over all environments and replay capacity even though every filled frame is eligible.

Change

Draw an environment and filled-frame age directly for sequence_length=1. Preserve stratification, warm-up, circular chronology, terminal-frame eligibility and clear empty-buffer errors.

Validation

PYTHONPATH=src python -m pytest --confcutdir=tests/standalone -q tests/standalone/test_singleton_replay.py
  • Unmodified upstream abc124c1bd5976341034668af3d12c087f2f1f55: 1 regression failures, 3 passing controls.
  • Updated code: 4 passed.
  • Ruff lint/format and git diff --check passed.

Tests cover wrapped/partial buffers, environment balance, terminal frames and allocations. With 4 environments, capacity 2048 and batch 16, the measured dispatch trace creates no tensor larger than 64 elements.

Runtime: Python 3.12.14, PyTorch 2.15.0+cpu and TensorDict 0.11.0 on CPU. Complete Python 3.13 simulator and CUDA training validation was not run.

Related implementation

PR #8 optimizes general multi-frame CDF search. This independent one-frame fast path removes the capacity scan entirely; longer sequences retain their algorithm.

Current integration verification (2026-11-26)

Published head: 32116922677056e2c69844eb81883fe44450520d. Current upstream main: 5fb92297ab4fe3d86629d9f0c635334791bb0d5f. The local merge of this published head with that current main was validated; the local integration tree is 38a9155965dbd89e55af12e52352248b0dab84dc. The upstream CI configuration is retained, and the feature diff remains limited to this PR's two original files.

Focused CPU validation used Python 3.12.14, PyTorch 2.15.0+cpu and TensorDict 0.11.0:

  • test_singleton_replay.py: 4 passed on the integrated tree.
  • The same regression on unmodified current main: 1 failed, 3 passed; no collection errors or skips.
  • Ruff 0.15.0 lint/format checks, syntax checks and git diff --check pass.

Where the current environment module imports simulator task registration, the local harness isolates that import while retaining the exact production environment code and observation-builder implementation with real Torch/TensorDict. This is focused CPU regression coverage; complete Python 3.13 simulator and GPU training validation remains outstanding. Upstream Actions approval and completion remain necessary before relying on hosted CI.

@qiayuanl
qiayuanl force-pushed the main branch 2 times, most recently from 76b6652 to 7e94b07 Compare November 16, 2026 23:15
Retain upstream main triggers, the public mjlab checkout, and the updated lockfile. Preserve the focused fix and regression coverage.
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.

2 participants