Skip to content

Conversation

@araffin
Copy link
Member

@araffin araffin commented Jul 20, 2024

Description

Related to #1069 and #1036 and Stable-Baselines-Team/stable-baselines3-contrib#243 (DroQ and CrossQ)

I also added missing tests for create_mlp.

Motivation and Context

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

closes #1069

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 opened an associated PR on the SB3-Contrib repository (if necessary)
  • I have opened an associated PR on the RL-Zoo3 repository (if necessary)
  • 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

@araffin araffin requested review from Miffyli and qgallouedec July 20, 2024 13:40
else:
modules = []
for module in pre_linear_modules:
modules.append(module(input_dim))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the input dim the same for all modules?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I get it. It only allows modules that have the same input/output dimension.

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe it is clearer with this test:

# assert net == [nn.BatchNorm1d(6), nn.Linear(6, 8), nn.LayerNorm(8), nn.ReLU()
# nn.BatchNorm1d(6), nn.Linear(8, 12), nn.LayerNorm(12), nn.ReLU(),
# nn.BatchNorm1d(12), nn.Linear(12, 2)] # Last layer does not have post_linear

shall I add a comment to avoid confusion?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes! I've also suggested a new documentation: https://github.com/DLR-RM/stable-baselines3/pull/1975/files#r1686213647

araffin and others added 2 commits July 22, 2024 11:34
@araffin araffin merged commit 000544c into master Jul 22, 2024
@araffin araffin deleted the feat/additional-modules-mlp branch July 22, 2024 11:42
friedeggs pushed a commit to friedeggs/stable-baselines3 that referenced this pull request Jul 22, 2024
)

* Add support for pre and post linear modules in `create_mlp`

* Disable mypy for python 3.8

* Reformat toml file

* Update docstring

Co-authored-by: Quentin Gallouédec <[email protected]>

* Add some comments

---------

Co-authored-by: Quentin Gallouédec <[email protected]>
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.

[Question] Policies with layer normalization

3 participants