Skip to content

Commit 264543e

Browse files
authored
Merge branch 'main' into master
2 parents c9a1c81 + dfeb1ae commit 264543e

File tree

68 files changed

+2892
-1382
lines changed

Some content is hidden

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

68 files changed

+2892
-1382
lines changed

.ci/docker/requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tqdm==4.66.1
1414
numpy==1.24.4
1515
matplotlib
1616
librosa
17-
torch==2.5
17+
torch==2.6
1818
torchvision
1919
torchdata
2020
networkx
@@ -28,8 +28,8 @@ tensorboard
2828
jinja2==3.1.3
2929
pytorch-lightning
3030
torchx
31-
torchrl==0.5.0
32-
tensordict==0.5.0
31+
torchrl==0.6.0
32+
tensordict==0.6.0
3333
ax-platform>=0.4.0
3434
nbformat>=5.9.2
3535
datasets
@@ -70,4 +70,4 @@ semilearn==0.3.2
7070
torchao==0.5.0
7171
segment_anything==1.0
7272
torchrec==1.0.0; platform_system == "Linux"
73-
fbgemm-gpu==1.0.0; platform_system == "Linux"
73+
fbgemm-gpu==1.1.0; platform_system == "Linux"

.github/workflows/spelling.yml

+137-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,149 @@ on:
55
push:
66
branches:
77
- main
8+
89
jobs:
910
pyspelling:
1011
runs-on: ubuntu-20.04
1112
steps:
12-
- uses: actions/checkout@v3
13+
- name: Check for skip label and get changed files
14+
id: check-files
15+
uses: actions/github-script@v6
16+
with:
17+
script: |
18+
let skipCheck = false;
19+
let changedFiles = [];
20+
21+
if (context.eventName === 'pull_request') {
22+
// Check for skip label
23+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: context.issue.number
27+
});
28+
skipCheck = labels.some(label => label.name === 'skip-spell-check');
29+
30+
if (!skipCheck) {
31+
// Get changed files in PR
32+
const { data: files } = await github.rest.pulls.listFiles({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
pull_number: context.issue.number
36+
});
37+
38+
changedFiles = files
39+
.filter(file => file.filename.match(/\.(py|rst|md)$/))
40+
.map(file => file.filename);
41+
}
42+
} else {
43+
// For push events, we'll still need to use git diff
44+
// We'll handle this after checkout
45+
}
46+
47+
core.setOutput('skip', skipCheck.toString());
48+
core.setOutput('files', changedFiles.join('\n'));
49+
core.setOutput('is-pr', (context.eventName === 'pull_request').toString());
50+
51+
- uses: actions/checkout@v4
52+
if: steps.check-files.outputs.skip != 'true'
53+
with:
54+
fetch-depth: 0
55+
56+
- name: Get changed files for push event
57+
if: |
58+
steps.check-files.outputs.skip != 'true' &&
59+
steps.check-files.outputs.is-pr != 'true'
60+
id: push-files
61+
run: |
62+
CHANGED_FILES=$(git diff --name-only HEAD^..HEAD -- '*.py' '*.rst' '*.md')
63+
echo "files<<EOF" >> $GITHUB_OUTPUT
64+
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
65+
echo "EOF" >> $GITHUB_OUTPUT
66+
67+
- name: Check if relevant files changed
68+
if: steps.check-files.outputs.skip != 'true'
69+
id: check
70+
run: |
71+
if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then
72+
FILES="${{ steps.check-files.outputs.files }}"
73+
else
74+
FILES="${{ steps.push-files.outputs.files }}"
75+
fi
76+
77+
if [ -z "$FILES" ]; then
78+
echo "skip=true" >> $GITHUB_OUTPUT
79+
echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check"
80+
else
81+
echo "skip=false" >> $GITHUB_OUTPUT
82+
echo "Found changed files to check:"
83+
echo "$FILES"
84+
fi
85+
1386
- uses: actions/setup-python@v4
87+
if: |
88+
steps.check-files.outputs.skip != 'true' &&
89+
steps.check.outputs.skip != 'true'
1490
with:
1591
python-version: '3.9'
1692
cache: 'pip'
17-
- run: pip install pyspelling
18-
- run: sudo apt-get install aspell aspell-en
19-
- run: pyspelling
2093

