Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong types for policy parameters in Documentation #1815

Open
2 tasks done
mspils opened this issue Jan 25, 2024 · 2 comments
Open
2 tasks done

Wrong types for policy parameters in Documentation #1815

mspils opened this issue Jan 25, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@mspils
Copy link

mspils commented Jan 25, 2024

📚 Documentation

The documentation for all RL algorithms claims that the parameter policy has the type SACPolicy or ActorCriticPolicy or TD3Policy and so on: https://stable-baselines3.readthedocs.io/en/master/modules/td3.html#parameters
Example:
policy (TD3Policy) – The policy model to use (MlpPolicy, CnnPolicy, …)

This is not true, it expects either a string from the policy_aliases dict or a policy class. This is rather confusing and I just spend quite a bit figuring out why I could not pass a policy object.
In the docstrings and source code the type is correct.

I think the problem may be, that the type hints for the class variables overwrite the type hints for the parameters when the documentation is generated.

Should i just make a pull request with where I change the type hints for class variables?

Checklist

@mspils mspils added the documentation Improvements or additions to documentation label Jan 25, 2024
@araffin
Copy link
Member

araffin commented Jan 26, 2024

Hello,

thanks for reporting the issue.

I think the problem may be, that the type hints for the class variables overwrite the type hints for the parameters when the documentation is generated.

sounds like a sphinx issue.

Should i just make a pull request with where I change the type hints for class variables?

I'm afraid this will generate new issue with type checking.
I would rather investigate and ask sphinx devs if it's a bug on their side (might be related to sphinx-doc/sphinx#10934).

In the meantime, we should try different options to maybe mask those attributes (from https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html).

@araffin
Copy link
Member

araffin commented Jan 26, 2024

I've found a partial fix following https://stackoverflow.com/questions/46569163/sphinx-document-an-attribute-that-is-same-as-a-parameter by specifying :special-members: __init__

And this is a sphinx issue: sphinx-doc/sphinx#11207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants