-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add a Python tutorial template #2264
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aca4efd
Add a Python tutorial template
9b930cc
Update template_tutorial.py
2f440ae
Update template_tutorial.py
1ca1a6a
Update template_tutorial.py
46b0ff6
Merge branch 'main' into add-tutorial-template
e08196b
Update template_tutorial.py
9c10300
Merge branch 'main' into add-tutorial-template
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Template Tutorial | ||
================= | ||
|
||
**Author:** `FirstName LastName <https://github.com/username>`_ | ||
|
||
.. grid:: 2 | ||
|
||
.. grid-item-card:: :octicon:`mortar-board;1em;` What you will learn | ||
|
||
* Item 1 | ||
* Item 2 | ||
* Item 3 | ||
|
||
.. grid-item-card:: :octicon:`list-unordered;1em;` Prerequisites | ||
|
||
* PyTorch v2.0.0 | ||
* GPU ??? | ||
* Other items 3 | ||
|
||
If you have a video, add it here like this: | ||
|
||
.. raw:: html | ||
|
||
<div style="margin-top:10px; margin-bottom:10px;"> | ||
<iframe width="560" height="315" src="https://www.youtube.com/embed/IC0_FRiX-sw" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | ||
</div> | ||
|
||
To test your tutorial locally, you can do one of the following: | ||
|
||
* You can control specific files that generate the results by using | ||
``GALLERY_PATTERN`` environment variable. The GALLERY_PATTERN variable | ||
respects regular expressions. | ||
For example to run only ``neural_style_transfer_tutorial.py``, | ||
use the following command: | ||
|
||
.. code-block:: sh | ||
|
||
GALLERY_PATTERN="neural_style_transfer_tutorial.py" make html | ||
|
||
or | ||
|
||
.. code-block:: sh | ||
|
||
GALLERY_PATTERN="neural_style_transfer_tutorial.py" sphinx-build . _build | ||
|
||
* Make a copy of this repo and add only your | ||
tutorial to the `beginner_source` directory removing all other tutorials. | ||
Then run ``make html``. | ||
|
||
Verify that all outputs were generated correctly in the created HTML. | ||
""" | ||
|
||
######################################################################### | ||
# Overview | ||
# -------- | ||
# | ||
# Describe Why is this topic important? Add Links to relevant research papers. | ||
# | ||
# This tutorial walks you through the process of.... | ||
# | ||
# Steps | ||
# ----- | ||
# | ||
# Example code (the output below is generated automatically): | ||
# | ||
import torch | ||
x = torch.rand(5, 3) | ||
print(x) | ||
|
||
###################################################################### | ||
# (Optional) Additional Exercises | ||
# ------------------------------- | ||
# | ||
# Add additional practice exercises for users to test their knowledge. | ||
# Example: `NLP from Scratch <https://pytorch.org/tutorials/intermediate/char_rnn_generation_tutorial.html#exercises>`__. | ||
# | ||
|
||
###################################################################### | ||
# Conclusion | ||
# ---------- | ||
# | ||
# Summarize the steps and concepts covered. Highlight key takeaways. | ||
# | ||
# Further Reading | ||
# --------------- | ||
# | ||
# * Link1 | ||
# * Link2 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
[Non-blocking comment]: Will we know which libraries they import just by inspecting their code? I think that is probably the most efficient way. If we ask them to list their imports in a second location--such as above--then we have the possibility that list will get out of sync with what they actually end up importing.
In other words, I think we are all good here as is . . . :-)