Repository navigation
Preserve the latest transitions when replay batches exceed capacity - #384
Conversation
Discard the overwritten prefix and advance the circular write position before retaining the last capacity-sized suffix. Verify chronological equivalence, field alignment, checkpoint restoration and a genuine SAC optimizer update.
|
Thanks @Afloat16, this is a clean, well-scoped fix. I checked it against an independent deque reference (capacities 1-8, every starting Before merge
Optional
Out of curiosity, which config hit this? |
|
Changed the import to I reproduced the isolation issue by running only This check used Linux/Python 3.12.14, PyTorch 2.7.1+cpu and NumPy 2.3.5. The other source/config files were checked against the original head's Git blob hashes. I have not rerun the full repository suite or CUDA tests for this import-only update. The triggering case was a synthetic boundary test, using 11 environments and replay capacity 3, derived from the existing SAC fixture. I do not have a production training config to attribute it to. I kept the optional startup warning separate so this update remains focused on replay retention and making its regression run independently. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
When a vectorized SAC rollout inserts more transitions than the replay capacity, the two-slice writer can retain an older prefix or raise a tensor-shape error. Discard the rows that cannot survive the ring and advance the write index over that discarded prefix before the existing writer runs. All transition fields remain aligned, and the resulting contents and next write index match sequential insertion.
The regression tests use an independent chronological queue across capacities, initial write positions and oversized batches. They also cover checkpoint restoration, sampled field alignment, omitted truncation flags, unchanged small-batch controls, and a real CPU SAC update with more environments than replay capacity.
Validation used the complete, unchanged original test scope on Windows with CPython 3.12.13, PyTorch 2.7.1 CPU and NumPy 1.26.4:
os.path.abspath, which returns a Windows path. The original test was kept unchanged, so the local full suite is not entirely passing.--exit-zero, anduv lock --checkpassed before and after. Linux and CUDA CI matrices were not run locally.