Skip to content

Commit 7e4c684

Browse files
authored
Merge branch 'master' into cache_sphinx
2 parents 08590b4 + 73b6cd9 commit 7e4c684

40 files changed

+3028
-73
lines changed

.circleci/config.yml

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pytorch_tutorial_build_manager_defaults: &pytorch_tutorial_build_manager_default
208208
resource_class: medium
209209
<<: *pytorch_tutorial_build_defaults
210210

211-
pytorch_windows_build: &pytorch_windows_build
211+
pytorch_windows_build_worker: &pytorch_windows_build_worker
212212
executor: windows-with-nvidia-gpu
213213
steps:
214214
- checkout
@@ -217,10 +217,25 @@ pytorch_windows_build: &pytorch_windows_build
217217
no_output_timeout: 30m
218218
command: |
219219
.circleci/scripts/windows_cuda_install.sh
220+
- run:
221+
name: Generate cache key
222+
# This will refresh cache on Sundays, build should generate new cache.
223+
command: echo "$(date +"%Y-%U")" > .circleci-weekly
224+
- restore_cache:
225+
keys:
226+
- data-{{ checksum "Makefile" }}-{{ checksum ".circleci-weekly" }}
220227
- run:
221228
name: test
229+
no_output_timeout: "1h"
222230
command: |
223231
.circleci/scripts/build_for_windows.sh
232+
- save_cache:
233+
key: data-{{ checksum "Makefile" }}-{{ checksum ".circleci-weekly" }}
234+
paths:
235+
- advanced_source/data
236+
- beginner_source/data
237+
- intermediate_source/data
238+
- prototype_source/data
224239

225240
jobs:
226241
pytorch_tutorial_pr_build_worker_0:
@@ -349,8 +364,29 @@ jobs:
349364
pytorch_tutorial_master_build_manager:
350365
<<: *pytorch_tutorial_build_manager_defaults
351366

352-
pytorch_windows_build_worker:
353-
<<: *pytorch_windows_build
367+
pytorch_tutorial_windows_pr_build_worker_0:
368+
<<: *pytorch_windows_build_worker
369+
370+
pytorch_tutorial_windows_pr_build_worker_1:
371+
<<: *pytorch_windows_build_worker
372+
373+
pytorch_tutorial_windows_pr_build_worker_2:
374+
<<: *pytorch_windows_build_worker
375+
376+
pytorch_tutorial_windows_pr_build_worker_3:
377+
<<: *pytorch_windows_build_worker
378+
379+
pytorch_tutorial_windows_master_build_worker_0:
380+
<<: *pytorch_windows_build_worker
381+
382+
pytorch_tutorial_windows_master_build_worker_1:
383+
<<: *pytorch_windows_build_worker
384+
385+
pytorch_tutorial_windows_master_build_worker_2:
386+
<<: *pytorch_windows_build_worker
387+
388+
pytorch_tutorial_windows_master_build_worker_3:
389+
<<: *pytorch_windows_build_worker
354390

355391
workflows:
356392
build:
@@ -588,11 +624,48 @@ workflows:
588624
branches:
589625
only:
590626
- master
591-
# - pytorch_windows_build_worker:
592-
# name: win_test_worker
593-
# type: approval
594-
# filters:
595-
# branches:
596-
# only:
597-
# - master
627+
- pytorch_tutorial_windows_pr_build_worker_0:
628+
filters:
629+
branches:
630+
ignore:
631+
- master
632+
- pytorch_tutorial_windows_pr_build_worker_1:
633+
filters:
634+
branches:
635+
ignore:
636+
- master
637+
- pytorch_tutorial_windows_pr_build_worker_2:
638+
filters:
639+
branches:
640+
ignore:
641+
- master
642+
- pytorch_tutorial_windows_pr_build_worker_3:
643+
filters:
644+
branches:
645+
ignore:
646+
- master
647+
- pytorch_tutorial_windows_master_build_worker_0:
648+
context: org-member
649+
filters:
650+
branches:
651+
only:
652+
- master
653+
- pytorch_tutorial_windows_master_build_worker_1:
654+
context: org-member
655+
filters:
656+
branches:
657+
only:
658+
- master
659+
- pytorch_tutorial_windows_master_build_worker_2:
660+
context: org-member
661+
filters:
662+
branches:
663+
only:
664+
- master
665+
- pytorch_tutorial_windows_master_build_worker_3:
666+
context: org-member
667+
filters:
668+
branches:
669+
only:
670+
- master
598671

