Skip to content

Commit 358c862

Browse files
authored
9082 educate users on mat mul precision (#9103)
cicd test for doc build was disabled. Will monitor post commit cicd for doc success, because this PR does change the doc build scripts.
1 parent c7ef439 commit 358c862

File tree

10 files changed

+1382
-3
lines changed

10 files changed

+1382
-3
lines changed

docs/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ipynb diff=none merge=binary

docs/README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,53 @@ git push origin gh-pages
2828
To add a new doc please create a `.md` file under this directory. To make this doc show up in our [doc pages](https://pytorch.org/xla/master/index.html), please add a `.rst` file under `source/`.
2929

3030
## Adding images in the doc
31-
Please add your imges to both `_static/img/` and `source/_static/img/` for images to properlly show up in the markdown files as well as our [doc pages](https://pytorch.org/xla/master/index.html).
31+
Please add your imges to both `_static/img/` and `source/_static/img/` for images to properly show up in the markdown files as well as our [doc pages](https://pytorch.org/xla/master/index.html).
32+
33+
## Runnable tutorials
34+
35+
Stylistically, review the [pytorch tutorial contributing guide](https://github.com/pytorch/tutorials/blob/main/CONTRIBUTING.md).
36+
37+
Save your tutorial as `*_tutorial.py`.
38+
39+
We do not yet have an automated build system for runnable tutorials that matches
40+
PyTorch. For now, include manual instructions and check-in the output ipynb and MD files.
41+
42+
TODO: Automate build of runnable tutorials. https://github.com/pytorch/xla/issues/9136
43+
44+
Note that the existing .gitattributes in this directory will prevent diffs and merges
45+
on the ipynb's json representation, which is difficult to diff.
46+
47+
Add your runnable tutorial to the list below with build instructions,
48+
necessary environments, and steps to manually verify correctness.
49+
50+
### source/tutorials/precision_tutorial.py
51+
52+
Run on a TPU machine.
53+
54+
One time installs not in requirements.txt:
55+
56+
```sh
57+
conda install -c conda-forge pandoc
58+
pip install py2nb
59+
```
60+
61+
Install nbsphinx and lxml manually as there is a problem with nbsphinx's
62+
dependency on lxml.
63+
64+
Run every time:
65+
66+
```sh
67+
py2nb source/tutorials/precision_tutorial.py
68+
jupyter nbconvert --to notebook --execute --inplace source/tutorials/precision_tutorial.ipynb
69+
# Ignore SIGTERM
70+
# Manually verify that the final line of precision_tutorial.ipynb matches the snippet below.
71+
./docs_build.sh
72+
# Download build/ to your local machine and visually inspect the precision_tutorial.html in a browser.
73+
# Look for issues like headers that didn't render and mathjax that didn't render.
74+
```
75+
76+
The final code output in the ipynb and html should look like this:
77+
```
78+
Z_ref: FORMAT:0b SIGN:0 EXPONENT:01111111 MANTISSA:01110000101000111101100 VALUE=1.440000057220459
79+
Z: FORMAT:0b SIGN:0 EXPONENT:01111111 MANTISSA:01110000101000111101101 VALUE=1.4400001764297485
80+
```

docs/_static/img/bit_layout.svg

Lines changed: 229 additions & 0 deletions
Loading

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ m2r
44
mistune==0.8.4
55
sphinx==5.3.0
66
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
7+
lxml[html_clean] # Workaround for an issue in nbsphinx dependencies
8+
nbsphinx==0.9.3

0 commit comments

Comments
 (0)