Skip to content

Commit 9054234

Browse files
committed
Merge branch 'main' of github.com:pytorch/tutorials into wwen/compile-tutorial-update
2 parents 4c42f51 + 3469d47 commit 9054234

File tree

238 files changed

+5665
-36583
lines changed

Some content is hidden

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

238 files changed

+5665
-36583
lines changed

.ci/docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ IMAGE_NAME="$1"
1111
shift
1212

1313
export UBUNTU_VERSION="22.04"
14-
export CUDA_VERSION="12.4.1"
14+
export CUDA_VERSION="12.6.3"
1515

1616
export BASE_IMAGE="nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}"
1717
echo "Building ${IMAGE_NAME} Docker image"

.ci/docker/requirements.txt

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
# --extra-index-url https://download.pytorch.org/whl/cu117/index.html # Use this to run/publish tutorials against the latest binaries during the RC stage. Comment out after the release. Each release verify the correct cuda version.
2-
# Refer to ./jenkins/build.sh for tutorial build instructions
2+
# Refer to ./jenkins/build.sh for tutorial build instructions.
33

4-
sphinx==5.0.0
5-
sphinx-gallery==0.11.1
6-
sphinx_design
7-
docutils==0.16
8-
sphinx-copybutton
9-
sphinx_sitemap==2.6.0
10-
pypandoc==1.12
11-
pandocfilters
12-
markdown
4+
# Sphinx dependencies
5+
sphinx==7.2.6
6+
sphinx-gallery==0.19.0
7+
sphinx-reredirects==0.1.4
8+
sphinx_design==0.6.1
9+
docutils>=0.18.1,<0.21
10+
sphinx-copybutton==0.5.2
11+
sphinx_sitemap==2.7.1
12+
sphinxcontrib-mermaid==1.0.0
13+
sphinxcontrib.katex==0.9.10
14+
pypandoc==1.15
15+
pandocfilters==1.5.1
16+
markdown==3.8.2
17+
18+
# PyTorch Theme
19+
git+https://github.com/pytorch/pytorch_sphinx_theme.git@bbe196cbc5037d69d89ad1bf079e2afa3b3e9611#egg=pytorch_sphinx_theme2
20+
21+
# Tutorial dependencies
1322
tqdm==4.66.1
1423
numpy==1.24.4
1524
matplotlib
1625
librosa
17-
torch==2.7
26+
torch==2.8
1827
torchvision
1928
torchdata
2029
networkx
@@ -28,13 +37,13 @@ tensorboard
2837
jinja2==3.1.3
2938
pytorch-lightning
3039
torchx
31-
torchrl==0.7.2
32-
tensordict==0.7.2
33-
ax-platform>=0.4.0
40+
torchrl==0.9.2
41+
tensordict==0.9.1
42+
# For ax_multiobjective_nas_tutorial.py
43+
ax-platform>=0.4.0,<0.5.0
3444
nbformat>=5.9.2
3545
datasets
3646
transformers
37-
torchmultimodal-nightly # needs to be updated to stable as soon as it's avaialable
3847
onnx
3948
onnxscript>=0.2.2
4049
onnxruntime
@@ -43,9 +52,6 @@ accelerate>=0.20.1
4352

4453
importlib-metadata==6.8.0
4554

46-
# PyTorch Theme
47-
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
48-
4955
ipython
5056