.circleci/scripts/build_for_windows.sh

Lines changed: 32 additions & 8 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"
@@ -32,18 +32,42 @@ conda create -qyn testenv python=3.7
3232
conda activate testenv
3333

3434
conda install sphinx
35-
pip install sphinx_gallery==0.3.1 flask pandas spacy ipython scipy pySoundFile scikit-image
35+
pip install sphinx_gallery==0.3.1 sphinx-copybutton flask pandas spacy ipython scipy pySoundFile scikit-image
3636
pip install -e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
37+
pip install ray[tune] tabulate
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

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/deeplabv3_android.png

371 KB
Loading

_static/img/deeplabv3_android2.png

54.7 KB
Loading

_static/img/deeplabv3_ios.png

381 KB
Loading

_static/img/deeplabv3_ios2.png

42.6 KB
Loading
31.3 KB
Loading

_templates/layout.html

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22

33
{% block footer %}
44
{{ super() }}
5-
<script>
6-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
7-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
8-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
9-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
10-
11-
ga('create', 'UA-90545585-2', 'auto');
12-
ga('send', 'pageview');
13-
14-
</script>
15-
165
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-117752657-2"></script>
176

187
<script>
@@ -45,28 +34,34 @@
4534
tutorialLink: window.location.href,
4635
downloadTitle: $(this).attr("data-response")
4736
});
48-
ga('send', {
49-
hitType: 'event',
50-
eventCategory: 'Download',
51-
eventAction: 'click',
52-
eventLabel: $(this).attr("data-response")
37+
38+
gtag('event', 'click', {
39+
'event_category': 'Download',
40+
'event_label': $(this).attr("data-response")
41+
});
42+
43+
gtag('event', 'click', {
44+
'event_category': $(this).attr("data-response"),
45+
'event_label': $("h1").first().text(),
46+
'tutorial_link': window.location.href
5347
});
5448
});
5549

5650
$("[data-behavior='was-this-helpful-event']").on('click', function(){
5751
$(".helpful-question").hide();
5852
$(".was-helpful-thank-you").show();
53+
5954
fbq('trackCustom', "Was this Helpful?", {
6055
tutorialLink: window.location.href,
6156
tutorialTitle: $('h1:first').text(),
6257
helpful: $(this).attr("data-response")
6358
});
64-
ga('send', {
65-
hitType: 'event',
66-
eventCategory: 'Was this Helpful?',
67-
eventAction: 'click',
68-
eventLabel: $(this).attr("data-response")
59+
60+
gtag('event', $(this).attr("data-response"), {
61+
'event_category': 'Was this Helpful?',
62+
'event_label': $(this).attr("data-response")
6963
});
64+
7065
gtag('event', $(this).attr("data-response"), {
7166
'event_category': 'Was this Helpful?',
7267
'event_label': $("h1").first().text()

advanced_source/dynamic_quantization_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def batchify(data, bsz):
213213
def get_batch(source, i):
214214
seq_len = min(bptt, len(source) - 1 - i)
215215
data = source[i:i+seq_len]
216-
target = source[i+1:i+1+seq_len].view(-1)
216+
target = source[i+1:i+1+seq_len].reshape(-1)
217217
return data, target
218218

219219
def repackage_hidden(h):

0 commit comments

Comments
 (0)