-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
Fix the return documentation rendering for all model outputs #6022
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6022 +/- ##
==========================================
+ Coverage 78.29% 78.70% +0.40%
==========================================
Files 146 146
Lines 26249 26268 +19
==========================================
+ Hits 20552 20674 +122
+ Misses 5697 5594 -103
Continue to review full report at Codecov.
|
blocks = [] | ||
current_block = "" | ||
for line in output_args_doc.split("\n"): | ||
# If the indent is the same as the beginning, the line is the name of new arg. |
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.
this is crazy!
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.
do you call _convert_output_args_doc
anywhere?
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.
Just a little bit under in _prepare_output_docstrings
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.
I kind of find the old one more readable, but I agree it's better to be more coherent between inputs/outputs. Thanks for looking into it!
All PyTorch model outputs are documented from their output types. A problem is that just using the docstrings of the output class doesn't render properly on sphinx (this was also the case before the new model outputs were introduced).
This PR adds a function that converts the args part of the docstrings of the output class to render properly on our doc. You can see the transformation by looking here for the docs before this PR and here for after it's merged (it's one example, but it will give the same result for all models). Scroll a bit to get to the return part of the doc.