Skip to content

Commit e3ab4f2

Browse files
author
Svetlana Karslioglu
authored
Merge branch 'main' into seemethere/use_index_in_requirements
2 parents 56c3fcc + be94171 commit e3ab4f2

File tree

11 files changed

+51
-29
lines changed

11 files changed

+51
-29
lines changed

beginner_source/colab.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
1+
Running Tutorials in Google Colab
2+
=================================
3+
4+
When you run a tutorial in Google Colab, there might be additional
5+
requirements and dependencies that you need to meet in order
6+
for the tutorial to work properly. This section contains notes on how to
7+
configure various settings in order to successfully
8+
run PyTorch tutorials in Google Colab.
9+
10+
PyTorch Version in Google Colab
11+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12+
13+
When you are running a tutorial that requires a version of PyTorch that has
14+
just been released, that version might not be yet available in Google Colab.
15+
To check that you have the required ``torch`` and compatible domain libraries
16+
installed, run ``!pip list``.
17+
18+
If the installed version of PyTorch is lower than required,
19+
uninstall it and reinstall again by running the following commands:
20+
21+
.. code-block:: python
22+
23+
!pip3 uninstall --yes torch torchaudio torchvision torchtext torchdata
24+
!pip3 install torch torchaudio torchvision torchtext torchdata
25+
126
Using Tutorial Data from Google Drive in Colab
2-
==============================================
27+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328

429
We've added a new feature to tutorials that allows users to open the
530
notebook associated with a tutorial in Google Colab. You may need to

beginner_source/new-release-colab.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

beginner_source/t5_tutorial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
# 3. Read in the CNNDM, IMDB, and Multi30k datasets and pre-process their texts in preparation for the model
1919
# 4. Perform text summarization, sentiment classification, and translation
2020
#
21+
# .. note::
22+
# This tutorial requires PyTorch 2.0.0 or later.
2123
#
22-
2324
#######################################################################
2425
# Data Transformation
2526
# -------------------
@@ -34,8 +35,7 @@
3435
#
3536
# T5 uses a SentencePiece model for text tokenization. Below, we use a pre-trained SentencePiece model to build
3637
# the text pre-processing pipeline using torchtext's T5Transform. Note that the transform supports both
37-
# batched and non-batched text input (for example, one can either pass a single sentence or a list of sentences), however
38-
# the T5 model expects the input to be batched.
38+
# batched and non-batched text input (for example, one can either pass a single sentence or a list of sentences), however the T5 model expects the input to be batched.
3939
#
4040

4141
from torchtext.models import T5Transform

conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@
9191
'gallery_dirs': ['beginner', 'intermediate', 'advanced', 'recipes', 'prototype'],
9292
'filename_pattern': re.compile(SPHINX_SHOULD_RUN),
9393
'promote_jupyter_magic': True,
94-
'backreferences_dir': None
94+
'backreferences_dir': None,
95+
'first_notebook_cell': ("# For tips on running notebooks in Google Colab, see\n"
96+
"# https://pytorch.org/tutorials/beginner/colab\n"
97+
"%matplotlib inline")
9598
}
9699

97100
if os.getenv('GALLERY_PATTERN'):

intermediate_source/ensembling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
1818
Let's demonstrate how to do this using an ensemble of simple MLPs.
1919
20-
.. include:: ../beginner_source/new-release-colab.rst
20+
.. note::
2121
22+
This tutorial requires PyTorch 2.0.0 or later.
2223
"""
2324

2425
import torch

intermediate_source/jacobians_hessians.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
provides ways of computing various higher-order autodiff quantities
1313
efficiently.
1414
15-
.. include:: ../beginner_source/new-release-colab.rst
15+
.. note::
16+
17+
This tutorial requires PyTorch 2.0.0 or later.
1618
1719
Computing the Jacobian
1820
----------------------

intermediate_source/neural_tangent_kernels.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
demonstrates how to easily compute this quantity using ``torch.func``,
1212
composable function transforms for PyTorch.
1313
14-
.. include:: ../beginner_source/new-release-colab.rst
14+
.. note::
15+
16+
This tutorial requires PyTorch 2.0.0 or later.
1517
1618
Setup
1719
-----

intermediate_source/per_sample_grads.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
sample in a batch of data. It is a useful quantity in differential privacy,
1111
meta-learning, and optimization research.
1212
13-
.. include:: ../beginner_source/new-release-colab.rst
13+
.. note::
14+
15+
This tutorial requires PyTorch 2.0.0 or later.
1416
1517
"""
1618

intermediate_source/scaled_dot_product_attention_tutorial.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
# * `Memory-Efficient Attention <https://github.com/facebookresearch/xformers>`__
3636
# * A PyTorch implementation defined in C++
3737
#
38-
# .. literalinclude:: ../beginner_source/new-release-colab.rst
39-
# :language: rst
38+
# .. note::
39+
#
40+
# This tutorial requires PyTorch 2.0.0 or later.
41+
#
4042

4143
import torch
4244
import torch.nn as nn

intermediate_source/torch_compile_tutorial.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
#
3737
# Note: a modern NVIDIA GPU (Volta or Ampere) is recommended for this tutorial.
3838
#
39-
# .. include:: ../beginner_source/new-release-colab.rst
40-
#
4139

4240
######################################################################
4341
# Basic Usage

recipes_source/recipes/changing_default_device.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
Typically, to do this you might have used if-statements and ``cuda()`` calls
88
to do this:
99
10+
.. note::
11+
This recipe requires PyTorch 2.0.0 or later.
12+
1013
"""
1114
import torch
1215

0 commit comments

Comments
 (0)