Skip to content

Commit b4f9fea

Browse files
authored
Merge branch 'master' into add-collapse-array
2 parents 5a291f3 + a6ae79a commit b4f9fea

File tree

96 files changed

+7781
-2706
lines changed

Some content is hidden

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

96 files changed

+7781
-2706
lines changed

.circleci/config.yml

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ pytorch_tutorial_build_manager_defaults: &pytorch_tutorial_build_manager_default
182182
resource_class: medium
183183
<<: *pytorch_tutorial_build_defaults
184184

185-
pytorch_windows_build: &pytorch_windows_build
185+
pytorch_windows_build_worker: &pytorch_windows_build_worker
186186
executor: windows-with-nvidia-gpu
187187
steps:
188188
- checkout
@@ -191,10 +191,25 @@ pytorch_windows_build: &pytorch_windows_build
191191
no_output_timeout: 30m
192192
command: |
193193
.circleci/scripts/windows_cuda_install.sh
194+
- run:
195+
name: Generate cache key
196+
# This will refresh cache on Sundays, build should generate new cache.
197+
command: echo "$(date +"%Y-%U")" > .circleci-weekly
198+
- restore_cache:
199+
keys:
200+
- data-{{ checksum "Makefile" }}-{{ checksum ".circleci-weekly" }}
194201
- run:
195202
name: test
203+
no_output_timeout: "1h"
196204
command: |
197205
.circleci/scripts/build_for_windows.sh
206+
- save_cache:
207+
key: data-{{ checksum "Makefile" }}-{{ checksum ".circleci-weekly" }}
208+
paths:
209+
- advanced_source/data
210+
- beginner_source/data
211+
- intermediate_source/data
212+
- prototype_source/data
198213

199214
jobs:
200215
pytorch_tutorial_pr_build_worker_0:
@@ -323,8 +338,29 @@ jobs:
323338
pytorch_tutorial_master_build_manager:
324339
<<: *pytorch_tutorial_build_manager_defaults
325340

326-
pytorch_windows_build_worker:
327-
<<: *pytorch_windows_build
341+
pytorch_tutorial_windows_pr_build_worker_0:
342+
<<: *pytorch_windows_build_worker
343+
344+
pytorch_tutorial_windows_pr_build_worker_1:
345+
<<: *pytorch_windows_build_worker
346+
347+
pytorch_tutorial_windows_pr_build_worker_2:
348+
<<: *pytorch_windows_build_worker
349+
350+
pytorch_tutorial_windows_pr_build_worker_3:
351+
<<: *pytorch_windows_build_worker
352+
353+
pytorch_tutorial_windows_master_build_worker_0:
354+
<<: *pytorch_windows_build_worker
355+
356+
pytorch_tutorial_windows_master_build_worker_1:
357+
<<: *pytorch_windows_build_worker
358+
359+
pytorch_tutorial_windows_master_build_worker_2:
360+
<<: *pytorch_windows_build_worker
361+
362+
pytorch_tutorial_windows_master_build_worker_3:
363+
<<: *pytorch_windows_build_worker
328364

329365
workflows:
330366
build:
@@ -562,11 +598,48 @@ workflows:
562598
branches:
563599
only:
564600
- master
565-
# - pytorch_windows_build_worker:
566-
# name: win_test_worker
567-
# type: approval
568-
# filters:
569-
# branches:
570-
# only:
571-
# - master
601+
- pytorch_tutorial_windows_pr_build_worker_0:
602+
filters:
603+
branches:
604+
ignore:
605+
- master
606+
- pytorch_tutorial_windows_pr_build_worker_1:
607+
filters:
608+
branches:
609+
ignore:
610+
- master
611+
- pytorch_tutorial_windows_pr_build_worker_2:
612+
filters:
613+
branches:
614+
ignore:
615+
- master
616+
- pytorch_tutorial_windows_pr_build_worker_3:
617+
filters:
618+
branches:
619+
ignore:
620+
- master
621+
- pytorch_tutorial_windows_master_build_worker_0:
622+
context: org-member
623+
filters:
624+
branches:
625+
only:
626+
- master
627+
- pytorch_tutorial_windows_master_build_worker_1:
628+
context: org-member
629+
filters:
630+
branches:
631+
only:
632+
- master
633+
- pytorch_tutorial_windows_master_build_worker_2:
634+
context: org-member
635+
filters:
636+
branches:
637+
only:
638+
- master
639+
- pytorch_tutorial_windows_master_build_worker_3:
640+
context: org-member
641+
filters:
642+
branches:
643+
only:
644+
- master
572645

