From 1dc22dff39bc8f6c862783393b70ca1e1b8ed516 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 15 Mar 2023 19:01:02 -0700 Subject: [PATCH 1/2] Add a not on running in colab --- beginner_source/new-release-colab.rst | 15 +++++++++++++++ intermediate_source/ensembling.py | 3 +++ intermediate_source/jacobians_hessians.py | 2 ++ intermediate_source/neural_tangent_kernels.py | 2 ++ intermediate_source/per_sample_grads.py | 3 +++ intermediate_source/torch_compile_tutorial.py | 3 +++ 6 files changed, 28 insertions(+) create mode 100644 beginner_source/new-release-colab.rst diff --git a/beginner_source/new-release-colab.rst b/beginner_source/new-release-colab.rst new file mode 100644 index 00000000000..26c8c89e626 --- /dev/null +++ b/beginner_source/new-release-colab.rst @@ -0,0 +1,15 @@ +.. _new-release_colab: + +Notes for Running in Colab +========================== + +.. note:: + This tutorial requires PyTorch 2.0.0 or later. If you are running this + in Google Colab, verify that you have the required ``torch`` and + compatible domain libraties installed by running ``!pip list``. + If the installed version of PyTorch is lower than required, + unistall it and reinstall again by running the following commands: + + .. code-block:: + !pip3 uninstall --yes torch torchaudio torchvideo torchdata + !pip3 install torch torchaudio torchvideo torchdata diff --git a/intermediate_source/ensembling.py b/intermediate_source/ensembling.py index f44706d481e..0a9ba847f8d 100644 --- a/intermediate_source/ensembling.py +++ b/intermediate_source/ensembling.py @@ -16,6 +16,9 @@ for-loops and speeding them up through vectorization. Let's demonstrate how to do this using an ensemble of simple MLPs. + +.. include:: ../beginner_source/new-release-colab.rst + """ import torch diff --git a/intermediate_source/jacobians_hessians.py b/intermediate_source/jacobians_hessians.py index 071321d6bba..3ae6040ca00 100644 --- a/intermediate_source/jacobians_hessians.py +++ b/intermediate_source/jacobians_hessians.py @@ -12,6 +12,8 @@ provides ways of computing various higher-order autodiff quantities efficiently. +.. include:: ../beginner_source/new-release-colab.rst + Computing the Jacobian ---------------------- """ diff --git a/intermediate_source/neural_tangent_kernels.py b/intermediate_source/neural_tangent_kernels.py index 37d804b883b..a616934e8f8 100644 --- a/intermediate_source/neural_tangent_kernels.py +++ b/intermediate_source/neural_tangent_kernels.py @@ -11,6 +11,8 @@ demonstrates how to easily compute this quantity using ``torch.func``, composable function transforms for PyTorch. +.. include:: ../beginner_source/new-release-colab.rst + Setup ----- diff --git a/intermediate_source/per_sample_grads.py b/intermediate_source/per_sample_grads.py index 0dbdf8c94f1..35b76971e49 100644 --- a/intermediate_source/per_sample_grads.py +++ b/intermediate_source/per_sample_grads.py @@ -9,6 +9,9 @@ Per-sample-gradient computation is computing the gradient for each and every sample in a batch of data. It is a useful quantity in differential privacy, meta-learning, and optimization research. + +.. include:: ../beginner_source/new-release-colab.rst + """ import torch diff --git a/intermediate_source/torch_compile_tutorial.py b/intermediate_source/torch_compile_tutorial.py index 629b2ab6b41..6cf848c208d 100644 --- a/intermediate_source/torch_compile_tutorial.py +++ b/intermediate_source/torch_compile_tutorial.py @@ -35,6 +35,9 @@ # - ``tabulate`` # # Note: a modern NVIDIA GPU (Volta or Ampere) is recommended for this tutorial. +# +# .. include:: ../beginner_source/new-release-colab.rst +# ###################################################################### # Basic Usage From 8fa77bb6badac8a33628d5fd2190c126606afad8 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Wed, 15 Mar 2023 19:23:02 -0700 Subject: [PATCH 2/2] update --- beginner_source/new-release-colab.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beginner_source/new-release-colab.rst b/beginner_source/new-release-colab.rst index 26c8c89e626..9290c70af26 100644 --- a/beginner_source/new-release-colab.rst +++ b/beginner_source/new-release-colab.rst @@ -1,7 +1,7 @@ -.. _new-release_colab: +.. _new-release_colab:: Notes for Running in Colab -========================== +~~~~~~~~~~~~~~~~~~~~~~~~~~ .. note:: This tutorial requires PyTorch 2.0.0 or later. If you are running this @@ -10,6 +10,7 @@ Notes for Running in Colab If the installed version of PyTorch is lower than required, unistall it and reinstall again by running the following commands: - .. code-block:: + .. code-block:: python + !pip3 uninstall --yes torch torchaudio torchvideo torchdata !pip3 install torch torchaudio torchvideo torchdata