Skip to content

Commit 8314642

Browse files
authored
Merge branch 'main' into make_distribute_tutorial_work_in_google_colab
2 parents 268c638 + 01eeee6 commit 8314642

File tree

159 files changed

+5474
-8872
lines changed

Some content is hidden

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

159 files changed

+5474
-8872
lines changed

.ci/docker/Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ RUN bash ./install_user.sh && rm install_user.sh
1515
COPY ./common/install_docs_reqs.sh install_docs_reqs.sh
1616
RUN bash ./install_docs_reqs.sh && rm install_docs_reqs.sh
1717

18-
# Install conda and other packages
19-
ENV ANACONDA_PYTHON_VERSION=3.10
20-
ENV CONDA_CMAKE yes
21-
ENV DOCS yes
22-
ENV PATH /opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/bin:/opt/conda/bin:$PATH
23-
COPY ./requirements.txt /opt/conda/
24-
COPY ./common/install_conda.sh install_conda.sh
25-
COPY ./common/common_utils.sh common_utils.sh
26-
RUN bash ./install_conda.sh && rm install_conda.sh common_utils.sh /opt/conda/requirements.txt
18+
COPY ./common/install_pip_requirements.sh install_pip_requirements.sh
19+
COPY ./requirements.txt requirements.txt
20+
RUN bash ./install_pip_requirements.sh && rm install_pip_requirements.sh
21+
22+
RUN ln -s /usr/bin/python3 /usr/bin/python
2723

2824
USER ci-user
2925
CMD ["bash"]

.ci/docker/build.sh

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

13-
export UBUNTU_VERSION="20.04"
13+
export UBUNTU_VERSION="22.04"
1414
export CUDA_VERSION="12.4.1"
1515

1616
export BASE_IMAGE="nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}"

