DLR-RM / stable-baselines3

PyTorch version of Stable Baselines, reliable implementations of reinforcement learning algorithms.
https://stable-baselines3.readthedocs.io
MIT License
8.84k stars 1.68k forks source link

Fix error when loading a model that has net_arch manually set to None #1937

Closed jak3122 closed 3 months ago

jak3122 commented 4 months ago

Description

Changed the conditional when loading the policy_kwargs to handle the case where the saved net_arch is None, simplified the code a bit, and added a test.

Motivation and Context

I ran into this issue when using a wrapper script that potentially passes None to the net_arch parameter, and then when I go to load the saved model, there is an error.

closes #1928

Types of changes

Checklist

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

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

qgallouedec commented 4 months ago

It's weird because I see you've pushed a fix to my comment on your branch, but I can't see it on the PR page. First time I've seen that.

jak3122 commented 4 months ago

For around a day the PR page said it was processing something. Currently it says "1 workflow awaiting approval". I did forget to use the -u flag when pushing the branch originally, and only used it for the new commit, so I wonder if that broke something. I'll try pushing a dummy commit.

jak3122 commented 4 months ago

Alright now I see the fix commit on the PR page, hope that fixed it!

qgallouedec commented 4 months ago

LGTM, thanks @jak3122! You can add you id to the name of all the contributors (see bottom of changelog)