Skip to content

Update OnPolicyAlgorithmJax & PPO to support custom rollout_buffer_class#90

Merged
araffin merged 4 commits into
araffin:masterfrom
Trenza1ore:support-custom-buffer-class
May 11, 2026
Merged

Update OnPolicyAlgorithmJax & PPO to support custom rollout_buffer_class#90
araffin merged 4 commits into
araffin:masterfrom
Trenza1ore:support-custom-buffer-class

Conversation

@Trenza1ore
Copy link
Copy Markdown
Contributor

Description

Fixes #89

Just a small add to support rollout_buffer_class and rollout_buffer_kwargs arguments in constructor of PPO and OnPolicyAlgorithmJax, like in Stable Baselines3.

Motivation and Context

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

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist:

  • I've read the CONTRIBUTION guide (required)
  • I have updated the changelog accordingly (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.
  • I have reformatted the code using make format (required)
  • I have checked the codestyle using make check-codestyle and make lint (required)
  • I have ensured make pytest and make type both pass. (required)
  • I have checked that the documentation builds using make doc (required)

Note: You can run most of the checks using make commit-checks.

Note: we are using a maximum length of 127 characters per line

Comment thread sbx/common/on_policy_algorithm.py Outdated

self.rollout_buffer = RolloutBuffer(
if self.rollout_buffer_class is None:
if isinstance(self.observation_space, spaces.Dict):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

is dict obs space supported for PPO?
if not, maybe put an assert (and add a small test to check it fails)

Copy link
Copy Markdown
Contributor Author

@Trenza1ore Trenza1ore May 8, 2026

Choose a reason for hiding this comment

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

MultiInputPolicy indeed haven't been implemented for PPO yet. I added the assertion and new test case for it. Although @araffin maybe it's a bit better to raise NotImplementedError here and in OffPolicyAlgorithmJax._setup_model()?

Copy link
Copy Markdown
Owner

@araffin araffin left a comment

Choose a reason for hiding this comment

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

thanks for the PR, overall LGTM =) just a small comment

Copy link
Copy Markdown
Owner

@araffin araffin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks =)

@araffin araffin merged commit cd77f42 into araffin:master May 11, 2026
4 checks passed
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.

[Feature Request] On policy algorithm (PPO) does not support custom rollout_buffer_class

2 participants