Skip to content

Commit 479ea7c

Browse files
authored
Merge branch 'master' into change_conv_size
2 parents 5850ed3 + 03341a2 commit 479ea7c

File tree

144 files changed

+12906
-3977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+12906
-3977
lines changed

.circleci/config.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pytorch_tutorial_build_defaults: &pytorch_tutorial_build_defaults
106106
sudo pip -q install awscli==1.16.35
107107
108108
if [ -n "${CUDA_VERSION}" ]; then
109-
DRIVER_FN="NVIDIA-Linux-x86_64-440.59.run"
109+
DRIVER_FN="NVIDIA-Linux-x86_64-460.39.run"
110110
wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
111111
sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
112112
nvidia-smi
@@ -116,13 +116,15 @@ pytorch_tutorial_build_defaults: &pytorch_tutorial_build_defaults
116116
export AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_ECR_READ_ONLY}
117117
export AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_ECR_READ_ONLY}
118118
eval $(aws ecr get-login --region us-east-1 --no-include-email)
119+
- restore_cache:
120+
key: v1.0-tutorial-{{ .Environment.CIRCLE_JOB }}
119121
- run:
120122
name: Build
121123
no_output_timeout: "20h"
122124
command: |
123125
set -e
124126
125-
export pyTorchDockerImageTag=291
127+
export pyTorchDockerImageTag=9de29bef4a5dc0dd1dd19428d83e5a66a44a1ed2
126128
echo "PyTorchDockerImageTag: "${pyTorchDockerImageTag}
127129
128130
cat >/home/circleci/project/ci_build_script.sh \<<EOL
@@ -164,21 +166,45 @@ pytorch_tutorial_build_defaults: &pytorch_tutorial_build_defaults
164166
fi
165167
set -x
166168
169+
# This also copies the cached build to docker.
167170
docker cp /home/circleci/project/. "$id:/var/lib/jenkins/workspace"
168171
169172
export COMMAND='((echo "source ./workspace/env" && echo "sudo chown -R jenkins workspace && cd workspace && ./ci_build_script.sh") | docker exec -u jenkins -i "$id" bash) 2>&1'
170173
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
171174
175+
# Copy the last build from docker
176+
docker cp "$id:/var/lib/jenkins/workspace/_build" /home/circleci/project
177+
docker cp "$id:/var/lib/jenkins/workspace/docs" /home/circleci/project
178+
docker cp "$id:/var/lib/jenkins/workspace/advanced" /home/circleci/project
179+
docker cp "$id:/var/lib/jenkins/workspace/beginner" /home/circleci/project
180+
docker cp "$id:/var/lib/jenkins/workspace/intermediate" /home/circleci/project
181+
docker cp "$id:/var/lib/jenkins/workspace/prototype" /home/circleci/project
182+
docker cp "$id:/var/lib/jenkins/workspace/recipes" /home/circleci/project
183+
docker cp "$id:/var/lib/jenkins/workspace/src" /home/circleci/project
184+
185+
- save_cache:
186+
# Save to cache for incremental build
187+
key: v1.0-tutorial-{{ .Environment.CIRCLE_JOB }}
188+
paths:
189+
- /home/circleci/project/_build
190+
- /home/circleci/project/docs
191+
- /home/circleci/project/advanced
192+
- /home/circleci/project/beginner
193+
- /home/circleci/project/intermediate
194+
- /home/circleci/project/prototype
195+
- /home/circleci/project/recipes
196+
- /home/circleci/project/src
197+
172198
pytorch_tutorial_build_worker_defaults: &pytorch_tutorial_build_worker_defaults
173199
environment:
174-
DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9-cudnn7-py3"
200+
DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7"
175201
CUDA_VERSION: "9"
176202
resource_class: gpu.medium
177203
<<: *pytorch_tutorial_build_defaults
178204

179205
pytorch_tutorial_build_manager_defaults: &pytorch_tutorial_build_manager_defaults
180206
environment:
181-
DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9-cudnn7-py3"
207+
DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7"
182208
resource_class: medium
183209
<<: *pytorch_tutorial_build_defaults
184210

.circleci/scripts/build_for_windows.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ eval "$(conda shell.bash hook)"
3131
conda create -qyn testenv python=3.7
3232
conda activate testenv
3333

