Skip to content

[Feature] Export replay buffer contents to external datasets - #4574

Closed
bsprenger wants to merge 2 commits into
gh/bsprenger/3/basefrom
gh/bsprenger/3/head
Closed

bsprenger wants to merge 2 commits into
gh/bsprenger/3/basefrom
gh/bsprenger/3/head

Conversation

@bsprenger

@bsprenger bsprenger commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

Description

  • Add ReplayBuffer.export to pass stored replay data to a ReplayDatasetExporter and return the external dataset produced by that exporter.
  • Read entries in storage order by default, or order them by trajectory and step when both keys are supplied.
  • Add synchronization around export and a share_memory option on StorageDataset so export does not need to move CPU storage into shared memory.
  • Add replay buffer, storage, and dataset tests plus reference documentation.

Motivation and Context

This provides a replay buffer API for exporting stored samples to external dataset formats while allowing callers to choose physical storage order or episodic order.

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • New feature (non-breaking change which adds core functionality)
  • Documentation (update in the documentation)

Checklist

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4574

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 692b16b with merge base 264a3c2 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ PR Title Label Error

PR title must start with a label prefix in brackets (e.g., [BugFix]).

Current title: Add replay buffer export API

Supported Prefixes (case-sensitive)

Your PR title must start with exactly one of these prefixes:

Prefix Label Applied Example
[Algorithm] new algo [Algorithm] Add new RL objective
[BE] BE [BE] Improve error messages
[Benchmark] or [Benchmarks] Benchmarks [Benchmark] Add collector benchmark
[BugFix] BugFix [BugFix] Fix memory leak in collector
[Example] or [Examples] Examples [Example] Add training script
[Feature] Feature [Feature] Add new optimizer
[Doc] or [Docs] Documentation [Doc] Update installation guide
[Refactor] Refactoring [Refactor] Clean up module imports
[CI] CI [CI] Fix workflow permissions
[Test] or [Tests] Tests [Tests] Add unit tests for buffer
[Trainer] or [Trainers] Trainers [Trainer] Add trainer config
[Environment] or [Environments] Environments [Environments] Add Gymnasium support
[Data] Data [Data] Fix replay buffer sampling
[LLM] llm/ [LLM] Add reward model integration
[Minor] small change [Minor] Fix typo in error message
[Performance] or [Perf] Performance [Performance] Optimize tensor ops
[BC-Breaking] bc breaking [BC-Breaking] Remove deprecated API
[Deprecation] Deprecation [Deprecation] Mark old function
[Algorithm] or [Algorithms] new algo [Algorithm] Add new objective
[Quality] Quality [Quality] Fix typos and add codespell
[Versioning] versioning [Versioning] Bump release version
[WIP] WIP [WIP] Draft implementation

Note: Common variations like singular/plural are supported (e.g., [Doc] or [Docs]).

@github-actions github-actions Bot added Documentation Improvements or additions to documentation Environments Adds or modifies an environment wrapper Data Data-related PR, will launch data-related jobs ReplayBuffers labels Oct 15, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ PR Title Label Error

PR title must start with a label prefix in brackets (e.g., [BugFix]).

Current title: Add replay buffer export API

Supported Prefixes (case-sensitive)

Your PR title must start with exactly one of these prefixes:

Prefix Label Applied Example
[Algorithm] new algo [Algorithm] Add new RL objective
[BE] BE [BE] Improve error messages
[Benchmark] or [Benchmarks] Benchmarks [Benchmark] Add collector benchmark
[BugFix] BugFix [BugFix] Fix memory leak in collector
[Example] or [Examples] Examples [Example] Add training script
[Feature] Feature [Feature] Add new optimizer
[Doc] or [Docs] Documentation [Doc] Update installation guide
[Refactor] Refactoring [Refactor] Clean up module imports
[CI] CI [CI] Fix workflow permissions
[Test] or [Tests] Tests [Tests] Add unit tests for buffer
[Trainer] or [Trainers] Trainers [Trainer] Add trainer config
[Environment] or [Environments] Environments [Environments] Add Gymnasium support
[Data] Data [Data] Fix replay buffer sampling
[LLM] llm/ [LLM] Add reward model integration
[Minor] small change [Minor] Fix typo in error message
[Performance] or [Perf] Performance [Performance] Optimize tensor ops
[BC-Breaking] bc breaking [BC-Breaking] Remove deprecated API
[Deprecation] Deprecation [Deprecation] Mark old function
[Algorithm] or [Algorithms] new algo [Algorithm] Add new objective
[Quality] Quality [Quality] Fix typos and add codespell
[Versioning] versioning [Versioning] Bump release version
[WIP] WIP [WIP] Draft implementation

Note: Common variations like singular/plural are supported (e.g., [Doc] or [Docs]).

@bsprenger bsprenger changed the title Add replay buffer export API [Feature] Add replay buffer export API Oct 15, 2026
@github-actions github-actions Bot added the Feature New feature label Oct 15, 2026
@bsprenger bsprenger changed the title [Feature] Add replay buffer export API [Feature] Export replay buffer contents to external datasets Oct 15, 2026
@bsprenger
bsprenger requested a review from theap06 October 15, 2026 11:12
@bsprenger bsprenger added the ci/optdeps Run the full tests-optdeps suite on this PR label Oct 18, 2026
[ghstack-poisoned]
bsprenger added a commit that referenced this pull request Oct 18, 2026
ghstack-source-id: 3b6b054
Pull-Request: #4574

@theap06 theap06 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@bsprenger

Copy link
Copy Markdown
Collaborator Author

@torchrlbot merge

@github-actions

Copy link
Copy Markdown
Contributor

Merging ghstack PR via ghstack land (requested by @bsprenger).

@github-actions

Copy link
Copy Markdown
Contributor

ghstack land failed.

ERROR: Fatal exception
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.15/x64/lib/python3.12/site-packages/ghstack/logs.py", line 245, in manager
    yield
  File "/opt/hostedtoolcache/Python/3.12.15/x64/lib/python3.12/site-packages/ghstack/cli.py", line 56, in cli_context
    config = ghstack.config.read_config(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.15/x64/lib/python3.12/site-packages/ghstack/config.py", line 191, in read_config
    github_url = input("GitHub enterprise domain (leave blank for OSS GitHub): ")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line

@bsprenger

Copy link
Copy Markdown
Collaborator Author

Superseded by #4592

@bsprenger bsprenger closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/optdeps Run the full tests-optdeps suite on this PR CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Data Data-related PR, will launch data-related jobs Documentation Improvements or additions to documentation Environments Adds or modifies an environment wrapper Feature New feature ReplayBuffers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants