Accessing PyTorch documentation offline

sahni: <p>Is there a way for me to access PyTorch documentation offline? I checked the github repo and there seems to be a doc folder but I am not clear on how to generate the documentation so that I can use it offline.<br>
I am looking for documentation for stable 0.4.0.</p>

albanD: <p>Hi,</p>
<p>The doc needs to be generated from the source code.<br>
To get it you will need to go into the <code>docs</code> folder and then run <code>make</code> (or the bat file if you’re on windows). You might need to install the dependencies in the requirements.txt file before.<br>
Once <code>make</code> run, you will have a local html file that you can browse offfline containing all the doc.</p>

sahni: <p>Thanks. I was able to generate the documentation in html format using the steps you mentioned. Any idea how I can generate the docs specific to 0.4.0 stable? The generated docs show unstable 0.3.0.post4. I tried checking out to tag v0.4.0 in repo, but it still generates the unstable docs.</p>

albanD: <p>The version number might not be correct. Because the build system for the releases is reponsible for setting the versions to something else than “unstable”.<br>
It will generate the doc for the current version of the repo. So if you’re at tag 0.4.0, it will generate the doc for this version.</p>

sahni: <p>Thanks for clarifying.</p>

FrancoisFleuret: <p>It would be quite handy to have conda packages with the documentation though.</p>

Edgar_Medina: <p>Hi, but how can I run the Makefile in some specific folder?  I want to install the docs only.</p>

Wendell_Philips: <p>how to install the dependencies in the requirements.txt</p>
<pre><code class="lang-bash">sh ./Makefile
./Makefile: 5: ./Makefile: SPHINXOPTS: not found
./Makefile: 6: ./Makefile: SPHINXBUILD: not found
./Makefile: 7: ./Makefile: SPHINXPROJ: not found
./Makefile: 8: ./Makefile: SOURCEDIR: not found
./Makefile: 9: ./Makefile: BUILDDIR: not found
./Makefile: 10: ./Makefile: PYCMD: not found
./Makefile: 13: ./Makefile: help:: not found
./Makefile: 14: ./Makefile: SPHINXBUILD: not found
./Makefile: 14: ./Makefile: SOURCEDIR: not found
./Makefile: 14: ./Makefile: BUILDDIR: not found
./Makefile: 14: ./Makefile: SPHINXOPTS: not found
./Makefile: 14: ./Makefile: O: not found
./Makefile: 14: ./Makefile: @: not found
./Makefile: 16: ./Makefile: figures:: not found
./Makefile: 17: ./Makefile: PYCMD: not found
./Makefile: 17: ./Makefile: @: not found
./Makefile: 19: ./Makefile: docset:: not found
./Makefile: 20: ./Makefile: SPHINXPROJ: not found
./Makefile: 20: ./Makefile: SOURCEDIR: not found
./Makefile: 20: ./Makefile: BUILDDIR: not found
./Makefile: 20: ./Makefile: doc2dash: not found
./Makefile: 23: ./Makefile: SPHINXPROJ: not found
./Makefile: 23: ./Makefile: SPHINXPROJ: not found
cp: cannot stat '.docset/icon.png': No such file or directory
./Makefile: 24: ./Makefile: SPHINXPROJ: not found
./Makefile: 24: ./Makefile: SPHINXPROJ: not found
convert: unable to open image `.docset/icon@2x.png': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: no images defined `.docset/icon.png' @ error/convert.c/ConvertImageCommand/3210.
./Makefile: 26: ./Makefile: html-stable:: not found
Traceback (most recent call last):
  File "source/scripts/build_activation_images.py", line 67, in &lt;module&gt;
    function = torch.nn.modules.activation.__dict__[function_name]()
KeyError: 'CELU'
Makefile:17: recipe for target 'figures' failed
make: *** [figures] Error 1
./Makefile: 33: ./Makefile: .PHONY:: not found
./Makefile: 37: ./Makefile: %:: not found
./Makefile: 38: ./Makefile: SPHINXBUILD: not found
./Makefile: 38: ./Makefile: SOURCEDIR: not found
./Makefile: 38: ./Makefile: BUILDDIR: not found
./Makefile: 38: ./Makefile: SPHINXOPTS: not found
./Makefile: 38: ./Makefile: O: not found
./Makefile: 38: ./Makefile: @: not found
./Makefile: 40: ./Makefile: clean:: not found
./Makefile: 41: ./Makefile: @echo: not found
./Makefile: 42: ./Makefile: BUILDDIR: not found
./Makefile: 42: ./Makefile: BUILDDIR: not found
./Makefile: 42: ./Makefile: @rm: not found
</code></pre>