34-
conda install sphinx
35-
pip install sphinx_gallery==0.3.1 sphinx-copybutton flask pandas spacy ipython scipy pySoundFile scikit-image
36-
pip install -e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
37-
pip install ray[tune] tabulate
38-
conda install -yq -c pytorch "cudatoolkit=10.1" pytorch torchvision torchtext
39-
conda install torchaudio -c pytorch-test
34+
REQUIREMENTS="$(grep -v '^ *#\|^torch\|^torchaudio\|^torchvision|^torchtext' $PROJECT_DIR/requirements.txt | grep .)"
35+
echo $REQUIREMENTS > requirements.txt
36+
pip install -r requirements.txt
37+
pip install pySoundFile
38+
# Force uninstall torch & related packages, we'll install them using conda later.
39+
pip uninstall -y torch torchvision torchtext
40+
conda install -yq -c pytorch "cudatoolkit=10.1" pytorch torchvision torchtext torchaudio
4041
python -m spacy download de
4142
python -m spacy download en
4243
pushd ${PROJECT_DIR}
@@ -47,6 +48,11 @@ if [[ "${CIRCLE_JOB}" == *worker_* ]]; then
4748
python $DIR/remove_runnable_code.py intermediate_source/model_parallel_tutorial.py intermediate_source/model_parallel_tutorial.py || true
4849
python $DIR/remove_runnable_code.py advanced_source/static_quantization_tutorial.py advanced_source/static_quantization_tutorial.py || true
4950
python $DIR/remove_runnable_code.py beginner_source/hyperparameter_tuning_tutorial.py beginner_source/hyperparameter_tuning_tutorial.py || true
51+
python $DIR/remove_runnable_code.py beginner_source/audio_preprocessing_tutorial.py beginner_source/audio_preprocessing_tutorial.py || true
52+
python $DIR/remove_runnable_code.py beginner_source/dcgan_faces_tutorial.py beginner_source/dcgan_faces_tutorial.py || true
53+
python $DIR/remove_runnable_code.py intermediate_source/tensorboard_profiler_tutorial.py intermediate_source/tensorboard_profiler_tutorial.py || true
54+
# Temp remove for mnist download issue. (Re-enabled for 1.8.1)
55+
# python $DIR/remove_runnable_code.py beginner_source/fgsm_tutorial.py beginner_source/fgsm_tutorial.py || true
5056

5157
export WORKER_ID=$(echo "${CIRCLE_JOB}" | tr -dc '0-9')
5258
count=0

.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM mcr.microsoft.com/vscode/devcontainers/python:3.8
2+
3+
COPY requirements.txt /tmp/pip-tmp/
4+
5+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get install git gcc unzip make -y \
7+
&& pip3 install --disable-pip-version-check --no-cache-dir -r /tmp/pip-tmp/requirements.txt \
8+
&& rm -rf /tmp/pip-tmp

.devcontainer/devcontainer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "PyTorch Tutorials",
3+
"build": {
4+
"context": "..",
5+
"dockerfile": "Dockerfile",
6+
"args": {}
7+
},
8+
"settings": {
9+
"terminal.integrated.shell.linux": "/bin/bash",
10+
"workbench.startupEditor": "none",
11+
"files.autoSave": "afterDelay",
12+
"python.dataScience.enabled": true,
13+
"python.dataScience.alwaysTrustNotebooks": true,
14+
"python.insidersChannel": "weekly",
15+
"python.showStartPage": false
16+
},
17+
"extensions": ["ms-python.python", "lextudio.restructuredtext"]
18+
}

.devcontainer/requirements.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Refer to ./jenkins/build.sh for tutorial build instructions
2+
3+
sphinx==1.8.2
4+
sphinx-gallery==0.3.1
5+
tqdm
6+
numpy
7+
matplotlib
8+
torch
9+
torchvision
10+
torchtext
11+
torchaudio
12+
PyHamcrest
13+
bs4
14+
awscli==1.16.35
15+
flask
16+
spacy
17+
ray[tune]
18+
19+
# PyTorch Theme
20+
-e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
21+
22+
ipython
23+
24+
# to run examples
25+
pandas
26+
scikit-image
27+
pillow==8.1.1
28+
wget
29+
30+
# for codespaces env
31+
pylint

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,4 @@ cleanup.sh
120120
*.swp
121121

122122
# PyTorch things
123-
*.pt
123+
*.pt

.jenkins/build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ else
66
export BUCKET_NAME=pytorch-tutorial-build-pull-request
77
fi
88

9+
# set locale for click dependency in spacy
10+
export LC_ALL=C.UTF-8
11+
export LANG=C.UTF-8
12+
913
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
1014

1115
sudo apt-get update
@@ -18,6 +22,12 @@ pip install -r $DIR/../requirements.txt
1822
# export PATH=/opt/conda/bin:$PATH
1923
# pip install sphinx==1.8.2 pandas
2024

25+
#Install PyTorch Nightly for test.
26+
# Nightly - pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
27+
# RC Link
28+
# pip uninstall -y torch torchvision torchaudio torchtext
29+
# pip install -f https://download.pytorch.org/whl/test/cu102/torch_test.html torch torchvision torchaudio torchtext
30+
2131
# For Tensorboard. Until 1.14 moves to the release channel.
2232
pip install tb-nightly
2333

