-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[DOC] add Thinking In JAX doc #5426
Conversation
24d91c8
to
63d018c
Compare
@jakevdp Hope you didn't mind me taking a look. I've got some ML editing experience (a book, docs). Thanks for writing this Thinking 🤔 in JAX guide 👍 Update: the RST is very well-formatted btw 👏. |
1f17cab
to
5007727
Compare
f3efe3f
to
f247349
Compare
6be7886
to
50c996a
Compare
@levskaya pointed out in chat that the ipython-sphinx approach here has a real downside: code blocks are intermingled with IPython prompts, which makes them less convenient for copy/pasteing from the doc. I'm going to mark this WIP for now and explore other approaches. |
@jakevdp I was wondering if there a particular reason why the team favors RST with iPython here? I understand that Sphinx works with Markdown and I noticed the following JAX guides were created as MD files: Device Memory Profiling, To follow the lessons from the How to think in JAX guide, I manually converted the RST file into a Jupyter notebook paragraph by paragraph. Then, I formatted RTS-flavored code text ( Again, thanks for putting together How to think in JAX. |
We've been discussing this elsewhere... the main reason I chose rst is because of the better support for doctests and cross referencing... we've had issues with our notebook-based documentation getting out-of-date. I actually wrote this content originally as a notebook, then translated to RST for that reason. Notebooks are also very difficult to track well in version control, and require a fairly heavy toolchain to build (e.g. pandoc) so I'm leaning toward converting our existing notebook sources to something text-based, like RST or markdown. I'm not sure we're going to go the ipython-sphinx route, though, because it makes it difficult to copy code blocks (as mentioned above). Markdown is certainly nicer than RST for composing documents, but does not support things like cross-references very well, although myst-md is a nice hybrid approach. It also doesn't do a good job of distinguishing between code blocks and output blocks. I'm looking into myst-nb, but the doctesting story there is not particularly clear. |
...unless you paste them in |
b7e6c38
to
19f8f57
Compare
OK, I pushed an update where I use I think myst-nb is a pretty good system that ticks a lot of our boxes. WDYT? |
19f8f57
to
2d4dc67
Compare
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.
Found the last couple of NumPy
s
Yes, you can take a look at the rendered version here: https://jax--5426.org.readthedocs.build/en/5426/notebooks/quickstart.html |
5f3cf6a
to
832dc63
Compare
Unfortunately, it looks like execution errors in myst-nb don't lead sphinx to fail, but only to a warning. This is unfortunate because it means that failures will silently result in unexpected errors being published to our docs via cell outputs. This issue was reported last year in executablebooks/MyST-NB#248; the suggestion there is to use the I consider this a hard blocker: if we can't find a way to surface notebook execution errors as build failures rather than warnings, I don't think myst-nb is going to be a good solution for JAX. |
Given the failed execution issue, I think it's worth pursuing other options. I'm going to revisit the idea of using RST directly. |
Interesting discussion! For our HOWTO system in Flax we are also exploring options on how to explain things with code that is tested, while still being easily usable with git. Avital suggested to use Sphinx's @jakevdp: Looking at the issue you linked in myst-nb, it seems that they are planning to fix it in the coming weeks. Supposing that they fix the issue, do you think myst-nb is prefable over doctest? |
832dc63
to
cba5284
Compare
I've decided to punt on the myst-nb question for now, in favor of just getting the thinking in jax content onto the website. I converted the notebook back to ipynb, reverted the old commits, and pushed the ipynb here. |
cc245c9
to
0f63639
Compare
Ready for review: see the final rendered doc page here: https://jax--5426.org.readthedocs.build/en/5426/notebooks/thinking_in_jax.html |
Btw the 'rendered page' link in the OP didn't work for me, but this does. EDIT: the one in your most recent comment worked though. |
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.
Wow this is phenomenal. Fantastic work.
Only suggestion I could come up with: maybe rephrase "JAX's layers of API" to "JAX API layering".
8e29ebb
to
7c15225
Compare
Done |
I fixed the rendered page link in the first comment (it was from an earlier iteration and was missing the |
807c6f2
to
2920354
Compare
2920354
to
967f3ac
Compare
Addresses #4643
Rendered page: https://jax--5426.org.readthedocs.build/en/5426/notebooks/thinking_in_jax.html