66 export BUCKET_NAME=pytorch-tutorial-build-pull-request
77fi
88
9+ # set locale for click dependency in spacy
10+ export LC_ALL=C.UTF-8
11+ export LANG=C.UTF-8
12+
913DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null && pwd ) "
1014
1115sudo apt-get update
@@ -14,50 +18,42 @@ sudo apt-get install -y --no-install-recommends unzip p7zip-full sox libsox-dev
1418export PATH=/opt/conda/bin:$PATH
1519rm -rf src
1620pip install -r $DIR /../requirements.txt
17- pip uninstall -y torchvision || true
18-
19- # Install a nightly build of pytorch
2021
21- # GPU, requires CUDA version 8.0
22- pip install cython torch_nightly -f https://download.pytorch.org/whl/nightly/cu80/torch_nightly.html
22+ # export PATH=/opt/conda/bin:$PATH
23+ # pip install sphinx==1.8.2 pandas
2324
24- # GPU, requires CUDA version 9.0
25- # pip install cython torch_nightly -f https://download.pytorch.org/whl/nightly/cu90/torch_nightly.html
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
2630
27- # GPU, requires CUDA version 9.2
28- # pip install cython torch_nightly -f https://download.pytorch.org/whl/ nightly/cu92/torch_nightly.html
31+ # For Tensorboard. Until 1.14 moves to the release channel.
32+ pip install tb- nightly
2933
30- # CPU
31- # pip install cython torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
34+ # Install two language tokenizers for Translation with TorchText tutorial
35+ python -m spacy download en
36+ python -m spacy download de
3237
33- export PATH=/opt/conda/bin:$PATH
34- conda install -y sphinx==1.8.2 pandas
3538# PyTorch Theme
3639rm -rf src
3740pip install -e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
38- # pillow >= 4.2 will throw error when trying to write mode RGBA as JPEG,
39- # this is a workaround to the issue.
40- pip install sphinx-gallery tqdm matplotlib ipython pillow==4.1.1
41-
42- # Install torchvision from source
43- git clone https://github.com/pytorch/vision --quiet
44- pushd vision
45- pip install . --no-deps # We don't want it to install the stock PyTorch version from pip
46- popd
47-
48- # Install torchaudio from source
49- git clone https://github.com/pytorch/audio --quiet
50- pushd audio
51- python setup.py install
52- popd
41+ pip install sphinx-gallery==0.3.1 tqdm matplotlib ipython pillow==8.1.0
5342
5443aws configure set default.s3.multipart_threshold 5120MB
5544
5645# Decide whether to parallelize tutorial builds, based on $JOB_BASE_NAME
5746export NUM_WORKERS=20
5847if [[ " ${JOB_BASE_NAME} " == * worker_* ]]; then
5948 # Step 1: Remove runnable code from tutorials that are not supposed to be run
60- python $DIR /remove_runnable_code.py beginner_source/aws_distributed_training_tutorial.py beginner_source/aws_distributed_training_tutorial.py
49+ 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+
55+ # TODO: Fix bugs in these tutorials to make them runnable again
56+ # python $DIR/remove_runnable_code.py beginner_source/audio_classifier_tutorial.py beginner_source/audio_classifier_tutorial.py || true
6157
6258 # Step 2: Keep certain tutorials based on file count, and remove runnable code in all other tutorials
6359 # IMPORTANT NOTE: We assume that each tutorial has a UNIQUE filename.
@@ -93,6 +89,26 @@ if [[ "${JOB_BASE_NAME}" == *worker_* ]]; then
9389 FILES_TO_RUN+=($( basename $filename .py) )
9490 fi
9591 count=$(( count+ 1 ))
92+ done
93+ for filename in $( find recipes_source/ -name ' *.py' -not -path ' */data/*' ) ; do
94+ if [ $(( $count % $NUM_WORKERS )) != $WORKER_ID ]; then
95+ echo " Removing runnable code from " $filename
96+ python $DIR /remove_runnable_code.py $filename $filename
97+ else
98+ echo " Keeping " $filename
99+ FILES_TO_RUN+=($( basename $filename .py) )
100+ fi
101+ count=$(( count+ 1 ))
102+ done
103+ for filename in $( find prototype_source/ -name ' *.py' -not -path ' */data/*' ) ; do
104+ if [ $(( $count % $NUM_WORKERS )) != $WORKER_ID ]; then
105+ echo " Removing runnable code from " $filename
106+ python $DIR /remove_runnable_code.py $filename $filename
107+ else
108+ echo " Keeping " $filename
109+ FILES_TO_RUN+=($( basename $filename .py) )
110+ fi
111+ count=$(( count+ 1 ))
96112 done
97113 echo " FILES_TO_RUN: " ${FILES_TO_RUN[@]}
98114
@@ -101,13 +117,13 @@ if [[ "${JOB_BASE_NAME}" == *worker_* ]]; then
101117
102118 # Step 4: If any of the generated files are not related the tutorial files we want to run,
103119 # then we remove them
104- for filename in $( find docs/beginner docs/intermediate docs/advanced -name ' *.html' ) ; do
120+ for filename in $( find docs/beginner docs/intermediate docs/advanced docs/recipes docs/prototype -name ' *.html' ) ; do
105121 file_basename=$( basename $filename .html)
106122 if [[ ! " ${FILES_TO_RUN[@]} " =~ " ${file_basename} " ]]; then
107123 rm $filename
108124 fi
109125 done
110- for filename in $( find docs/beginner docs/intermediate docs/advanced -name ' *.rst' ) ; do
126+ for filename in $( find docs/beginner docs/intermediate docs/advanced docs/recipes docs/prototype -name ' *.rst' ) ; do
111127 file_basename=$( basename $filename .rst)
112128 if [[ ! " ${FILES_TO_RUN[@]} " =~ " ${file_basename} " ]]; then
113129 rm $filename
@@ -125,13 +141,13 @@ if [[ "${JOB_BASE_NAME}" == *worker_* ]]; then
125141 rm $filename
126142 fi
127143 done
128- for filename in $( find docs/_sources/beginner docs/_sources/intermediate docs/_sources/advanced -name ' *.rst.txt' ) ; do
144+ for filename in $( find docs/_sources/beginner docs/_sources/intermediate docs/_sources/advanced docs/_sources/recipes -name ' *.rst.txt' ) ; do
129145 file_basename=$( basename $filename .rst.txt)
130146 if [[ ! " ${FILES_TO_RUN[@]} " =~ " ${file_basename} " ]]; then
131147 rm $filename
132148 fi
133149 done
134- for filename in $( find docs/.doctrees/beginner docs/.doctrees/intermediate docs/.doctrees/advanced -name ' *.doctree' ) ; do
150+ for filename in $( find docs/.doctrees/beginner docs/.doctrees/intermediate docs/.doctrees/advanced docs/.doctrees/recipes docs/.doctrees/prototype -name ' *.doctree' ) ; do
135151 file_basename=$( basename $filename .doctree)
136152 if [[ ! " ${FILES_TO_RUN[@]} " =~ " ${file_basename} " ]]; then
137153 rm $filename
@@ -197,6 +213,3 @@ elif [[ "${JOB_BASE_NAME}" == *manager ]]; then
197213else
198214 make docs
199215fi
200-
201- rm -rf vision
202- rm -rf audio
0 commit comments