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

Redirect duplicate save/load recipes to the main save/load tutorial #3136

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import pandocfilters
import pypandoc
import plotly.io as pio
from pathlib import Path
pio.renderers.default = 'sphinx_gallery'


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

for i in range(len(sphinx_gallery_conf['examples_dirs'])):
gallery_dir = sphinx_gallery_conf['gallery_dirs'][i]
source_dir = sphinx_gallery_conf['examples_dirs'][i]
# Create gallery dirs if it doesn't exist
try:
os.mkdir(gallery_dir)
except OSError:
pass
gallery_dir = Path(sphinx_gallery_conf["gallery_dirs"][i])
source_dir = Path(sphinx_gallery_conf["examples_dirs"][i])

# Copy rst files from source dir to gallery dir
for f in glob.glob(os.path.join(source_dir, '*.rst')):
distutils.file_util.copy_file(f, gallery_dir, update=True)

for f in source_dir.rglob("*.rst"):
f_dir = Path(f).parent
gallery_subdir_path = gallery_dir / f_dir.relative_to(source_dir)
gallery_subdir_path.mkdir(parents=True, exist_ok=True)
distutils.file_util.copy_file(f, gallery_subdir_path, update=True)

# Add any paths that contain templates here, relative to this directory.


templates_path = ['_templates']

# The suffix(es) of source filenames.
Expand Down
26 changes: 5 additions & 21 deletions recipes_source/recipes/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,22 @@ PyTorch Recipes
Dynamic Quantization
https://pytorch.org/tutorials/recipes/recipes/dynamic_quantization.html

7. save_load_across_devices.py
Saving and loading models across devices in PyTorch
https://pytorch.org/tutorials/recipes/recipes/save_load_across_devices.html

8. saving_and_loading_a_general_checkpoint.py
Saving and loading a general checkpoint in PyTorch
https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_a_general_checkpoint.html

9. saving_and_loading_models_for_inference.py
Saving and loading models for inference in PyTorch
https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_models_for_inference.html

10. saving_multiple_models_in_one_file.py
Saving and loading multiple models in one file using PyTorch
https://pytorch.org/tutorials/recipes/recipes/saving_multiple_models_in_one_file.html

11. warmstarting_model_using_parameters_from_a_different_model.py
7. warmstarting_model_using_parameters_from_a_different_model.py
Warmstarting models using parameters from different model
https://pytorch.org/tutorials/recipes/recipes/warmstarting_model_using_parameters_from_a_different_model.html

12. zeroing_out_gradients.py
8. zeroing_out_gradients.py
Zeroing out gradients
https://pytorch.org/tutorials/recipes/recipes/zeroing_out_gradients.html

13. mobile_perf.py
9. mobile_perf.py
PyTorch Mobile Performance Recipes
https://pytorch.org/tutorials/recipes/mobile_perf.html

14. amp_recipe.py
10. amp_recipe.py
Automatic Mixed Precision
https://pytorch.org/tutorials/recipes/amp_recipe.html

15. regional_compilation.py
11. regional_compilation.py
Reducing torch.compile cold start compilation time with regional compilation
https://pytorch.org/tutorials/recipes/regional_compilation.html
181 changes: 0 additions & 181 deletions recipes_source/recipes/save_load_across_devices.py

This file was deleted.

10 changes: 10 additions & 0 deletions recipes_source/recipes/save_load_across_devices.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Save Load Across Devices
========================

This tutorial was deprecated. There is a newer tutorial that covers the same topic: https://pytorch.org/tutorials/beginner/saving_loading_models.html

Redirecting in 3 seconds...

.. raw:: html

<meta http-equiv="Refresh" content="3; url='https://pytorch.org/tutorials/beginner/saving_loading_models.html'" />
Loading
Loading