@@ -28,9 +38,7 @@ python -m spacy download de
2838
# PyTorch Theme
2939
rm -rf src
3040
pip install -e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
31-
# pillow >= 4.2 will throw error when trying to write mode RGBA as JPEG,
32-
# this is a workaround to the issue.
33-
pip install sphinx-gallery==0.3.1 tqdm matplotlib ipython pillow==4.1.1
41+
pip install sphinx-gallery==0.3.1 tqdm matplotlib ipython pillow==8.1.0
3442

3543
aws configure set default.s3.multipart_threshold 5120MB
3644

@@ -39,6 +47,11 @@ export NUM_WORKERS=20
3947
if [[ "${JOB_BASE_NAME}" == *worker_* ]]; then
4048
# Step 1: Remove runnable code from tutorials that are not supposed to be run
4149
python $DIR/remove_runnable_code.py beginner_source/aws_distributed_training_tutorial.py beginner_source/aws_distributed_training_tutorial.py || true
50+
# python $DIR/remove_runnable_code.py advanced_source/ddp_pipeline_tutorial.py advanced_source/ddp_pipeline_tutorial.py || true
51+
# Temp remove for mnist download issue. (Re-enabled for 1.8.1)
52+
# python $DIR/remove_runnable_code.py beginner_source/fgsm_tutorial.py beginner_source/fgsm_tutorial.py || true
53+
# python $DIR/remove_runnable_code.py intermediate_source/spatial_transformer_tutorial.py intermediate_source/spatial_transformer_tutorial.py || true
54+
4255
# TODO: Fix bugs in these tutorials to make them runnable again
4356
# python $DIR/remove_runnable_code.py beginner_source/audio_classifier_tutorial.py beginner_source/audio_classifier_tutorial.py || true
4457

Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,11 @@ download:
9797
wget -N https://download.pytorch.org/models/mobilenet_v2-b0353104.pth -P $(DATADIR)
9898
cp $(DATADIR)/mobilenet_v2-b0353104.pth advanced_source/data/mobilenet_pretrained_float.pth
9999

100-
# Download dataset for advanced_source/static_quantization_tutorial.py
101-
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/imagenet_1k.zip -P $(DATADIR)
102-
unzip $(ZIPOPTS) $(DATADIR)/imagenet_1k.zip -d advanced_source/data/
103100

104101
# Download model for prototype_source/graph_mode_static_quantization_tutorial.py
105102
wget -N https://download.pytorch.org/models/resnet18-5c106cde.pth -P $(DATADIR)
106103
cp $(DATADIR)/resnet18-5c106cde.pth prototype_source/data/resnet18_pretrained_float.pth
107104

108-
# Download dataset for prototype_source/graph_mode_static_quantization_tutorial.py
109-
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/imagenet_1k.zip -P $(DATADIR)
110-
unzip $(ZIPOPTS) $(DATADIR)/imagenet_1k.zip -d prototype_source/data/
111105

