Skip to content

Commit 8c3e2d1

Browse files
authored
Merge branch 'main' into deprecating-tutorials
2 parents eaa5806 + a408ba5 commit 8c3e2d1

15 files changed

+69
-713
lines changed

beginner_source/hyperparameter_tuning_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Fortunately, there are tools that help with finding the best combination of parameters.
1111
`Ray Tune <https://docs.ray.io/en/latest/tune.html>`_ is an industry standard tool for
1212
distributed hyperparameter tuning. Ray Tune includes the latest hyperparameter search
13-
algorithms, integrates with TensorBoard and other analysis libraries, and natively
13+
algorithms, integrates with various analysis libraries, and natively
1414
supports distributed training through `Ray's distributed machine learning engine
1515
<https://ray.io/>`_.
1616

beginner_source/ptcheat.rst

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,12 @@ Neural Network API
2222
import torch.nn as nn # neural networks
2323
import torch.nn.functional as F # layers, activations and more
2424
import torch.optim as optim # optimizers e.g. gradient descent, ADAM, etc.
25-
from torch.jit import script, trace # hybrid frontend decorator and tracing jit
2625
2726
See `autograd <https://pytorch.org/docs/stable/autograd.html>`__,
2827
`nn <https://pytorch.org/docs/stable/nn.html>`__,
2928
`functional <https://pytorch.org/docs/stable/nn.html#torch-nn-functional>`__
3029
and `optim <https://pytorch.org/docs/stable/optim.html>`__
3130

32-
TorchScript and JIT
33-
-------------------
34-
35-
.. code-block:: python
36-
37-
torch.jit.trace() # takes your module or function and an example
38-
# data input, and traces the computational steps
39-
# that the data encounters as it progresses through the model
40-
41-
@script # decorator used to indicate data-dependent
42-
# control flow within the code being traced
43-
44-
See `Torchscript <https://pytorch.org/docs/stable/jit.html>`__
45-
4631
ONNX
4732
----
4833

@@ -225,8 +210,10 @@ Optimizers
225210
226211
opt = optim.x(model.parameters(), ...) # create optimizer
227212
opt.step() # update weights
228-
optim.X # where X is SGD, Adadelta, Adagrad, Adam,
229-
# AdamW, SparseAdam, Adamax, ASGD,
213+
opt.zero_grad() # clear the gradients
214+
optim.X # where X is SGD, AdamW, Adam,
215+
# Adafactor, NAdam, RAdam, Adadelta,
216+
# Adagrad, SparseAdam, Adamax, ASGD,
230217
# LBFGS, RMSprop or Rprop
231218
232219
See `optimizers <https://pytorch.org/docs/stable/optim.html>`__

conf.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import pandocfilters
4646
import pypandoc
4747
import plotly.io as pio
48+
from pathlib import Path
4849
pio.renderers.default = 'sphinx_gallery'
4950

5051

@@ -140,22 +141,17 @@ def reset_seeds(gallery_conf, fname):
140141
sphinx_gallery_conf['ignore_pattern'] = r'/(?!' + re.escape(os.getenv('GALLERY_PATTERN')) + r')[^/]+$'
141142

142143
for i in range(len(sphinx_gallery_conf['examples_dirs'])):
143-
gallery_dir = sphinx_gallery_conf['gallery_dirs'][i]
144-
source_dir = sphinx_gallery_conf['examples_dirs'][i]
145-
# Create gallery dirs if it doesn't exist
146-
try:
147-
os.mkdir(gallery_dir)
148-
except OSError:
149-
pass
144+
gallery_dir = Path(sphinx_gallery_conf["gallery_dirs"][i])
145+
source_dir = Path(sphinx_gallery_conf["examples_dirs"][i])
150146

151147
# Copy rst files from source dir to gallery dir
152-
for f in glob.glob(os.path.join(source_dir, '*.rst')):
153-
distutils.file_util.copy_file(f, gallery_dir, update=True)
154-
148+
for f in source_dir.rglob("*.rst"):
149+
f_dir = Path(f).parent
150+
gallery_subdir_path = gallery_dir / f_dir.relative_to(source_dir)
151+
gallery_subdir_path.mkdir(parents=True, exist_ok=True)
152+
distutils.file_util.copy_file(f, gallery_subdir_path, update=True)
155153

156154
# Add any paths that contain templates here, relative to this directory.
157-
158-
159155
templates_path = ['_templates']
160156

161157
# The suffix(es) of source filenames.