.ci/docker/common/common_utils.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.ci/docker/common/install_base.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ install_ubuntu() {
1010
apt-get install -y --no-install-recommends \
1111
build-essential \
1212
ca-certificates \
13-
cmake=3.16* \
13+
cmake=3.22* \
1414
curl \
1515
git \
1616
wget \
@@ -27,7 +27,9 @@ install_ubuntu() {
2727
libglfw3-dev \
2828
sox \
2929
libsox-dev \
30-
libsox-fmt-all
30+
libsox-fmt-all \
31+
python3-pip \
32+
python3-dev
3133

3234
# Cleanup package manager
3335
apt-get autoclean && apt-get clean

.ci/docker/common/install_conda.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Install pip packages
6+
pip install --upgrade pip
7+
pip install -r ./requirements.txt

.ci/docker/requirements.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ sphinx-gallery==0.11.1
66
sphinx_design
77
docutils==0.16
88
sphinx-copybutton
9+
sphinx_sitemap==2.6.0
910
pypandoc==1.12
1011
pandocfilters
1112
markdown
1213
tqdm==4.66.1
1314
numpy==1.24.4
1415
matplotlib
1516
librosa
16-
torch==2.4
17+
torch==2.5
1718
torchvision
18-
torchtext
1919
torchdata
2020
networkx
2121
PyHamcrest
@@ -64,8 +64,10 @@ pyopengl
6464
gymnasium[mujoco]==0.27.0
6565
timm
6666
iopath
67-
pygame==2.1.2
67+
pygame==2.6.0
6868
pycocotools
6969
semilearn==0.3.2
70-
torchao==0.0.3
70+
torchao==0.5.0
7171
segment_anything==1.0
72+
torchrec==1.0.0; platform_system == "Linux"
73+
fbgemm-gpu==1.0.0; platform_system == "Linux"

.github/workflows/StalePRs.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# A workflow copied from the pytorch/pytorch repo stale PRs that implements similar logic to actions/stale.
2+
#
3+
# Compared to actions/stale, it is implemented to make API requests proportional
4+
# to the number of stale PRs, not the total number of issues in the repo. This
5+
# is because PyTorch has a lot of issues/PRs, so the actions/stale runs into
6+
# rate limits way too quickly.
7+
#
8+
# The behavior is:
9+
# - If a PR is not labeled stale, after 60 days inactivity label the PR as stale and comment about it.
10+
# - If a PR is labeled stale, after 30 days inactivity close the PR.
11+
# - `high priority` and `no-stale` PRs are exempt.
12+
13+
name: Close stale pull requests
14+
15+
on:
16+
schedule:
17+
# Run at midnight UTC.
18+
- cron: '0 0 * * *'
19+
workflow_dispatch:
20+
21+
jobs:
22+
stale:
23+
if: ${{ github.repository == 'pytorch/tutorials' }}
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
pull-requests: write
28+
29+
steps:
30+
- uses: actions/github-script@v6
31+
with:
32+
script: |
33+
// Do some dumb retries on requests.
34+
const retries = 7;
35+
const baseBackoff = 100;
36+
const sleep = timeout => new Promise(resolve => setTimeout(resolve, timeout));
37+
github.hook.wrap('request', async (request, options) => {
38+
for (let attempt = 1; attempt <= retries; attempt++) {
39+
try {
40+
return await request(options);
41+
} catch (err) {
42+
if (attempt < retries) {
43+
core.warning(`Request getting retried. Attempt: ${attempt}`);
44+
await sleep(baseBackoff * Math.pow(2, attempt));
45+
continue;
46+
}
47+
throw err;
48+
}
49+
}
50+
});
51+
52+
const MAX_API_REQUESTS = 100;
53+
54+
// If a PRs not labeled stale, label them stale after no update for 60 days.
55+
const STALE_LABEL_THRESHOLD_MS = 1000 * 60 * 60 * 24 * 60;
56+
// For PRs already labeled stale, close after not update for 30 days.
57+
const STALE_CLOSE_THRESHOLD_MS = 1000 * 60 * 60 * 24 * 30;
58+
59+
const STALE_MESSAGE =
60+
"Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as `stale`. <br>" +
61+
"Feel free to remove the `stale` label if you feel this was a mistake. <br>" +
62+
"If you are unable to remove the `stale` label please contact a maintainer in order to do so. <br>" +
63+
"If you want the bot to never mark this PR stale again, add the `no-stale` label.<br>" +
64+
"`stale` pull requests will automatically be closed after 30 days of inactivity.<br>";
65+
66+
let numAPIRequests = 0;
67+
let numProcessed = 0;
68+
69+
async function processPull(pull) {
70+
core.info(`[${pull.number}] URL: ${pull.html_url}`);
71+
numProcessed += 1;
72+
const labels = pull.labels.map((label) => label.name);
73+
74+
// Skip if certain labels are present.
75+
if (labels.includes("no-stale") || labels.includes("high priority")) {
76+
core.info(`[${pull.number}] Skipping because PR has an exempting label.`);
77+
return false;
78+
}
79+
80+
// Check if the PR is stale, according to our configured thresholds.
81+
let staleThresholdMillis;
82+
if (labels.includes("stale")) {
83+
core.info(`[${pull.number}] PR is labeled stale, checking whether we should close it.`);
84+
staleThresholdMillis = STALE_CLOSE_THRESHOLD_MS;
85+
} else {
86+
core.info(`[${pull.number}] Checking whether to label PR as stale.`);
87+
staleThresholdMillis = STALE_LABEL_THRESHOLD_MS;
88+
}
89+
90+
const millisSinceLastUpdated =
91+
new Date().getTime() - new Date(pull.updated_at).getTime();
92+
93+
if (millisSinceLastUpdated < staleThresholdMillis) {
94+
core.info(`[${pull.number}] Skipping because PR was updated recently`);
95+
return false;
96+
}
97+
98+
// At this point, we know we should do something.
99+
// For PRs already labeled stale, close them.
100+
if (labels.includes("stale")) {
101+
core.info(`[${pull.number}] Closing PR.`);
102+
numAPIRequests += 1;
103+
await github.rest.issues.update({
104+
owner: "pytorch",
105+
repo: "tutorials",
106+
issue_number: pull.number,
107+
state: "closed",
108+
});
109+
} else {
110+
// For PRs not labeled stale, label them stale.
111+
core.info(`[${pull.number}] Labeling PR as stale.`);
112+
113+
numAPIRequests += 1;
114+
await github.rest.issues.createComment({
115+
owner: "pytorch",
116+
repo: "tutorials",
117+
issue_number: pull.number,
118+
body: STALE_MESSAGE,
119+
});
120+
121+
numAPIRequests += 1;
122+
await github.rest.issues.addLabels({
123+
owner: "pytorch",
124+
repo: "tutorials",
125+
issue_number: pull.number,
126+
labels: ["stale"],
127+
});
128+
}
129+
}
130+
131+
for await (const response of github.paginate.iterator(
132+
github.rest.pulls.list,
133+
{
134+
owner: "pytorch",
135+
repo: "tutorials",
136+
state: "open",
137+
sort: "created",
138+
direction: "asc",
139+
per_page: 100,
140+
}
141+
)) {
142+
numAPIRequests += 1;
143+
const pulls = response.data;
144+
// Awaiting in a loop is intentional here. We want to serialize execution so
145+
// that log groups are printed correctl
146+
for (const pull of pulls) {
147+
if (numAPIRequests > MAX_API_REQUESTS) {
148+
core.warning("Max API requests exceeded, exiting.");
149+
process.exit(0);
150+
}
151+
await core.group(`Processing PR #${pull.number}`, async () => {
152+
await processPull(pull);
153+
});
154+
}
155+
}
156+
core.info(`Processed ${numProcessed} PRs total.`);
157+

.github/workflows/build-tutorials.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
4545
- name: Checkout Tutorials
4646
uses: actions/checkout@v3
47+
with:
48+
fetch-depth: 0
4749

4850
- name: Setup Linux
4951
uses: pytorch/pytorch/.github/actions/setup-linux@main
@@ -115,6 +117,8 @@ jobs:
115117
116118
- name: Checkout Tutorials
117119
uses: actions/checkout@v3
120+
with:
121+
fetch-depth: 0
118122

119123
- name: Setup Linux
120124
uses: pytorch/pytorch/.github/actions/setup-linux@main

0 commit comments

Comments
 (0)