From c45042cc058c54656b7e18f633db6e6b7310bf14 Mon Sep 17 00:00:00 2001 From: Jessica Lin Date: Tue, 16 Jun 2020 13:39:37 -0700 Subject: [PATCH 1/3] Update readme for index.rst --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 106e1ee3eb4..98b3556de7d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Here's how to create a new tutorial: 1. Create a notebook styled python file. If you want it executed while inserted into documentation, save the file with suffix `tutorial` so that file name is `your_tutorial.py`. 2. Put it in one of the beginner_source, intermediate_source, advanced_source based on the level. 2. Include it in the right TOC tree at index.rst -3. Create a thumbnail in the index file using a command like `.. galleryitem:: beginner/your_tutorial.py`. (This is a custom directive. See `custom_directives.py` for more info.) +3. Create a thumbnail in the index.rst file using a command like `.. customcarditem:: beginner/your_tutorial.html`. (This is a custom directive. See `custom_directives.py` for more info.) In case you prefer to write your tutorial in jupyter, you can use [this script](https://gist.github.com/chsasank/7218ca16f8d022e02a9c0deb94a310fe) to convert the notebook to python file. After conversion and addition to the project, please make sure the sections headings etc are in logical order. From d40dc05d879b0fd4917f4b4587e6511407a8d197 Mon Sep 17 00:00:00 2001 From: Jessica Lin Date: Wed, 17 Jun 2020 18:21:05 -0700 Subject: [PATCH 2/3] Update to include recipes instructions --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 98b3556de7d..ca418738738 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ All the tutorials are now presented as sphinx style documentation at: We use sphinx-gallery's [notebook styled examples](https://sphinx-gallery.github.io/stable/tutorials/index.html) to create the tutorials. Syntax is very simple. In essence, you write a slightly well formatted python file and it shows up as documentation page. -Here's how to create a new tutorial: +Here's how to create a new tutorial or recipe: 1. Create a notebook styled python file. If you want it executed while inserted into documentation, save the file with suffix `tutorial` so that file name is `your_tutorial.py`. -2. Put it in one of the beginner_source, intermediate_source, advanced_source based on the level. -2. Include it in the right TOC tree at index.rst -3. Create a thumbnail in the index.rst file using a command like `.. customcarditem:: beginner/your_tutorial.html`. (This is a custom directive. See `custom_directives.py` for more info.) +2. Put it in one of the beginner_source, intermediate_source, advanced_source based on the level. If it is a recipe, add to recipes_source. +2. For Tutorials, include it in the TOC tree at index.rst +3. For Tutorials, create a thumbnail in the [index.rst file](https://github.com/pytorch/tutorials/blob/master/index.rst) using a command like `.. customcarditem:: beginner/your_tutorial.html`. For Recipes, create a thumbnail in the [recipes_index.rst](https://github.com/pytorch/tutorials/blob/master/recipes_source/recipes_index.rst) In case you prefer to write your tutorial in jupyter, you can use [this script](https://gist.github.com/chsasank/7218ca16f8d022e02a9c0deb94a310fe) to convert the notebook to python file. After conversion and addition to the project, please make sure the sections headings etc are in logical order. From 4e97bcebf56dab687acd5e25d6f4790b0c82a6a9 Mon Sep 17 00:00:00 2001 From: James Reed Date: Fri, 19 Jun 2020 13:26:13 -0700 Subject: [PATCH 3/3] Add note about zipfile format in serialization tutorial --- beginner_source/saving_loading_models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/beginner_source/saving_loading_models.py b/beginner_source/saving_loading_models.py index 73d3554ceab..74a8edc892d 100644 --- a/beginner_source/saving_loading_models.py +++ b/beginner_source/saving_loading_models.py @@ -156,6 +156,12 @@ # model.load_state_dict(torch.load(PATH)) # model.eval() # +# .. note:: +# The 1.6 release of PyTorch switched ``torch.save`` to use a new +# zipfile-based file format. ``torch.load`` still retains the ability to +# load files in the old format. If for any reason you want ``torch.save`` +# to use the old format, pass the kwarg ``_use_new_zipfile_serialization=False``. +# # When saving a model for inference, it is only necessary to save the # trained model’s learned parameters. Saving the model’s *state_dict* with # the ``torch.save()`` function will give you the most flexibility for