stable-baselines3
stable-baselines3 copied to clipboard
Wrong types for policy parameters in Documentation
📚 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
- [X] I have checked that there is no similar issue in the repo
- [X] I have read the documentation
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 https://github.com/sphinx-doc/sphinx/issues/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).
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: https://github.com/sphinx-doc/sphinx/issues/11207