94+
- name: Install dependencies
95+
if: |
96+
steps.check-files.outputs.skip != 'true' &&
97+
steps.check.outputs.skip != 'true'
98+
run: |
99+
pip install pyspelling
100+
sudo apt-get install aspell aspell-en
101+
102+
- name: Run spell check on each file
103+
id: spellcheck
104+
if: |
105+
steps.check-files.outputs.skip != 'true' &&
106+
steps.check.outputs.skip != 'true'
107+
run: |
108+
if [ "${{ steps.check-files.outputs.is-pr }}" == "true" ]; then
109+
mapfile -t FILES <<< "${{ steps.check-files.outputs.files }}"
110+
else
111+
mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}"
112+
fi
113+
114+
# Check each file individually
115+
FINAL_EXIT_CODE=0
116+
SPELLCHECK_LOG=""
117+
for file in "${FILES[@]}"; do
118+
if [ -n "$file" ]; then
119+
echo "Checking spelling in $file"
120+
python3 -c "import yaml; config = yaml.safe_load(open('.pyspelling.yml')); new_matrix = [matrix.copy() for matrix in config['matrix'] if (('python' in matrix['name'].lower() and '$file'.endswith('.py')) or ('rest' in matrix['name'].lower() and '$file'.endswith('.rst')) or ('markdown' in matrix['name'].lower() and '$file'.endswith('.md'))) and not matrix.update({'sources': ['$file']})]; config['matrix'] = new_matrix; yaml.dump(config, open('temp_config.yml', 'w'))"
121+
122+
if OUTPUT=$(pyspelling -c temp_config.yml 2>&1); then
123+
echo "No spelling errors found in $file"
124+
else
125+
FINAL_EXIT_CODE=1
126+
echo "Spelling errors found in $file:"
127+
echo "$OUTPUT"
128+
SPELLCHECK_LOG+="### $file\n$OUTPUT\n\n"
129+
fi
130+
fi
131+
done
132+
133+
# Save the results to GITHUB_OUTPUT
134+
echo "spell_failed=$FINAL_EXIT_CODE" >> $GITHUB_OUTPUT
135+
echo "spell_log<<SPELLEOF" >> $GITHUB_OUTPUT
136+
echo "$SPELLCHECK_LOG" >> $GITHUB_OUTPUT
137+
echo "SPELLEOF" >> $GITHUB_OUTPUT
138+
139+
if [ $FINAL_EXIT_CODE -ne 0 ]; then
140+
echo "Spell check failed! See above for details."
141+
echo
142+
echo "Here are a few tips:"
143+
echo "- All PyTorch API objects must be in double backticks or use an intersphinx directive."
144+
echo " Example: ``torch.nn``, :func:"
145+
echo "- Consult en-wordlist.txt for spellings of some of the words."
146+
echo " You can add a word to en-wordlist.txt if:"
147+
echo " 1) It's a common abbreviation, like RNN."
148+
echo " 2) It's a word widely accepted in the industry."
149+
echo "- Please do not add words like 'dtype', 'torch.nn.Transformer' to pass spellcheck."
150+
echo " Instead wrap it in double backticks or use an intersphinx directive."
151+
echo
152+
exit 1
153+
fi

.jenkins/build.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ sudo apt-get install -y pandoc
2222
#Install PyTorch Nightly for test.
2323
# Nightly - pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
2424
# Install 2.5 to merge all 2.4 PRs - uncomment to install nightly binaries (update the version as needed).
25-
# pip uninstall -y torch torchvision torchaudio torchtext torchdata
26-
# pip3 install torch==2.5.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
25+
# sudo pip uninstall -y torch torchvision torchaudio torchtext torchdata
26+
# sudo pip3 install torch==2.6.0 torchvision --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
27+
# sudo pip uninstall -y fbgemm-gpu torchrec
28+
# sudo pip3 install fbgemm-gpu==1.1.0 torchrec==1.0.0 --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
2729