en-wordlist.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
ACL
32
ADI
43
AOT
@@ -188,6 +187,7 @@ PIL's
188187
PPO
189188
PatchPredictor
190189
PennFudan
190+
Perfetto
191191
Pixman
192192
Plotly
193193
Pohjonen

intermediate_source/tensorboard_profiler_tutorial.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
55
to detect performance bottlenecks of the model.
66
7+
.. warning::
8+
The TensorBoard integration with the PyTorch profiler is now
9+
deprecated. Instead, use Perfetto or the Chrome trace to
10+
view ``trace.json`` files. After
11+
`generating a trace <https://pytorch.org/tutorials/recipes/recipes/profiler_recipe.html#using-tracing-functionality>`__,
12+
simply drag the ``trace.json`` into `Perfetto UI <https://ui.perfetto.dev/>`__
13+
or ``chrome://tracing`` to visualize your profile.
14+
715
Introduction
816
------------
917
PyTorch 1.8 includes an updated profiler API capable of

recipes_source/recipes/README.txt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,22 @@ PyTorch Recipes
2525
Dynamic Quantization
2626
https://pytorch.org/tutorials/recipes/recipes/dynamic_quantization.html
2727

28-
7. save_load_across_devices.py
29-
Saving and loading models across devices in PyTorch
30-
https://pytorch.org/tutorials/recipes/recipes/save_load_across_devices.html
31-
32-
8. saving_and_loading_a_general_checkpoint.py
33-
Saving and loading a general checkpoint in PyTorch
34-
https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_a_general_checkpoint.html
35-
36-
9. saving_and_loading_models_for_inference.py
37-
Saving and loading models for inference in PyTorch
38-
https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_models_for_inference.html
39-
40-
10. saving_multiple_models_in_one_file.py
41-
Saving and loading multiple models in one file using PyTorch
42-
https://pytorch.org/tutorials/recipes/recipes/saving_multiple_models_in_one_file.html
43-
44-
11. warmstarting_model_using_parameters_from_a_different_model.py
28+
7. warmstarting_model_using_parameters_from_a_different_model.py
4529
Warmstarting models using parameters from different model
4630
https://pytorch.org/tutorials/recipes/recipes/warmstarting_model_using_parameters_from_a_different_model.html
4731

48-
12. zeroing_out_gradients.py
32+
8. zeroing_out_gradients.py
4933
Zeroing out gradients
5034
https://pytorch.org/tutorials/recipes/recipes/zeroing_out_gradients.html
5135

52-
13. mobile_perf.py
36+
9. mobile_perf.py
5337
PyTorch Mobile Performance Recipes
5438
https://pytorch.org/tutorials/recipes/mobile_perf.html
5539

56-
14. amp_recipe.py
40+
10. amp_recipe.py
5741
Automatic Mixed Precision
5842
https://pytorch.org/tutorials/recipes/amp_recipe.html
5943

60-
15. regional_compilation.py
44+
11. regional_compilation.py
6145
Reducing torch.compile cold start compilation time with regional compilation
6246
https://pytorch.org/tutorials/recipes/regional_compilation.html

recipes_source/recipes/profiler_recipe.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ def trace_handler(p):
459459
#
460460
# Take a look at the following recipes/tutorials to continue your learning:
461461
#
462-
# - `PyTorch Benchmark <https://pytorch.org/tutorials/recipes/recipes/benchmark.html>`_
463-
# - `PyTorch Profiler with TensorBoard <https://pytorch.org/tutorials/intermediate/tensorboard_profiler_tutorial.html>`_ tutorial
464-
# - `Visualizing models, data, and training with TensorBoard <https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html>`_ tutorial
462+
# - `PyTorch Benchmark <https://pytorch.org/tutorials/recipes/recipes/benchmark.html>`_
463+
# - `Visualizing models, data, and training with TensorBoard <https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html>`_ tutorial
465464
#

recipes_source/recipes/save_load_across_devices.py

Lines changed: 0 additions & 181 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Save Load Across Devices
2+
========================
3+
4+
This tutorial was deprecated. There is a newer tutorial that covers the same topic: https://pytorch.org/tutorials/beginner/saving_loading_models.html
5+
6+
Redirecting in 3 seconds...
7+
8+
.. raw:: html
9+
10+
<meta http-equiv="Refresh" content="3; url='https://pytorch.org/tutorials/beginner/saving_loading_models.html'" />

0 commit comments

Comments
 (0)