Skip to content

Commit 5130967

Browse files
authored
Merge branch 'main' into patch-1
2 parents 3fd5e84 + 43bd101 commit 5130967

File tree

149 files changed

+3684
-1231
lines changed

Some content is hidden

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

149 files changed

+3684
-1231
lines changed

.devcontainer/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ipython
2424
# to run examples
2525
pandas
2626
scikit-image
27-
pillow==10.0.1
27+
pillow==10.2.0
2828
wget
2929

3030
# for codespaces env

.jenkins/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ pip install --progress-bar off -r $DIR/../requirements.txt
2424

2525
#Install PyTorch Nightly for test.
2626
# Nightly - pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
27-
# Install 2.1 for testing
27+
# Install 2.2 for testing - uncomment to install nightly binaries (update the version as needed).
2828
# pip uninstall -y torch torchvision torchaudio torchtext torchdata
29-
# pip3 install torch torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu121
29+
# pip3 install torch==2.2.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu121
3030
# pip3 install torchdata torchtext --index-url https://download.pytorch.org/whl/test/cpu
3131

3232
# Install two language tokenizers for Translation with TorchText tutorial

.jenkins/validate_tutorials_built.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"intermediate_source/_torch_export_nightly_tutorial", # does not work on release
3030
"advanced_source/super_resolution_with_onnxruntime",
3131
"advanced_source/ddp_pipeline", # requires 4 gpus
32+
"advanced_source/usb_semisup_learn", # in the current form takes 140+ minutes to build - can be enabled when the build time is reduced
3233
"prototype_source/fx_graph_mode_ptq_dynamic",
3334
"prototype_source/vmap_recipe",
3435
"prototype_source/torchscript_freezing",

