Split up documentation into subpages and clean up some warnings#37419
Split up documentation into subpages and clean up some warnings#37419mattip wants to merge 9 commits intopytorch:masterfrom
Conversation
💊 Build failures summary and remediationsAs of commit c277285 (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 27 times. |
|
I really like the way you organized the functions to the FYI, I built the docs based on 2fd0354, and published it at https://shawnzhong.github.io/pytorch/. It also turns out that the folder structure works pretty well with PyCharm/Inteiilj's External Documentation (See related discussion on PyTorch Forum) by setting the URL to https://shawnzhong.github.io/pytorch/generated/{element.qname}.html |
| to 'mode', resetting it when we exit the with-block. A no-op if | ||
| mode is None. | ||
|
|
||
| In verison 1.5 changed to this from set_training |
There was a problem hiding this comment.
minor: typo in version here. also set_training looks like it needs double backticks
There was a problem hiding this comment.
and "version" not "verison"
rgommers
left a comment
There was a problem hiding this comment.
This looks quite good and from some testing it seems like this resolves both the searching and the "docs are heavy" issues well.
Visually I think the vertical margins on every function/class entry in autosummary tables could be made smaller, that way things get more compact and it would read even better. Non-blocking comment though, it's a matter of taste and either way this is a significant improvement.
There's a CircleCI job |
|
TL DR: there is a broken test. I propose redoing it properly which will require a few days work. The
This PR broke both sides of the equation:
I propose we use sphinx.ext.coverage to do this for us, but it means investing time to get the call right and parse the output. Are there other options? Should we add a |
|
I was checking the links for the functions and found that some overloaded functions are not linked correctly in For those functions, the second column shows the function signature instead of the description, and the link target is set to torch.html#torch.mul instead of generated/point/torch.mul.html?highlight=mul |
| .. autofunction:: trunc | ||
|
|
||
| .. autosummary:: | ||
| :toctree: generated/point |
There was a problem hiding this comment.
Maybe you want to use generated?
There was a problem hiding this comment.
Not sure if it's just me, but it seems that this change doesn't fix the link issue mentioned above: torch.mul still links to the torch.html#torch.mul.
There was a problem hiding this comment.
Strange. I don't see this on two different builds (both with cuda installed, one on a machine with a GPU, one without). There is nothing obvious in torch/_torch_docs.py in the docstrings for these functions as overloaded from add_docstr(torch.mul,... and friends. What do you mean by "some overloaded functions" - is there something special about mul and pow that my builds are not picking up?
How are you building and uploading the docs to https://shawnzhong.github.io/pytorch ?
I guess I could try to replicate the actual python_doc_push_script.sh in a docker, does that CI step run with a GPU?
There was a problem hiding this comment.
I use a GitHub action to build and push the HTML files to gh_pages, which is served by GitHub pages.
It might be a different environment that causes this issue. I tried to use the same environment as CircileCI, but it seems that I don't have the permission to pull the docker image for building docs. BTW, I just opened a PR to upload the build artifact for python docs at #37658.
There was a problem hiding this comment.
Nvm, it works on the CircleCI build. https://5319560-65600975-gh.circle-artifacts.com/0/~/workspace/build_artifacts/master/index.html
Reading over the sphinx coverage docs, it does seem like this is the right thing to do. You can see the original PR #16039 we mostly added this test script in anger. The important thing is the test needs to fail when you don't document and don't explicitly blacklist. The only plausible alternative is to bulk up the script so that it can handle hierarchy on the documentation; probably not too hard either, but if Sphinx has a built in to do this, we probably should use it. However, there's a huge benefit to getting this PR in directly, so I think that it is OK not to block this PR and disable the check for now, and then fix it later. cc @zasdfgbnm who originally added the test |
I agree that it is a good idea to just disable this test to unblock this. After you disable it, can you open an issue for that? |
|
| Labelling Unsegmented Sequence Data with Recurrent Neural Networks: | ||
| https://www.cs.toronto.edu/~graves/icml_2006.pdf | ||
|
|
||
| .. Note:: |
There was a problem hiding this comment.
Huh, .. Note:: is not actually a thing?
There was a problem hiding this comment.
.. note:: is a directive for general RST and rendered as a <div> with formatting to look like a box, Note: is a docstring heading. I think the intent here is a docstring section
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: This PR allows the build artifacts for python docs to be stored on CircieCI, which helps the reviewer to preview doc changes before merging. The artifacts can be found in the [`ARTIFACTS` tab]( https://app.circleci.com/pipelines/github/pytorch/pytorch/162986/workflows/a969f256-3243-414f-8a02-1234b9dac149/jobs/5320907/artifacts) of the test **pytorch_cpp_doc_push**, and the website is served at https://5320907-65600975-gh.circle-artifacts.com/0/docs/index.html This PR is inspired by rgommers's comment under pytorch#37419 (comment) > There's a CircleCI job pytorch_python_doc_push that builds the docs, however it doesn't store any artifacts for PRs. Controlled by .circleci/scripts/python_doc_push_script.sh. I think that's the only doc build (?). Not sure why it doesn't store the artifacts, that would be useful. Pull Request resolved: pytorch#37658 Differential Revision: D21380094 Pulled By: ezyang fbshipit-source-id: 1dd44bf836ebc74454f4444ae9321807dccdb313
…rch#37419) Summary: xref pytorchgh-32838, pytorchgh-34032 This is a major refactor of parts of the documentation to split it up using sphinx's `autosummary` feature which will build out `autofuction` and `autoclass` stub files and link to them. The end result is that the top module pages like torch.nn.rst and torch.rst are now more like table-of-contents to the actual single-class or single-function documentations pages. Along the way, I modified many of the docstrings to eliminate sphinx warnings when building. I think the only thing I changed from a non-documentation perspective is to add names to `__all__` when adding them to `globals()` in `torch.__init__.py` I do not know the CI system: are the documentation build artifacts available after the build, so reviewers can preview before merging? Pull Request resolved: pytorch#37419 Differential Revision: D21337640 Pulled By: ezyang fbshipit-source-id: d4ad198780c3ae7a96a9f22651e00ff2d31a0c0f
…ubpages and clean up some warnings" (pytorch#37778) Summary: Original PR: pytorch#37419 cc mattip suo Pull Request resolved: pytorch#37778 Differential Revision: D21385774 Pulled By: ezyang fbshipit-source-id: 5de532faab8bae132736b6b5189e0ee2ac9935be
Summary: This PR allows the build artifacts for python docs to be stored on CircieCI, which helps the reviewer to preview doc changes before merging. The artifacts can be found in the [`ARTIFACTS` tab]( https://app.circleci.com/pipelines/github/pytorch/pytorch/162986/workflows/a969f256-3243-414f-8a02-1234b9dac149/jobs/5320907/artifacts) of the test **pytorch_cpp_doc_push**, and the website is served at https://5320907-65600975-gh.circle-artifacts.com/0/docs/index.html This PR is inspired by rgommers's comment under pytorch#37419 (comment) > There's a CircleCI job pytorch_python_doc_push that builds the docs, however it doesn't store any artifacts for PRs. Controlled by .circleci/scripts/python_doc_push_script.sh. I think that's the only doc build (?). Not sure why it doesn't store the artifacts, that would be useful. Pull Request resolved: pytorch#37658 Differential Revision: D21380094 Pulled By: ezyang fbshipit-source-id: 1dd44bf836ebc74454f4444ae9321807dccdb313
…rch#37419) Summary: xref pytorchgh-32838, pytorchgh-34032 This is a major refactor of parts of the documentation to split it up using sphinx's `autosummary` feature which will build out `autofuction` and `autoclass` stub files and link to them. The end result is that the top module pages like torch.nn.rst and torch.rst are now more like table-of-contents to the actual single-class or single-function documentations pages. Along the way, I modified many of the docstrings to eliminate sphinx warnings when building. I think the only thing I changed from a non-documentation perspective is to add names to `__all__` when adding them to `globals()` in `torch.__init__.py` I do not know the CI system: are the documentation build artifacts available after the build, so reviewers can preview before merging? Pull Request resolved: pytorch#37419 Differential Revision: D21337640 Pulled By: ezyang fbshipit-source-id: d4ad198780c3ae7a96a9f22651e00ff2d31a0c0f
…ubpages and clean up some warnings" (pytorch#37778) Summary: Original PR: pytorch#37419 cc mattip suo Pull Request resolved: pytorch#37778 Differential Revision: D21385774 Pulled By: ezyang fbshipit-source-id: 5de532faab8bae132736b6b5189e0ee2ac9935be
|
I am not sure whether to close gh-32838, gh-34032. There is (and probbly will always be) more to do here:
|
|
I think it's ok to file new issues for these, since the main issue has been addressed. |
|
Hey @mattip, we noticed that |
Since much of the content of |
|
Hey @mattip Thanks for the info. And the change looks OK to me. Just one concern, it seems like the RPC package disappeared from the main indexing page (and the left navigation bar) on master: https://pytorch.org/docs/master/ Do we plan to fix that? In the stable release (https://pytorch.org/docs/stable/), there is a |
Summary: Fixes gh-40046 PR gh-37419 refactored the content of `docs/source/rpc/index.rst` into `docs/source/rpc.rst` but did not link to the latter from `doc/source/index.rst` so the top-level RPC documentation is missing from https://pytorch.org/docs/master/. Pull Request resolved: #40077 Differential Revision: D22068128 Pulled By: mrshenli fbshipit-source-id: 394433f98f86509e0c9cb6d910a86fb8a2932683
Summary: Fixes pytorchgh-40046 PR pytorchgh-37419 refactored the content of `docs/source/rpc/index.rst` into `docs/source/rpc.rst` but did not link to the latter from `doc/source/index.rst` so the top-level RPC documentation is missing from https://pytorch.org/docs/master/. Pull Request resolved: pytorch#40077 Differential Revision: D22068128 Pulled By: mrshenli fbshipit-source-id: 394433f98f86509e0c9cb6d910a86fb8a2932683
Summary: This PR allows the build artifacts for python docs to be stored on CircieCI, which helps the reviewer to preview doc changes before merging. The artifacts can be found in the [`ARTIFACTS` tab]( https://app.circleci.com/pipelines/github/pytorch/pytorch/162986/workflows/a969f256-3243-414f-8a02-1234b9dac149/jobs/5320907/artifacts) of the test **pytorch_cpp_doc_push**, and the website is served at https://5320907-65600975-gh.circle-artifacts.com/0/docs/index.html This PR is inspired by rgommers's comment under pytorch#37419 (comment) > There's a CircleCI job pytorch_python_doc_push that builds the docs, however it doesn't store any artifacts for PRs. Controlled by .circleci/scripts/python_doc_push_script.sh. I think that's the only doc build (?). Not sure why it doesn't store the artifacts, that would be useful. Pull Request resolved: pytorch#37658 Differential Revision: D21380094 Pulled By: ezyang fbshipit-source-id: 1dd44bf836ebc74454f4444ae9321807dccdb313
…rch#37419) Summary: xref pytorchgh-32838, pytorchgh-34032 This is a major refactor of parts of the documentation to split it up using sphinx's `autosummary` feature which will build out `autofuction` and `autoclass` stub files and link to them. The end result is that the top module pages like torch.nn.rst and torch.rst are now more like table-of-contents to the actual single-class or single-function documentations pages. Along the way, I modified many of the docstrings to eliminate sphinx warnings when building. I think the only thing I changed from a non-documentation perspective is to add names to `__all__` when adding them to `globals()` in `torch.__init__.py` I do not know the CI system: are the documentation build artifacts available after the build, so reviewers can preview before merging? Pull Request resolved: pytorch#37419 Differential Revision: D21337640 Pulled By: ezyang fbshipit-source-id: d4ad198780c3ae7a96a9f22651e00ff2d31a0c0f
…ubpages and clean up some warnings" (pytorch#37778) Summary: Original PR: pytorch#37419 cc mattip suo Pull Request resolved: pytorch#37778 Differential Revision: D21385774 Pulled By: ezyang fbshipit-source-id: 5de532faab8bae132736b6b5189e0ee2ac9935be
Summary: Fixes pytorchgh-40046 PR pytorchgh-37419 refactored the content of `docs/source/rpc/index.rst` into `docs/source/rpc.rst` but did not link to the latter from `doc/source/index.rst` so the top-level RPC documentation is missing from https://pytorch.org/docs/master/. Pull Request resolved: pytorch#40077 Differential Revision: D22068128 Pulled By: mrshenli fbshipit-source-id: 394433f98f86509e0c9cb6d910a86fb8a2932683



xref gh-32838, gh-34032
This is a major refactor of parts of the documentation to split it up using sphinx's
autosummaryfeature which will build outautofuctionandautoclassstub files and link to them. The end result is that the top module pages like torch.nn.rst and torch.rst are now more like table-of-contents to the actual single-class or single-function documentations pages.Along the way, I modified many of the docstrings to eliminate sphinx warnings when building. I think the only thing I changed from a non-documentation perspective is to add names to
__all__when adding them toglobals()intorch.__init__.pyI do not know the CI system: are the documentation build artifacts available after the build, so reviewers can preview before merging?