.circleci/scripts/build_for_windows.sh

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mingw32/bin/mingw-get.exe install mingw32-make
1616
mingw32/bin/mingw-get.exe install msys-findutils
1717
mv mingw32/bin/mingw32-make.exe mingw32/bin/make.exe
1818
curl -k https://eternallybored.org/misc/wget/1.20.3/64/wget.exe -o mingw32/bin/wget.exe
19-
export PATH="${SOURCE_DIR}/mingw32/bin:$PATH"
19+
export PATH="${SOURCE_DIR}/mingw32/bin:${SOURCE_DIR}/mingw32/msys/1.0/bin:$PATH"
2020

2121
#install anaconda3
2222
export CONDA_HOME="${SOURCE_DIR}/conda"
@@ -31,19 +31,43 @@ 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 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
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
3738
conda install -yq -c pytorch "cudatoolkit=10.1" pytorch torchvision torchtext
3839
conda install torchaudio -c pytorch-test
3940
python -m spacy download de
4041
python -m spacy download en
4142
pushd ${PROJECT_DIR}
4243
DIR=.jenkins
43-
python $DIR/remove_runnable_code.py beginner_source/aws_distributed_training_tutorial.py beginner_source/aws_distributed_training_tutorial.py || true
44-
python $DIR/remove_runnable_code.py beginner_source/data_loading_tutorial.py beginner_source/data_loading_tutorial.py || true
45-
python $DIR/remove_runnable_code.py beginner_source/dcgan_faces_tutorial.py beginner_source/dcgan_faces_tutorial.py || true
46-
python $DIR/remove_runnable_code.py intermediate_source/model_parallel_tutorial.py intermediate_source/model_parallel_tutorial.py || true
47-
python $DIR/remove_runnable_code.py intermediate_source/memory_format_tutorial.py intermediate_source/memory_format_tutorial.py || true
44+
export NUM_WORKERS=4
4845

49-
make docs
46+
if [[ "${CIRCLE_JOB}" == *worker_* ]]; then
47+
python $DIR/remove_runnable_code.py intermediate_source/model_parallel_tutorial.py intermediate_source/model_parallel_tutorial.py || true
48+
python $DIR/remove_runnable_code.py advanced_source/static_quantization_tutorial.py advanced_source/static_quantization_tutorial.py || true
49+
python $DIR/remove_runnable_code.py beginner_source/hyperparameter_tuning_tutorial.py beginner_source/hyperparameter_tuning_tutorial.py || true
50+
51+
export WORKER_ID=$(echo "${CIRCLE_JOB}" | tr -dc '0-9')
52+
count=0
53+
FILES_TO_RUN=()
54+
for work_directory in beginner_source intermediate_source advanced_source recipes_source prototype_source; do
55+
for filename in $(find $work_directory -name '\*.py' -not -path '\*/data/\*'); do
56+
if [ $(($count % $NUM_WORKERS)) != $WORKER_ID ]; then
57+
echo "Removing runnable code from "$filename
58+
python $DIR/remove_runnable_code.py $filename $filename
59+
else
60+
echo "Keeping "$filename
61+
FILES_TO_RUN+=($(basename $filename .py))
62+
fi
63+
count=$((count+1))
64+
done
65+
done
66+
echo "FILES_TO_RUN: " ${FILES_TO_RUN[@]}
67+
fi
68+
69+
if [[ ! -d advanced_source/data || ! -d beginner_source/data || ! -d intermediate_source/data || ! -d prototype_source/data ]];then
70+
make download
71+
fi
72+
73+
make html

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.6-slim
2+
3+
COPY requirements.txt requirements.txt
4+
5+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get install git gcc unzip make -y \
7+
&& pip install --no-cache-dir -r requirements.txt

.devcontainer/devcontainer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "PyTorch",
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": [
18+
"ms-python.python",
19+
"lextudio.restructuredtext"
20+
]
21+
}

.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.0
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: 5 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
@@ -28,9 +32,7 @@ python -m spacy download de
2832
# PyTorch Theme
2933
rm -rf src
3034
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
35+
pip install sphinx-gallery==0.3.1 tqdm matplotlib ipython pillow==8.1.0
3436

3537
aws configure set default.s3.multipart_threshold 5120MB
3638

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

3131
> 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`.
32+
33+
34+
## About contributing to PyTorch Documentation and Tutorials
35+
* You can find information about contributing to PyTorch documentation in the
36+
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+

_static/img/8_workers.png

319 KB
Loading

0 commit comments

Comments
 (0)