112106
docs:
113107
make download

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ In case you prefer to write your tutorial in jupyter, you can use [this script](
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.
3030

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`.
31+
> If you get **ModuleNotFoundError: No module named 'pytorch_sphinx_theme' make: *** [html-noplot] Error 2** from /tutorials/src/pytorch-sphinx-theme or /venv/src/pytorch-sphinx-theme (while using virtualenv), run `python setup.py install`.
3232
3333

3434
## About contributing to PyTorch Documentation and Tutorials
3535
* You can find information about contributing to PyTorch documentation in the
3636
PyTorch Repo [README.md](https://github.com/pytorch/pytorch/blob/master/README.md) file.
37-
* Additional information can be found in [PyTorch CONTRIBUTING.md](https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md).
38-
37+
* Additional information can be found in [PyTorch CONTRIBUTING.md](https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md).

_static/img/8_workers.png

319 KB
Loading

_static/img/basics/comp-graph.png

14 KB
Loading

_static/img/basics/fashion_mnist.png

32.6 KB
Loading
59.2 KB
Loading

_static/img/basics/typesdata.png

14.4 KB
Loading

_static/img/dag_autograd.png

17.3 KB
Loading

_static/img/mario.gif

4.89 MB
Loading

_static/img/mario_env.png

38.7 KB
Loading

_static/img/oneworker.png

120 KB
Loading

_static/img/profiler_overview1.png

133 KB
Loading

_static/img/profiler_overview2.png

77.3 KB
Loading

_static/img/profiler_trace_view1.png

128 KB
Loading

_static/img/profiler_trace_view2.png

133 KB
Loading

_static/img/profiler_views_list.png

67.8 KB
Loading

_static/img/tensorboard_pr_curves.png

-190 KB
Loading
Loading
Loading
Loading
Loading

_static/mnist.pkl.gz

15.4 MB
Binary file not shown.

_static/torchvision_finetuning_instance_segmentation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@
14481448
" self.masks = list(sorted(os.listdir(os.path.join(root, \"PedMasks\"))))\n",
14491449
"\n",
14501450
" def __getitem__(self, idx):\n",
1451-
" # load images ad masks\n",
1451+
" # load images and masks\n",
14521452
" img_path = os.path.join(self.root, \"PNGImages\", self.imgs[idx])\n",
14531453
" mask_path = os.path.join(self.root, \"PedMasks\", self.masks[idx])\n",
14541454
" img = Image.open(img_path).convert(\"RGB\")\n",

_static/tv-training-code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, root, transforms):
2525
self.masks = list(sorted(os.listdir(os.path.join(root, "PedMasks"))))
2626

2727
def __getitem__(self, idx):
28-
# load images ad masks
28+
# load images and masks
2929
img_path = os.path.join(self.root, "PNGImages", self.imgs[idx])
3030
mask_path = os.path.join(self.root, "PedMasks", self.masks[idx])
3131
img = Image.open(img_path).convert("RGB")

_templates/layout.html

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
tutorialLink: window.location.href,
3535
downloadTitle: $(this).attr("data-response")
3636
});
37-
38-
gtag('event', 'click', {
39-
'event_category': 'Download',
40-
'event_label': $(this).attr("data-response")
37+
ga('send', {
38+
hitType: 'event',
39+
eventCategory: $(this).attr("data-response"),
40+
eventAction: 'click',
41+
eventLabel: window.location.href
4142
});
4243

4344
gtag('event', 'click', {
@@ -47,29 +48,22 @@
4748
});
4849
});
4950

50-
$("[data-behavior='was-this-helpful-event']").on('click', function(){
51-
$(".helpful-question").hide();
52-
$(".was-helpful-thank-you").show();
53-
54-
fbq('trackCustom', "Was this Helpful?", {
51+
$("[data-behavior='tutorial-rating']").on('click', function(){
52+
fbq('trackCustom', "Tutorial Rating", {
5553
tutorialLink: window.location.href,
5654
tutorialTitle: $('h1:first').text(),
57-
helpful: $(this).attr("data-response")
58-
});
59-
60-
gtag('event', $(this).attr("data-response"), {
61-
'event_category': 'Was this Helpful?',
62-
'event_label': $(this).attr("data-response")
55+
rating: $(this).attr("data-count")
6356
});
6457

65-
gtag('event', $(this).attr("data-response"), {
66-
'event_category': 'Was this Helpful?',
67-
'event_label': $("h1").first().text()
58+
gtag('event', 'click', {
59+
'event_category': 'Tutorial Rating',
60+
'event_label': $("h1").first().text(),
61+
'value': $(this).attr("data-count")
6862
});
6963
});
7064

7165
if (location.pathname == "/") {
72-
$(".helpful-container").hide();
66+
$(".rating-container").hide();
7367
$(".hr-bottom").hide();
7468
}
7569
</script>
@@ -79,5 +73,10 @@
7973
src="https://www.facebook.com/tr?id=243028289693773&ev=PageView
8074
&noscript=1"/>
8175
</noscript>
76+
77+
<script type="text/javascript">
78+
var collapsedSections = ['PyTorch Recipes', 'Learning PyTorch', 'Image and Video', 'Audio', 'Text', 'Reinforcement Learning', 'Deploying PyTorch Models in Production', 'Code Transforms with FX', 'Frontend APIs', 'Extending PyTorch', 'Model Optimization', 'Parallel and Distributed Training', 'Mobile'];
79+
</script>
80+
8281
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/795629140/?label=txkmCPmdtosBENSssfsC&amp;guid=ON&amp;script=0"/>
8382
{% endblock %}

advanced_source/cpp_export.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ If you need to exclude some methods in your ``nn.Module``
115115
because they use Python features that TorchScript doesn't support yet,
116116
you could annotate those with ``@torch.jit.ignore``
117117

118-
``my_module`` is an instance of
118+
``sm`` is an instance of
119119
``ScriptModule`` that is ready for serialization.
120120

121121
Step 2: Serializing Your Script Module to a File
@@ -132,7 +132,7 @@ on the module and pass it a filename::
132132
traced_script_module.save("traced_resnet_model.pt")
133133

134134
This will produce a ``traced_resnet_model.pt`` file in your working directory.
135-
If you also would like to serialize ``my_module``, call ``my_module.save("my_module_model.pt")``
135+
If you also would like to serialize ``sm``, call ``sm.save("my_module_model.pt")``
136136
We have now officially left the realm of Python and are ready to cross over to the sphere
137137
of C++.
138138

0 commit comments

Comments
 (0)