Skip to content

Commit 253bdf7

Browse files
authored
Merge branch 'master' into docs/rpi
2 parents 5930bac + ebce103 commit 253bdf7

20 files changed

+1429
-15
lines changed

.jenkins/get_files_to_run.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Any
1+
from typing import Any, Dict, List, Optional, Tuple
22
import json
33
import os
44
from pathlib import Path
@@ -14,17 +14,21 @@ def get_all_files() -> List[str]:
1414
return [str(x) for x in sources]
1515

1616

17-
def calculate_shards(all_files: List[str], num_shards: int = 20):
17+
def read_metadata() -> Dict[str, Any]:
1818
with (REPO_BASE_DIR / ".jenkins" / "metadata.json").open() as fp:
19-
metadata = json.load(fp)
20-
sharded_files = [(0.0, []) for _ in range(num_shards)]
19+
return json.load(fp)
2120

22-
def get_duration(file):
21+
22+
def calculate_shards(all_files: List[str], num_shards: int = 20) -> List[List[str]]:
23+
sharded_files: List[Tuple[float, List[str]]] = [(0.0, []) for _ in range(num_shards)]
24+
metadata = read_metadata()
25+
26+
def get_duration(file: str) -> int:
2327
# tutorials not listed in the metadata.json file usually take
2428
# <3min to run, so we'll default to 1min if it's not listed
2529
return metadata.get(file, {}).get("duration", 60)
2630

27-
def get_needs_machine(file):
31+
def get_needs_machine(file: str) -> Optional[str]:
2832
return metadata.get(file, {}).get("needs", None)
2933

3034
def add_to_shard(i, filename):
@@ -55,9 +59,19 @@ def add_to_shard(i, filename):
5559
return [x[1] for x in sharded_files]
5660

5761

58-
def remove_other_files(all_files, files_to_run) -> None:
62+
def compute_files_to_keep(files_to_run: List[str]) -> List[str]:
63+
metadata = read_metadata()
64+
files_to_keep = list(files_to_run)
65+
for file in files_to_run:
66+
extra_files = metadata.get(file, {}).get("extra_files", [])
67+
files_to_keep.extend(extra_files)
68+
return files_to_keep
69+
70+
71+
def remove_other_files(all_files, files_to_keep) -> None:
72+
5973
for file in all_files:
60-
if file not in files_to_run:
74+
if file not in files_to_keep:
6175
remove_runnable_code(file, file)
6276

6377

@@ -76,7 +90,7 @@ def main() -> None:
7690
all_files = get_all_files()
7791
files_to_run = calculate_shards(all_files, num_shards=args.num_shards)[args.shard_num]
7892
if not args.dry_run:
79-
remove_other_files(all_files, files_to_run)
93+
remove_other_files(all_files, compute_files_to_keep(files_to_run))
8094
stripped_file_names = [Path(x).stem for x in files_to_run]
8195
print(" ".join(stripped_file_names))
8296

.jenkins/metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"intermediate_source/ax_multiobjective_nas_tutorial.py": {
3+
"extra_files": ["intermediate_source/mnist_train_nas.py"]
4+
},
25
"beginner_source/dcgan_faces_tutorial.py": {
36
"duration": 2000
47
},
185 KB
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

beginner_source/nn_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ def preprocess(x, y):
850850
#
851851
# We now have a general data pipeline and training loop which you can use for
852852
# training many types of models using Pytorch. To see how simple training a model
853-
# can now be, take a look at the `mnist_sample` sample notebook.
853+
# can now be, take a look at the `mnist_sample notebook <https://github.com/fastai/fastai_dev/blob/master/dev_nb/mnist_sample.ipynb>`__.
854854
#
855855
# Of course, there are many things you'll want to add, such as data augmentation,
856856
# hyperparameter tuning, monitoring training, transfer learning, and so forth.

conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import distutils.file_util
3939
import re
4040

41+
import plotly.io as pio
42+
pio.renderers.default = 'sphinx_gallery'
43+
4144

4245
try:
4346
import torchvision

index.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,28 @@ What's new in PyTorch tutorials?
492492
:image: _static/img/thumbnails/cropped/60-min-blitz.png
493493
:link: advanced/static_quantization_tutorial.html
494494
:tags: Quantization
495-
495+
496496
.. customcarditem::
497497
:header: Grokking PyTorch Intel CPU Performance from First Principles
498498
:card_description: A case study on the TorchServe inference framework optimized with Intel® Extension for PyTorch.
499499
:image: _static/img/thumbnails/cropped/generic-pytorch-logo.png
500500
:link: intermediate/torchserve_with_ipex
501501
:tags: Model-Optimization,Production
502502

503+
.. customcarditem::
504+
:header: Introduction to nvFuser
505+
:card_description: An introduction to nvFuser
506+
:image: _static/img/thumbnails/cropped/generic-pytorch-logo.png
507+
:link: intermediate/nvfuser_intro_tutorial.html
508+
:tags: Model-Optimization
509+
510+
.. customcarditem::
511+
:header: Multi-Objective Neural Architecture Search with Ax
512+
:card_description: Learn how to use Ax to search over architectures find optimal tradeoffs between accuracy and latency.
513+
:image: _static/img/ray-tune.png
514+
:link: intermediate/ax_multiobjective_nas_tutorial.html
515+
:tags: Model-Optimization,Best-Practice,Ax,TorchX
516+
503517
.. Parallel-and-Distributed-Training
504518
505519
.. customcarditem::
@@ -863,6 +877,8 @@ Additional Resources
863877
intermediate/quantized_transfer_learning_tutorial
864878
advanced/static_quantization_tutorial
865879
intermediate/torchserve_with_ipex
880+
intermediate/nvfuser_intro_tutorial
881+
intermediate/ax_multiobjective_nas_tutorial
866882

867883
.. toctree::
868884
:maxdepth: 2
@@ -894,7 +910,7 @@ Additional Resources
894910

895911
beginner/deeplabv3_on_ios
896912
beginner/deeplabv3_on_android
897-
913+
898914
.. toctree::
899915
:maxdepth: 2
900916
:includehidden:

intermediate_source/README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ Intermediate tutorials
3232
8. flask_rest_api_tutorial.py
3333
Deploying PyTorch and Building a REST API using Flask
3434
https://pytorch.org/tutorials/intermediate/flask_rest_api_tutorial.html
35+
36+
9. nvfuser_intro_tutorial.py
37+
Introduction to nvFuser
38+
https://pytorch.org/tutorials/intermediate/nvfuser_intro_tutorial.html

0 commit comments

Comments
 (0)