Skip to content

Commit 9b7d120

Browse files
authored
Merge branch 'master' into patch-1
2 parents 2c5de77 + 8ac4017 commit 9b7d120

38 files changed

+3484
-447
lines changed

.circleci/config.yml

Lines changed: 299 additions & 45 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ pytorch_basics
66

77
#data things
88
_data/
9-
beginner_source/hymenoptera_data
10-
beginner_source/blitz/data
11-
beginner_source/faces
12-
beginner_source/hybrid_frontend/data
13-
intermediate_source/data/
149
advanced_source/images/
15-
*data.zip
16-
faces.zip
10+
advanced_source/data/
11+
beginner_source/.data/
12+
beginner_source/data/
13+
beginner_source/blitz/data/
14+
beginner_source/faces/
15+
beginner_source/hybrid_frontend/data/
16+
beginner_source/hymenoptera_data/
17+
intermediate_source/data/
18+
*.zip
19+
MNIST/
1720

1821
#builds
1922
_build/
@@ -94,7 +97,7 @@ target/
9497
.python-version
9598

9699
# celery beat schedule file
97-
celerybeat-schedule
100+
celerybeat-schedule
98101
# dotenv
99102
.env
100103

.jenkins/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [[ "${JOB_BASE_NAME}" == *worker_* ]]; then
4040
# Step 1: Remove runnable code from tutorials that are not supposed to be run
4141
python $DIR/remove_runnable_code.py beginner_source/aws_distributed_training_tutorial.py beginner_source/aws_distributed_training_tutorial.py || true
4242
# TODO: Fix bugs in these tutorials to make them runnable again
43-
python $DIR/remove_runnable_code.py beginner_source/audio_classifier_tutorial.py beginner_source/audio_classifier_tutorial.py || true
43+
# python $DIR/remove_runnable_code.py beginner_source/audio_classifier_tutorial.py beginner_source/audio_classifier_tutorial.py || true
4444

4545
# Step 2: Keep certain tutorials based on file count, and remove runnable code in all other tutorials
4646
# IMPORTANT NOTE: We assume that each tutorial has a UNIQUE filename.

Makefile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
export LC_ALL=C
66

77
# You can set these variables from the command line.
8-
SPHINXOPTS =
8+
SPHINXOPTS ?=
99
SPHINXBUILD = sphinx-build
1010
SPHINXPROJ = PyTorchTutorials
1111
SOURCEDIR = .
1212
BUILDDIR = _build
1313
DATADIR = _data
1414
GH_PAGES_SOURCES = $(SOURCEDIR) Makefile
1515

16+
ZIPOPTS ?= -qo
17+
TAROPTS ?=
18+
1619
# Put it first so that "make" without argument is like "make help".
1720
help:
1821
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -43,15 +46,15 @@ download:
4346

4447
# transfer learning tutorial data
4548
wget -N https://download.pytorch.org/tutorial/hymenoptera_data.zip -P $(DATADIR)
46-
unzip -o $(DATADIR)/hymenoptera_data.zip -d beginner_source/data/
49+
unzip $(ZIPOPTS) $(DATADIR)/hymenoptera_data.zip -d beginner_source/data/
4750

4851
# nlp tutorial data
4952
wget -N https://download.pytorch.org/tutorial/data.zip -P $(DATADIR)
50-
unzip -o $(DATADIR)/data.zip -d intermediate_source/ # This will unzip all files in data.zip to intermediate_source/data/ folder
53+
unzip $(ZIPOPTS) $(DATADIR)/data.zip -d intermediate_source/ # This will unzip all files in data.zip to intermediate_source/data/ folder
5154

5255
# data loader tutorial
5356
wget -N https://download.pytorch.org/tutorial/faces.zip -P $(DATADIR)
54-
unzip -o $(DATADIR)/faces.zip -d beginner_source/data/
57+
unzip $(ZIPOPTS) $(DATADIR)/faces.zip -d beginner_source/data/
5558

5659
wget -N https://download.pytorch.org/models/tutorials/4000_checkpoint.tar -P $(DATADIR)
5760
cp $(DATADIR)/4000_checkpoint.tar beginner_source/data/
@@ -63,19 +66,19 @@ download:
6366

6467
# Download dataset for beginner_source/dcgan_faces_tutorial.py
6568
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/img_align_celeba.zip -P $(DATADIR)
66-
unzip -q -o $(DATADIR)/img_align_celeba.zip -d beginner_source/data/celeba
69+
unzip $(ZIPOPTS) $(DATADIR)/img_align_celeba.zip -d beginner_source/data/celeba
6770

6871
# Download dataset for beginner_source/hybrid_frontend/introduction_to_hybrid_frontend_tutorial.py
6972
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/iris.data -P $(DATADIR)
7073
cp $(DATADIR)/iris.data beginner_source/data/
7174

7275
# Download dataset for beginner_source/chatbot_tutorial.py
7376
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/cornell_movie_dialogs_corpus.zip -P $(DATADIR)
74-
unzip -q -o $(DATADIR)/cornell_movie_dialogs_corpus.zip -d beginner_source/data/
77+
unzip $(ZIPOPTS) $(DATADIR)/cornell_movie_dialogs_corpus.zip -d beginner_source/data/
7578

7679
# Download dataset for beginner_source/audio_classifier_tutorial.py
7780
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/UrbanSound8K.tar.gz -P $(DATADIR)
78-
tar -xzf $(DATADIR)/UrbanSound8K.tar.gz -C ./beginner_source/data/
81+
tar $(TAROPTS) -xzf $(DATADIR)/UrbanSound8K.tar.gz -C ./beginner_source/data/
7982