5157
sphinxcontrib.katex
@@ -63,11 +69,10 @@ gym-super-mario-bros==7.4.0
6369
pyopengl
6470
gymnasium[mujoco]==0.27.0
6571
timm
66-
iopath
6772
pygame==2.6.0
6873
pycocotools
6974
semilearn==0.3.2
7075
torchao==0.10.0
7176
segment_anything==1.0
72-
torchrec==1.1.0; platform_system == "Linux"
77+
torchrec==1.2.0; platform_system == "Linux"
7378
fbgemm-gpu==1.2.0; platform_system == "Linux"

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ body:
1313
- type: textarea
1414
attributes:
1515
label: Add Link
16-
description: |
16+
description: |
1717
**Add the link to the tutorial***
1818
placeholder: |
1919
Link to the tutorial on the website:
2020
validations:
21-
required: true
21+
required: true
2222
- type: textarea
2323
attributes:
2424
label: Describe the bug
25-
description: |
26-
**Add the bug description**
25+
description: |
26+
**Add the bug description**
2727
placeholder: |
2828
Provide a detailed description of the issue with code samples if relevant
2929
```python

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ body:
1818
- type: textarea
1919
attributes:
2020
label: Existing tutorials on this topic
21-
description: |
21+
description: |
2222
**Add a list of existing tutorials on the same topic.**
2323
placeholder: |
2424
List tutorials that already explain this functionality if exist. On pytorch.org or elsewhere.

.github/scripts/check_redirects.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
if [ "$CURRENT_BRANCH" == "$BASE_BRANCH" ]; then
4+
echo "Running on $BASE_BRANCH branch. Skipping check."
5+
exit 0
6+
fi
7+
8+
9+
# Get list of deleted or renamed files in this branch compared to base
10+
DELETED_FILES=$(git diff --name-status $BASE_BRANCH $CURRENT_BRANCH --diff-filter=DR | awk '{print $2}' | grep -E '\.(rst|py|md)$' | grep -v 'redirects.py')
11+
# Check if any deleted or renamed files were found
12+
if [ -z "$DELETED_FILES" ]; then
13+
echo "No deleted or renamed files found. Skipping check."
14+
exit 0
15+
fi
16+
17+
echo "Deleted or renamed files:"
18+
echo "$DELETED_FILES"
19+
20+
# Check if redirects.py has been updated
21+
REDIRECTS_UPDATED=$(git diff --name-status $BASE_BRANCH $CURRENT_BRANCH --diff-filter=AM | grep 'redirects.py' && echo "yes" || echo "no")
22+
23+
if [ "$REDIRECTS_UPDATED" == "no" ]; then
24+
echo "ERROR: Files were deleted or renamed but redirects.py was not updated. Please update .github/scripts/redirects.py to redirect these files."
25+
exit 1
26+
fi
27+
28+
# Check if each deleted file has a redirect entry
29+
MISSING_REDIRECTS=0
30+
for FILE in $DELETED_FILES; do
31+
# Convert file path to URL path format (remove extension and adjust path)
32+
REDIRECT_PATH=$(echo $FILE | sed -E 's/(.+)_source\/(.+)\.(py|rst|md)$/\1\/\2.html/')
33+
34+
# Check if this path exists in redirects.py as a key. We don't check for values.
35+
if ! grep -q "\"$REDIRECT_PATH\":" redirects.py; then
36+
echo "ERROR: Missing redirect for deleted file: $FILE (should have entry for \"$REDIRECT_PATH\")"
37+
MISSING_REDIRECTS=1
38+
fi
39+
done
40+
41+
if [ $MISSING_REDIRECTS -eq 1 ]; then
42+
echo "ERROR: Please add redirects for all deleted/renamed files to redirects.py"
43+
exit 1
44+
fi
45+
46+
echo "All deleted/renamed files have proper redirects. Check passed!"

.github/scripts/docathon-label-sync.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ def main():
2525
issue_number = int(re.findall(r'#(\d{1,5})', pull_request_body)[0])
2626
issue = repo.get_issue(issue_number)
2727
issue_labels = issue.labels
28-
docathon_label_present = any(label.name == 'docathon-h1-2024' for label in issue_labels)
28+
docathon_label_present = any(label.name == 'docathon-h1-2025' for label in issue_labels)
2929

3030
# if the issue has a docathon label, add all labels from the issue to the PR.
3131
if not docathon_label_present:
32-
print("The 'docathon-h1-2024' label is not present in the issue.")
33-
return
32+
print("The 'docathon-h1-2025' label is not present in the issue.")
33+
return
3434
pull_request_labels = pull_request.get_labels()
3535
issue_label_names = [label.name for label in issue_labels]
3636
labels_to_add = [label for label in issue_label_names if label not in pull_request_labels]
@@ -39,8 +39,8 @@ def main():
3939
return
4040
pull_request.add_to_labels(*labels_to_add)
4141
print("Labels added to the pull request!")
42-
4342

44-
43+
44+
4545
if __name__ == "__main__":
4646
main()

.github/workflows/MonthlyLinkCheck.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Runs once a month and checks links in the repo to ensure they are valid
1+
#Runs once a month and checks links in the repo to ensure they are valid
22
#If action fails, it creates an issue with the failing links and an "incorrect link" label
33
#If link is valid but failing, it can be added to the .lycheeignore file
44
#Action can also be run manually as needed.
@@ -34,8 +34,8 @@ jobs:
3434
content-filepath: ./lychee/out.md
3535
labels: 'incorrect link'
3636
#token: ${{ secrets.CUSTOM_TOKEN }}
37-
38-
37+
38+
3939
- name: Suggestions
4040
if: failure()
4141
run: |

.github/workflows/StalePRs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
jobs:
2222
stale:
2323
if: ${{ github.repository == 'pytorch/tutorials' }}
24-
runs-on: ubuntu-latest
24+
runs-on: ubuntu-latest
2525
permissions:
2626
contents: read
2727
pull-requests: write
@@ -154,4 +154,3 @@ jobs:
154154
}
155155
}
156156
core.info(`Processed ${numProcessed} PRs total.`);
157-
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check Redirects for Deleted or Renamed Files
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '*/**/*.rst'
7+
- '*/**/*.py'
8+
- '*/**/*.md'
9+
10+
jobs:
11+
check-redirects:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Run redirect check script
20+
run: |
21+
chmod +x ./.github/scripts/check_redirects.sh
22+
./.github/scripts/check_redirects.sh
23+
env:
24+
BASE_BRANCH: ${{ github.base_ref }}
25+
CURRENT_BRANCH: ${{ github.head_ref }}

.github/workflows/docathon-assign.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
repo: context.repo.repo,
2929
issue_number: issueNumber
3030
});
31-
const hasLabel = issue.labels.some(label => label.name === 'docathon-h1-2024');
31+
const hasLabel = issue.labels.some(label => label.name === 'docathon-h1-2025');
3232
if (hasLabel) {
3333
if (issue.assignee !== null) {
3434
await github.rest.issues.createComment({
3535
owner: context.repo.owner,
3636
repo: context.repo.repo,
3737
issue_number: issueNumber,
38-
body: "The issue is already assigned. Please pick an opened and unnasigned issue with the [docathon-h1-2024 label](https://github.com/pytorch/pytorch/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h1-2024)."
38+
body: "The issue is already assigned. Please pick an opened and unnasigned issue with the [docathon-h1-2025 label](https://github.com/pytorch/pytorch/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h1-2025)."
3939
});
4040
} else {
4141
await github.rest.issues.addAssignees({
@@ -46,7 +46,7 @@ jobs:
4646
});
4747
}
4848
} else {
49-
const commmentMessage = "This issue does not have the correct label. Please pick an opened and unnasigned issue with the [docathon-h1-2024 label](https://github.com/pytorch/pytorch/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h1-2024)."
49+
const commmentMessage = "This issue does not have the correct label. Please pick an opened and unnasigned issue with the [docathon-h1-2025 label](https://github.com/pytorch/pytorch/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h1-2025)."
5050
await github.rest.issues.createComment({
5151
owner: context.repo.owner,
5252
repo: context.repo.repo,

0 commit comments

Comments
 (0)