@@ -169,7 +169,10 @@ Tests that require internet access should be in
169169Torchvision uses [ Google style] ( http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html )
170170for formatting docstrings. Length of line inside docstrings block must be limited to 120 characters.
171171
172- Please, follow the instructions to build and deploy the documentation locally.
172+ All documentation is built for each PR and contains a preview on the PR.
173+ However, it is often useful to build the docs locally when making a lot of
174+ documentation changes. Please, follow the instructions to build and deploy the
175+ documentation locally.
173176
174177#### Install requirements
175178
@@ -209,6 +212,35 @@ You can also choose to only build a subset of the examples by using the
209212example `` EXAMPLES_PATTERN="transforms" make html `` will only build the examples
210213with "transforms" in their name.
211214
215+ #### Serving docs locally (if building from a GPU env)
216+
217+ If you're developing locally, you can just open the generated ` index.html ` file
218+ in your browser.
219+
220+ If instead you're using a remote machine, you can use a combination of a simple
221+ python HTTP server and port forwarding to serve the docs locally. This allows
222+ you to iterate on the documentation much more quickly than relying on PR
223+ previews.
224+
225+ To do so, after following the above doc build steps, run the following from the
226+ ` docs/build/html ` folder:
227+
228+ ```
229+ python -m http.server 8000 # or any free port
230+ ```
231+
232+ This will open up a simple HTTP server serving the files in the build directory.
233+ If this is done on a remote machine, you can set up port forwarding from your
234+ local machine to access the server, for example:
235+
236+ ```
237+ ssh -L 9000:localhost:8000 $REMOTE_DEV_HOST
238+ ```
239+
240+ Now, you can navigate to ` localhost:9000 ` on your local machine to view
241+ the rendered documentation.
242+
243+
212244### New architecture or improved model weights
213245
214246Please refer to the guidelines in [ Contributing to Torchvision - Models] ( https://github.com/pytorch/vision/blob/main/CONTRIBUTING_MODELS.md ) .
0 commit comments