albanD: <p>You’re note suppose to execute a <code>Makefile</code> with bash. Just run <code>make</code> in the folder where the <code>Makefile</code> is.</p>

Wendell_Philips: <p>Thank you for your Replay. But I still got the issue.</p>
<aside class="quote no-group quote-modified" data-username="Wendell_Philips" data-post="8" data-topic="20453">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/wendell_philips/48/9695_2.png" class="avatar"> Wendell_Philips:</div>
<blockquote>
<pre data-code-wrap="bash"><code class="lang-bash">Traceback (most recent call last): File "source/scripts/build_activation_images.py", line 67, in &amp;lt;module&amp;gt; function = torch.nn.modules.activation.__dict__[function_name]() KeyError: 'CELU' Makefile:17: recipe for target 'figures' failed make: *** [figures] Error 1
</code></pre>
</blockquote>
</aside>

joaobrasil65: <p>Not working for me in May 2021</p>
<p>ARNING: autodoc: failed to import class ‘ConvReLU3d’ from module ‘torch.nn.intrinsic.qat’; the following exception was raised:<br>
Traceback (most recent call last):<br>
File “c:\python38\lib\site-packages\sphinx\util\inspect.py”, line 403, in safe_getattr<br>
return getattr(obj, name, *defargs)<br>
AttributeError: module ‘torch.nn.intrinsic.qat’ has no attribute ‘ConvReLU3d’</p>
<p>The above exception was the direct cause of the following exception:</p>
<p>Traceback (most recent call last):<br>
File “c:\python38\lib\site-packages\sphinx\ext\autodoc\importer.py”, line 111, in import_object<br>
obj = attrgetter(obj, mangled_name)<br>
File “c:\python38\lib\site-packages\sphinx\ext\autodoc_<em>init</em>_.py”, line 320, in get_attr<br>
return autodoc_attrgetter(self.env.app, obj, name, *defargs)<br>
File “c:\python38\lib\site-packages\sphinx\ext\autodoc_<em>init</em>_.py”, line 2604, in autodoc_attrgetter<br>
return safe_getattr(obj, name, *defargs)<br>
File “c:\python38\lib\site-packages\sphinx\util\inspect.py”, line 419, in safe_getattr<br>
raise AttributeError(name) from exc<br>
AttributeError: ConvReLU3d</p>
<p>c:\python38\lib\site-packages\torch\nn\quantized\modules\activation.py:docstring of torch.nn.quantized.modules.activation.ReLU6:14: WARNING: image file not readable: scripts/activation_images/ReLU6.png<br>
looking for now-outdated files… none found<br>
pickling environment… done<br>
checking consistency… done<br>
preparing documents… done<br>
writing output… [  0%] complex_numbers<br>
Exception occurred:<br>
File “c:\python38\lib\subprocess.py”, line 1307, in _execute_child<br>
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,<br>
FileNotFoundError: [WinError 2] The system cannot find the file specified<br>
The full traceback has been saved in C:\Users\paulb\AppData\Local\Temp\sphinx-err-nxayl6xl.log, if you want to report the issue to the developers.<br>
Please also report this if it was a user error, so that a better error message can be provided next time.<br>
A bug report can be filed in the tracker at <a href="https://github.com/sphinx-doc/sphinx/issues" rel="noopener nofollow ugc">https://github.com/sphinx-doc/sphinx/issues</a>. Thanks!</p>

albanD: <p>Hi,</p>
<p>We build the doc on linux machines all the time I’m afraid. It might be possible that it is not working on Windows <img src="https://discuss.pytorch.org/images/emoji/apple/confused.png?v=9" title=":confused:" class="emoji" alt=":confused:"><br>
Do you have a linux machine you can use to get the doc by any chance?</p>
<p>Another convoluted way to do this is to download it directly from our build.<br>
On every PR (pick one randomly on pytorch github), there is a <code>pytorch_python_doc_build</code> that actually builds the doc. You can check there the artifact page that contains the full doc: <a href="https://app.circleci.com/pipelines/github/pytorch/pytorch/326575/workflows/30cd30c4-fea5-4165-ab08-a54b85d0e67e/jobs/13676034/artifacts">https://app.circleci.com/pipelines/github/pytorch/pytorch/326575/workflows/30cd30c4-fea5-4165-ab08-a54b85d0e67e/jobs/13676034/artifacts</a><br>
You can download all of these as a single file by using circle CI API directly: <a href="https://circleci.com/docs/2.0/artifacts/#downloading-all-artifacts-for-a-build-on-circleci" class="inline-onebox">Storing Build Artifacts - CircleCI</a></p>