8083
# Download model for beginner_source/fgsm_tutorial.py
8184
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/lenet_mnist_model.pth -P $(DATADIR)
@@ -87,16 +90,15 @@ download:
8790

8891
# Download data for advanced_source/dynamic_quantization_tutorial.py
8992
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/wikitext-2.zip -P $(DATADIR)
90-
unzip -q -o $(DATADIR)/wikitext-2.zip -d advanced_source/data/
93+
unzip $(ZIPOPTS) $(DATADIR)/wikitext-2.zip -d advanced_source/data/
9194

9295
# Download model for advanced_source/static_quantization_tutorial.py
93-
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/mobilenet_quantization.pth -P $(DATADIR)
94-
cp $(DATADIR)/mobilenet_quantization.pth advanced_source/data/mobilenet_quantization.pth
96+
wget -N https://download.pytorch.org/models/mobilenet_v2-b0353104.pth -P $(DATADIR)
97+
cp $(DATADIR)/mobilenet_v2-b0353104.pth advanced_source/data/mobilenet_pretrained_float.pth
9598

9699
# Download dataset for advanced_source/static_quantization_tutorial.py
97100
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/imagenet_1k.zip -P $(DATADIR)
98-
unzip -q -o $(DATADIR)/imagenet_1k.zip -d advanced_source/data/
99-
101+
unzip $(ZIPOPTS) $(DATADIR)/imagenet_1k.zip -d advanced_source/data/
100102

101103
docs:
102104
make download

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ All the tutorials are now presented as sphinx style documentation at:
99

1010
# Contributing
1111

12-
We use sphinx-gallery's [notebook styled examples](https://sphinx-gallery.github.io/tutorials/plot_notebook.html#sphx-glr-tutorials-plot-notebook-py) 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.
12+
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.
1313

1414
Here's how to create a new tutorial:
1515
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`.
@@ -27,3 +27,5 @@ In case you prefer to write your tutorial in jupyter, you can use [this script](
2727
2828
- Then you can build using `make docs`. This will download the data, execute the tutorials and build the documentation to `docs/` directory. This will take about 60-120 min for systems with GPUs. If you do not have a GPU installed on your system, then see next step.
2929
- You can skip the computationally intensive graph generation by running `make html-noplot` to build basic html documentation to `_build/html`. This way, you can quickly preview your tutorial.
30+
31+
> If you get **ModuleNotFoundError: No module named 'pytorch_sphinx_theme' make: *** [html-noplot] Error 2**, from /tutorials/src/pytorch_sphinx_theme run `python setup.py install`.

_static/img/bert.png

242 KB
Loading

_static/img/bert_mrpc.png

175 KB
Loading

_static/img/per_channel_quant.png

219 KB
Loading

_static/img/per_tensor_quant.png

225 KB
Loading

_static/img/pruning.png

121 KB
Loading

_static/img/quant_embeddings.png

251 KB
Loading
1.93 MB
Loading

_templates/layout.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
eventAction: 'click',
6868
eventLabel: $(this).attr("data-response")
6969
});
70+
gtag('event', $(this).attr("data-response"), {
71+
'event_category': 'Was this Helpful?',
72+
'event_label': $("h1").first().text()
73+
});
7074
});
7175

7276
if (location.pathname == "/") {

advanced_source/cpp_export.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
Loading a TorchScript Model in C++
22
=====================================
33

4-
**This tutorial was updated to work with PyTorch 1.2**
5-
64
As its name suggests, the primary interface to PyTorch is the Python
75
programming language. While Python is a suitable and preferred language for
86
many scenarios requiring dynamism and ease of iteration, there are equally many
@@ -205,7 +203,7 @@ minimal ``CMakeLists.txt`` to build it could look as simple as:
205203
206204
add_executable(example-app example-app.cpp)
207205
target_link_libraries(example-app "${TORCH_LIBRARIES}")
208-
set_property(TARGET example-app PROPERTY CXX_STANDARD 11)
206+
set_property(TARGET example-app PROPERTY CXX_STANDARD 14)
209207
210208
The last thing we need to build the example application is the LibTorch
211209
distribution. You can always grab the latest stable release from the `download
@@ -228,6 +226,8 @@ structure:
228226
.. tip::
229227
On Windows, debug and release builds are not ABI-compatible. If you plan to
230228
build your project in debug mode, please try the debug version of LibTorch.
229+
Also, make sure you specify the correct configuration in the ``cmake --build .``
230+
line below.
231231

232232
The last step is building the application. For this, assume our example
233233
directory is laid out like this:
@@ -246,7 +246,7 @@ We can now run the following commands to build the application from within the
246246
mkdir build
247247
cd build
248248
cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch ..
249-
make
249+
cmake --build . --config Release
250250
251251
where ``/path/to/libtorch`` should be the full path to the unzipped LibTorch
252252
distribution. If all goes well, it will look something like this:

advanced_source/cpp_extension.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,8 @@ We'll start with the C++ file, which we'll call ``lltm_cuda.cpp``, for example:
667667
668668
// C++ interface
669669
670-
#define CHECK_CUDA(x) AT_ASSERTM(x.type().is_cuda(), #x " must be a CUDA tensor")
671-
#define CHECK_CONTIGUOUS(x) AT_ASSERTM(x.is_contiguous(), #x " must be contiguous")
670+
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
671+
#define CHECK_CONTIGUOUS(x) TORCH_CHECK(x.is_contiguous(), #x " must be contiguous")
672672
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)
673673
674674
std::vector<torch::Tensor> lltm_forward(

0 commit comments

Comments
 (0)