Skip to content
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

[docs] Add "Open with Colab" button to documentation #13627

Merged
merged 10 commits into from
Jan 7, 2023

Conversation

guberti
Copy link
Member

@guberti guberti commented Dec 16, 2022

This pull request adds an "Open in Colab" button to all of TVM's tutorials. With one click, users can play around with and modify the TVM docs without having to install anything locally. The docs will now have this button at the top:

image


There seems to be an issue with @tvm-bot building docs right now (see other PRs), so I don't have a live demo. You can try it locally by cloning the repo and following the steps in docs/README.md. You can also check out a few examples here:

This pull request was co-authored by @guberti, @mehrdadh, @areusch, @mkatanbaf, and @alanmacd as a hackathon project.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Dec 16, 2022

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to tag found in teams: docs See #10317 for details

Generated by tvm-bot

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for very good improvements of TVM documentation. Looks awesome! Some comments:

docs/Makefile Outdated Show resolved Hide resolved
docs/conf.py Outdated
This tutorial can be used interactively with Google Colab! You can also click
:ref:`here <sphx_glr_download_{1}>` to run the Jupyter notebook locally.

.. image:: https://raw.githubusercontent.com/guberti/web-data/main/images/utilities/colab_button.svg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this path to the image. Probably, we should upload this image file to https://github.com/tlc-pack/web-data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I had reviewed your PR, I found that the same image file was already used in gallery/how_to/work_with_microtvm/micro_train.py. So probably, you can reuse this link: https://raw.githubusercontent.com/tlc-pack/web-data/main/images/utilities/colab_button.png

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During the Hackathon, I redid this image to be a cleaner SVG. I've got a PR out to update this and remove the png version - see tlc-pack/web-data#18.

docs/conf.py Outdated Show resolved Hide resolved
gallery/how_to/work_with_microtvm/install_zephyr.py Outdated Show resolved Hide resolved
apps/microtvm/poetry.lock Outdated Show resolved Hide resolved
@@ -30,6 +30,29 @@
or on Zephyr platform on a microcontroller/board supported by Zephyr.
"""

######################################################################
#
# .. include:: ../../../../gallery/how_to/work_with_microtvm/install_zephyr.rst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to find where else you have included this install_zephyr.rst. But didn't find it. Probably you can just move the context of install_zephyr.rst to this file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be in favor of this, but I'd love to get thoughts from @mehrdadh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be added to all microTVM Zephyr tutorials. I think some of them are missing in this PR. That's why we refactored it to a separate file

tests/lint/check_request_hook.py Outdated Show resolved Hide resolved
gallery/how_to/compile_models/from_keras.py Outdated Show resolved Hide resolved
@guberti guberti marked this pull request as draft December 16, 2022 19:06
@mehrdadh mehrdadh changed the title [docs] Add "Open with Colab" button to documentation [DRAFT][docs] Add "Open with Colab" button to documentation Dec 16, 2022
@guberti
Copy link
Member Author

guberti commented Dec 27, 2022

@echuraev thanks for the very fast review! We weren't quite done with the PR at the time, so a few of your comments are now outdated. I've addressed the others, though - thanks for the feedback!

You also asked about CPU versus GPU runtimes for Google Colab. Unfortunately, these can only be selected from the drop-down menu. However, I modified docs/conf.py to look for usage of cuda - now, we install a CUDA-enabled TVM version if and only if the tutorial requires it.

@guberti guberti changed the title [DRAFT][docs] Add "Open with Colab" button to documentation [docs] Add "Open with Colab" button to documentation Dec 27, 2022
@guberti guberti marked this pull request as ready for review December 27, 2022 02:03
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @guberti ! added some feedback here, mostly just formatting and clarifications

apps/microtvm/pyproject.toml Outdated Show resolved Hide resolved
docs/conf.py Outdated Show resolved Hide resolved
docs/conf.py Show resolved Hide resolved
docs/conf.py Show resolved Hide resolved
docs/conf.py Outdated Show resolved Hide resolved
docs/conf.py Show resolved Hide resolved
gallery/how_to/work_with_microtvm/micro_aot.py Outdated Show resolved Hide resolved
gallery/how_to/work_with_microtvm/micro_tflite.py Outdated Show resolved Hide resolved
gallery/how_to/work_with_microtvm/micro_tflite.py Outdated Show resolved Hide resolved
mehrdadh and others added 8 commits December 29, 2022 13:38
Updated pyproject and lock file with apache tvm

Auto-generate Colab header

add requirements.txt

Use SVG icon

update requirement.txt
Fix how_to/compile_models to work in Colab

Get Relay tutorials working with Colab

Extend TVM tutorials in Colab

remove tvm from requirements.txt

Add support for multiple versions

Revert "Extend TVM tutorials in Colab"

This reverts commit 0f6037c.

Revert "Get Relay tutorials working with Colab"

This reverts commit 1c4cdfd.

Fix up compile models tutorials

Better working with Pytorch instructions
qemu binary doesnt run

Use include

Fix import

Hack to correctly handle literalinclude

Add required empty line

add custom directive

Strip iPython magic from HTML

Fix syntax highlighting issue
Revert "Hack to render %env correctly"

This reverts commit 9690a2b.

Fix whitespace

fix empty block

move py to rst

Add include directive support

fix

refactor cmsis in RST file

add pytorch support
TVM dev bugfix

change shell to bash

updating microTVM tutorials

move to relative home directory

lint

lint part 2

back to /content
Fix warnings from RST import
Use interactive %%shell instead of %%bash

Revert eliminations of cuda() call

Remove build hacks

Don't re-install non-GPU Torch versions

Revert comment issue

Address some comments from code review
Flag tutorials that require cuda

Clarify docstring slightly

Change position of requires_cuda config

Allow other sphinx_gallery flags inside request hook

Fix comments and admonition directives

Fix microTVM install scripts
@areusch areusch merged commit 30abbe9 into apache:main Jan 7, 2023
Copy link
Member

@mehrdadh mehrdadh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for delay in review, LGTM!

fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
* Add Colab header to TVM tutorials by default
* Fix library imports to work with Colab
* Better support for Jupyter magic and directives

Co-authored-by: Mehrdad Hessar <mhessar@octoml.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants