Skip to content

feat(rl): add replay-buffer persistence for interrupted training runs#809

Open
isaac-gumbrell wants to merge 5 commits into
assume-framework:mainfrom
isaac-gumbrell:pr/save-replay-buffer
Open

feat(rl): add replay-buffer persistence for interrupted training runs#809
isaac-gumbrell wants to merge 5 commits into
assume-framework:mainfrom
isaac-gumbrell:pr/save-replay-buffer

Conversation

@isaac-gumbrell

Copy link
Copy Markdown
Contributor

Description

This PR adds replay-buffer persistence for reinforcement-learning runs.

The motivation is recovery from interrupted long-running training jobs. When a run crashes or is stopped partway through, reusing the replay buffer avoids recollecting the full experience set from scratch, which can significantly reduce rerun time and speed up recovery.

Changes in this PR:

  • add replay-buffer save/load support
  • integrate replay-buffer restore into scenario loading / training setup
  • add persistence tests
  • document the new learning-config options
  • add the new replay-buffer config items to all example scenarios with learning enabled

Checklist

  • Documentation updated (docstrings, READMEs, user guides, inline comments, doc folder updates etc.)
  • New unit/integration tests added (if applicable)
  • Changes noted in release notes (if any)
  • Consent to release this PR's code under the GNU Affero General Public License v3.0

igumbrell_deloitte and others added 3 commits May 25, 2026 11:06
This test imports torch, which is only installed after the first pytest run.
The marker ensures the test is skipped during the initial test phase and only
runs after torch is installed in the learning dependencies phase.
@isaac-gumbrell isaac-gumbrell changed the title Pr/save replay buffer feat(rl): add replay-buffer persistence for interrupted training runs May 25, 2026
This follows the existing RL test pattern. The try/except at module level
prevents ImportError during pytest collection when torch is not installed.
The importorskip inside the test provides an additional safety check to
skip the test if torch becomes unavailable at runtime.
Only import torch via pytest.importorskip inside the test function.
This prevents the F401 unused import error from ruff while still
providing ImportError handling for pytest collection.
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.68966% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.44%. Comparing base (c330ab5) to head (7c39cae).

Files with missing lines Patch % Lines
assume/scenario/loader_csv.py 54.28% 16 Missing ⚠️
assume/reinforcement_learning/buffer.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #809      +/-   ##
==========================================
- Coverage   80.51%   80.44%   -0.07%     
==========================================
  Files          56       56              
  Lines        9056     9112      +56     
==========================================
+ Hits         7291     7330      +39     
- Misses       1765     1782      +17     
Flag Coverage Δ
pytest 80.44% <70.68%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kim-mskw kim-mskw self-requested a review May 27, 2026 08:39
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