-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add default args in Trainer methods doc #11614
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
Conversation
|
Hello @rasbt For the rest of the code base, I would let sphinx handle the defaults. |
|
Thanks for the note @awaelchli I totally agree with you regarding the maintenance efforts. If it can be added automatically, this would be awesome. I was wondering if this is possible with Sphinx (I know that scikit-learn for example still adds the defaults manually, and I thought there was maybe a limitation in Sphinx)? Right now it looks like that the defaults don't show up in the parameter docstrings: They are only in the call sig above: Or is this what you mean? As a user, I find it very painful to scroll up and down and look for the defaults. It would be nice to have the defaults mentioned in the parameter descriptions. But maybe this shouldn't be done manually like you said, and we could think about a more maintainable solution automating this. |
tchaton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition! Thanks. Even if the maintenance effort is higher, I believe the Trainer should be fully documented.
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions. |
|
Just to bump this up. Any ideas how we should best go about this? I think ideally we want some automatic solution. The question is, does it exist? Maybe not in Sphix, but it might be possible to write a parser doing this. But maybe more a long- rather than short-term solution. Looking at other well maintained packages like scikit-learn, it looks like people still do this manually. |
|
@rasbt Automatic solutions won't work well because defaults are often chosen at runtime because they depend on the setting of other arguments. This is especially true for the Trainer which has so many arguments. Another example is #11950 where an argument gets set to default None simply to detect internally whether the user has explicitly set a value or not, but the value None is never used in the end. We will always have to describe such cases in words :) |
Co-authored-by: Aki Nitta <[email protected]>
rasbt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, was just about to apply those. LGTM. Thanks, Adrian.


What does this PR do?
Added the default values in the Trainer method parameter docstrings where it was missing. I think this makes reading the docs easier.
Btw. maybe it would be better to have a consistent rule/style for this? E.g., I like how scikit-learn is doing it
but maybe we can discuss this in a separate issue/PR
Does your PR introduce any breaking changes? If yes, please list them.
None
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