.pyspelling.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ matrix:
4545
- open: '\.\. (code-block|math)::.*$\n*'
4646
content: '(?P<first>(^(?P<indent>[ ]+).*$\n))(?P<other>(^([ \t]+.*|[ \t]*)$\n)*)'
4747
close: '(^(?![ \t]+.*$))'
48+
# Ignore references like "[1] Author: Title"
49+
- open: '\[\d\]'
50+
close: '\n'
4851
- pyspelling.filters.markdown:
4952
- pyspelling.filters.html:
5053
ignores:
@@ -97,7 +100,7 @@ matrix:
97100
content: '''''*'
98101
close: '$'
99102
# Ignore reStructuredText block directives
100-
- open: '\.\. (code-block|math)::.*$\n*'
103+
- open: '\.\. (code-block|math|table)::.*$\n*'
101104
content: '(?P<first>(^(?P<indent>[ ]+).*$\n))(?P<other>(^([ \t]+.*|[ \t]*)$\n)*)'
102105
close: '(^(?![ \t]+.*$))'
103106
- open: '\.\. (raw)::.*$\n*'

CONTRIBUTING.md

Lines changed: 17 additions & 19 deletions

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ download:
8686
wget -nv -N https://www.manythings.org/anki/deu-eng.zip -P $(DATADIR)
8787
unzip -o $(DATADIR)/deu-eng.zip -d beginner_source/data/
8888

89+
# Download PennFudanPed dataset for intermediate_source/torchvision_tutorial.py
90+
wget https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip -P $(DATADIR)
91+
unzip -o $(DATADIR)/PennFudanPed.zip -d intermediate_source/data/
8992

9093
docs:
9194
make download
@@ -103,3 +106,5 @@ html-noplot:
103106
clean-cache:
104107
make clean
105108
rm -rf advanced beginner intermediate recipes
109+
# remove additional python files downloaded for torchvision_tutorial.py
110+
rm -rf intermediate_source/engine.py intermediate_source/utils.py intermediate_source/transforms.py intermediate_source/coco_eval.py intermediate_source/coco_utils.py

README.md

Lines changed: 3 additions & 3 deletions

_static/css/custom2.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Survey banner .css */
2+
3+
.survey-banner {
4+
margin-top: 10px;
5+
background-color: #f3f4f7;
6+
padding-top: 15px;
7+
padding-left: 10px;
8+
padding-bottom: 1px;
9+
}
10+
11+
@media screen and (max-width: 600px) {
12+
.survey-banner {
13+
padding-top: 5px;
14+
padding-left: 5px;
15+
padding-bottom: -1px;
16+
font-size: 12px;
17+
margin-bottom: 5px;
18+
}
19+
}
37.6 KB

_static/img/hta/comm_across_ranks.png

46.2 KB

_static/img/hta/counts_diff.png

54.1 KB
90.8 KB
26.9 KB

_static/img/hta/duration_diff.png

80.1 KB

_static/img/hta/idle_time.png

42.4 KB

_static/img/hta/idle_time_summary.png

76.2 KB

_static/img/hta/kernel_metrics_df.png

84.3 KB
43.5 KB
35 KB
102 KB

_static/img/hta/overlap_df.png

36.3 KB

_static/img/hta/overlap_plot.png

44.9 KB

_static/img/hta/pie_charts.png

76.4 KB
48.1 KB

_static/img/hta/runtime_outliers.png

31.9 KB

_static/img/hta/short_gpu_kernels.png

38.3 KB
114 KB
46.9 KB
Binary file not shown.
-612 KB
Binary file not shown.
-12.4 KB
Binary file not shown.
-418 KB
Binary file not shown.
-849 KB
Binary file not shown.

_static/tiatoolbox_tutorial.ipynb

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

_templates/layout.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{% extends "!layout.html" %}
22

3-
43
{%- block content %}
54
{{ super() }}
65
<script>
@@ -17,7 +16,9 @@
1716
{{ super() }}
1817
<script>
1918

20-
19+
// Helper function to make it easier to call dataLayer.push()
20+
function gtag(){window.dataLayer.push(arguments);}
21+
2122
//add microsoft link
2223

2324
if(window.location.href.indexOf("/beginner/basics/")!= -1)

advanced_source/coding_ddpg.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,33 @@
5858
# Imports and setup
5959
# -----------------
6060
#
61-
62-
import torchrl
61+
# .. code-block:: bash
62+
#
63+
# %%bash
64+
# pip3 install torchrl mujoco glfw
6365

6466
# sphinx_gallery_start_ignore
6567
import warnings
66-
from typing import Tuple
67-
6868
warnings.filterwarnings("ignore")
69+
import multiprocessing
70+
# TorchRL prefers spawn method, that restricts creation of ``~torchrl.envs.ParallelEnv`` inside
71+
# `__main__` method call, but for the easy of reading the code switch to fork
72+
# which is also a default spawn method in Google's Colaboratory
73+
try:
74+
multiprocessing.set_start_method("fork")
75+
except RuntimeError:
76+
assert multiprocessing.get_start_method() == "fork"
6977
# sphinx_gallery_end_ignore
7078

71-
import torch.cuda
72-
import tqdm
7379

74-
import torch.multiprocessing
80+
import torchrl
81+
import torch
82+
import tqdm
83+
from typing import Tuple
7584

7685
###############################################################################
7786
# We will execute the policy on CUDA if available
78-
device = (
79-
torch.device("cpu") if torch.cuda.device_count() == 0 else torch.device("cuda:0")
80-
)
87+
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
8188
collector_device = torch.device("cpu") # Change the device to ``cuda`` to use CUDA
8289

8390
###############################################################################
@@ -1221,6 +1228,6 @@ def ceil_div(x, y):
12211228
#
12221229
# To iterate further on this loss module we might consider:
12231230
#
1224-
# - Using `@dispatch` (see `[Feature] Distpatch IQL loss module <https://github.com/pytorch/rl/pull/1230>`_.
1231+
# - Using `@dispatch` (see `[Feature] Distpatch IQL loss module <https://github.com/pytorch/rl/pull/1230>`_.)
12251232
# - Allowing flexible TensorDict keys.
12261233
#

advanced_source/ddp_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def evaluate(eval_model, data_source):
439439

440440
######################################################################
441441
# Evaluate the model with the test dataset
442-
# -------------------------------------
442+
# ----------------------------------------
443443
#
444444
# Apply the best model to check the result with the test dataset.
445445

advanced_source/dispatcher.rst

Lines changed: 1 addition & 1 deletion

advanced_source/neural_style_tutorial.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
import matplotlib.pyplot as plt
5757

5858
import torchvision.transforms as transforms
59-
import torchvision.models as models
59+
from torchvision.models import vgg19, VGG19_Weights
6060

6161
import copy
6262

@@ -87,7 +87,7 @@
8787
# to 255 tensor images.
8888
#
8989
#
90-
# .. Note::
90+
# .. note::
9191
# Here are links to download the images required to run the tutorial:
9292
# `picasso.jpg <https://pytorch.org/tutorials/_static/img/neural-style/picasso.jpg>`__ and
9393
# `dancing.jpg <https://pytorch.org/tutorials/_static/img/neural-style/dancing.jpg>`__.
@@ -183,7 +183,7 @@ def forward(self, input):
183183
return input
184184

185185
######################################################################
186-
# .. Note::
186+
# .. note::
187187
# **Important detail**: although this module is named ``ContentLoss``, it
188188
# is not a true PyTorch Loss function. If you want to define your content
189189
# loss as a PyTorch Loss function, you have to create a PyTorch autograd function
@@ -262,7 +262,7 @@ def forward(self, input):
262262
# network to evaluation mode using ``.eval()``.
263263
#
264264

265-
cnn = models.vgg19(pretrained=True).features.eval()
265+
cnn = vgg19(weights=VGG19_Weights.DEFAULT).features.eval()
266266

267267

268268

@@ -372,7 +372,7 @@ def get_style_model_and_losses(cnn, normalization_mean, normalization_std,
372372
input_img = content_img.clone()
373373
# if you want to use white noise by using the following code:
374374
#
375-
# ::
375+
# .. code-block:: python
376376
#
377377
# input_img = torch.randn(content_img.data.size())
378378

advanced_source/static_quantization_tutorial.rst

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)