2830
# Install two language tokenizers for Translation with TorchText tutorial
2931
python -m spacy download en_core_web_sm

.jenkins/validate_tutorials_built.py

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"intermediate_source/mnist_train_nas", # used by ax_multiobjective_nas_tutorial.py
2626
"intermediate_source/fx_conv_bn_fuser",
2727
"intermediate_source/_torch_export_nightly_tutorial", # does not work on release
28-
"intermediate_source/transformer_building_blocks", # does not work on release
2928
"advanced_source/super_resolution_with_onnxruntime",
3029
"advanced_source/usb_semisup_learn", # fails with CUDA OOM error, should try on a different worker
3130
"prototype_source/fx_graph_mode_ptq_dynamic",
@@ -51,7 +50,6 @@
5150
"intermediate_source/flask_rest_api_tutorial",
5251
"intermediate_source/text_to_speech_with_torchaudio",
5352
"intermediate_source/tensorboard_profiler_tutorial", # reenable after 2.0 release.
54-
"intermediate_source/torch_export_tutorial" # reenable after 2940 is fixed.
5553
]
5654

5755
def tutorial_source_dirs() -> List[Path]:

.lycheeignore

+6
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ https://pytorch.org/tutorials/beginner/colab/n
1212

1313
# Ignore local host link from intermediate_source/tensorboard_tutorial.rst
1414
http://localhost:6006
15+
16+
# Ignore local host link from recipes_source/deployment_with_flask.rst
17+
http://localhost:5000/predict
18+
19+
# Ignore local host link from advanced_source/cpp_frontend.rst
20+
https://www.uber.com/blog/deep-neuroevolution/

.pyspelling.yml

+47-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ spellchecker: aspell
22
matrix:
33
- name: python
44
sources:
5-
- beginner_source/*.py
6-
- intermediate_source/*.py
7-
- advanced_source/*.py
8-
- recipes_source/*/*.py
5+
- "**/*.py"
96
dictionary:
107
wordlists:
118
- en-wordlist.txt
@@ -56,7 +53,7 @@ matrix:
5653
- pyspelling.filters.url:
5754
- name: reST
5855
sources:
59-
- beginner_source/*.rst
56+
- "**/*.rst"
6057
dictionary:
6158
wordlists:
6259
- en-wordlist.txt
@@ -119,3 +116,48 @@ matrix:
119116
- open: '\.\.\s+(image|include|only)::'
120117
close: '$'
121118
- pyspelling.filters.url:
119+
- name: markdown
120+
sources:
121+
- '**/*.md'
122+
dictionary:
123+
wordlists:
124+
- en-wordlist.txt
125+
pipeline:
126+
- pyspelling.filters.markdown:
127+
markdown_extensions:
128+
- markdown.extensions.extra:
129+
- markdown.extensions.admonition:
130+
- markdown.extensions.codehilite:
131+
- markdown.extensions.meta:
132+
- markdown.extensions.tables:
133+
- markdown.extensions.toc:
134+
- pyspelling.filters.html:
135+
comments: false
136+
ignores:
137+
- code
138+
- pre
139+
- tt
140+
- img
141+
- a
142+
- table
143+
- thead
144+
- tbody
145+
- th
146+
- tr
147+
- td
148+
- pyspelling.filters.context:
149+
context_visible_first: true
150+
delimiters:
151+
# Ignore code blocks
152+
- open: '```[a-z]*\n'
153+
close: '```\n'
154+
# Ignore inline code
155+
- open: '`'
156+
close: '`'
157+
# Ignore links
158+
- open: '\[([^]]*)\]'
159+
close: '\([^)]*\)'
160+
# Ignore HTML comments
161+
- open: '<!--'
162+
close: '-->'
163+
- pyspelling.filters.url:

CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,8 @@ described in the preceding sections:
218218
- [NLP From Scratch: Generating Names with a Character-Level RNN
219219
Tutorial](https://pytorch.org/tutorials/intermediate/char_rnn_generation_tutorial.html)
220220

221-
If you are creating a recipe, we recommend that you use [this
222-
template](https://github.com/pytorch/tutorials/blob/tutorials_refresh/recipes_source/recipes/example_recipe.py)
223-
as a guide.
221+
If you are creating a recipe, [this is a good
222+
example.](https://github.com/pytorch/tutorials/blob/main/recipes_source/recipes/what_is_state_dict.py)
224223

225224

226225
# Submission Process #

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ All the tutorials are now presented as sphinx style documentation at:
77

88
# Asking a question
99

10-
If you have a question about a tutorial, post in https://dev-discuss.pytorch.org/ rather than creating an issue in this repo. Your question will be answered much faster on the dev-discuss forum.
10+
If you hve a qestion about a tutorial, post in https://dev-discuss.pytorch.org/ rather than creating an issue in this repo. Your question will be answered much faster on the dev-discuss forum.
1111

1212
# Submitting an issue
1313

@@ -20,7 +20,7 @@ You can submit the following types of issues:
2020

2121
We use sphinx-gallery's [notebook styled examples](https://sphinx-gallery.github.io/stable/tutorials/index.html) to create the tutorials. Syntax is very simple. In essence, you write a slightly well formatted Python file and it shows up as an HTML page. In addition, a Jupyter notebook is autogenerated and available to run in Google Colab.
2222

23-
Here is how you can create a new tutorial (for a detailed description, see [CONTRIBUTING.md](./CONTRIBUTING.md)):
23+
Here is how you can ceate a new tutorial (for a detailed description, see [CONTRIBUTING.md](./CONTRIBUTING.md)):
2424

2525
NOTE: Before submitting a new tutorial, read [PyTorch Tutorial Submission Policy](./tutorial_submission_policy.md).
2626

Binary file not shown.
-7.37 KB
Binary file not shown.
-15.9 KB
Binary file not shown.
-8.41 KB
Binary file not shown.
-25.8 KB
Binary file not shown.
Loading
Binary file not shown.

advanced_source/coding_ddpg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ def make_recorder(actor_model_explore, transform_state_dict, record_interval):
893893
record_frames=1000,
894894
policy_exploration=actor_model_explore,
895895
environment=environment,
896-
exploration_type=ExplorationType.MEAN,
896+
exploration_type=ExplorationType.DETERMINISTIC,
897897
record_interval=record_interval,
898898
)
899899
return recorder_obj

advanced_source/cpp_autograd.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ Out:
255255
[ CPUFloatType{3,4} ]
256256
257257
Please see the documentation for ``torch::autograd::backward``
258-
(`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1afa9b5d4329085df4b6b3d4b4be48914b.html>`_)
258+
(`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1a1403bf65b1f4f8c8506a9e6e5312d030.html>`_)
259259
and ``torch::autograd::grad``
260-
(`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1a1e03c42b14b40c306f9eb947ef842d9c.html>`_)
260+
(`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1ab9fa15dc09a8891c26525fb61d33401a.html>`_)
261261
for more information on how to use them.
262262

263263
Using custom autograd function in C++
@@ -394,9 +394,9 @@ C++ using the following table:
394394
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
395395
| Python | C++ |
396396
+================================+========================================================================================================================================================================+
397-
| ``torch.autograd.backward`` | ``torch::autograd::backward`` (`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1afa9b5d4329085df4b6b3d4b4be48914b.html>`_) |
397+
| ``torch.autograd.backward`` | ``torch::autograd::backward`` (`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1a1403bf65b1f4f8c8506a9e6e5312d030.html>`_) |
398398
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
399-
| ``torch.autograd.grad`` | ``torch::autograd::grad`` (`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1a1e03c42b14b40c306f9eb947ef842d9c.html>`_) |
399+
| ``torch.autograd.grad`` | ``torch::autograd::grad`` (`link <https://pytorch.org/cppdocs/api/function_namespacetorch_1_1autograd_1ab9fa15dc09a8891c26525fb61d33401a.html>`_) |
400400
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
401401
| ``torch.Tensor.detach`` | ``torch::Tensor::detach`` (`link <https://pytorch.org/cppdocs/api/classat_1_1_tensor.html#_CPPv4NK2at6Tensor6detachEv>`_) |
402402
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

0 commit comments

Comments
 (0)