Skip to content

Commit 6300361

Browse files
authored
Automatically select nightly or test channel when installing torch (#1126)
1 parent ee8ce04 commit 6300361

File tree

8 files changed

+82
-8
lines changed

8 files changed

+82
-8
lines changed

.github/workflows/cpp_tests.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ jobs:
3838
run: python -m pip install --upgrade pip
3939
- name: Install torch dependencies
4040
run: |
41-
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
41+
# If we're in a release branch or in a PR against a release branch,
42+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
43+
# `main` or in PRs against `main`, we install the nightly builds.
44+
# Note that the `test` RCs are
45+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
46+
CHANNEL=test
47+
else
48+
CHANNEL=nightly
49+
fi
50+
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/${CHANNEL}/cpu
4251
- name: Install ffmpeg, pkg-config and pybind11
4352
run: |
4453
conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" pkg-config pybind11 -c conda-forge

.github/workflows/docs.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,16 @@ jobs:
9292
run: ${CONDA_RUN} python -m pip install --upgrade pip
9393
- name: Install PyTorch
9494
run: |
95-
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }}
95+
# If we're in a release branch or in a PR against a release branch,
96+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
97+
# `main` or in PRs against `main`, we install the nightly builds.
98+
# Note that the `test` RCs are
99+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
100+
CHANNEL=test
101+
else
102+
CHANNEL=nightly
103+
fi
104+
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cu${{ env.cuda_version_without_periods }}
96105
${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
97106
- name: Install torchcodec from the wheel
98107
run: |

.github/workflows/lint.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@ jobs:
6262
run: python -m pip install --upgrade pip
6363
- name: Install dependencies and FFmpeg
6464
run: |
65-
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
65+
# If we're in a release branch or in a PR against a release branch,
66+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
67+
# `main` or in PRs against `main`, we install the nightly builds.
68+
# Note that the `test` RCs are
69+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
70+
CHANNEL=test
71+
else
72+
CHANNEL=nightly
73+
fi
74+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cpu
6675
conda install "ffmpeg=7.0.1" pkg-config pybind11 -c conda-forge
6776
ffmpeg -version
6877
- name: Build and install torchcodec

.github/workflows/linux_cuda_aarch64_wheel.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,16 @@ jobs:
8989
run: python -m pip install --upgrade pip
9090
- name: Install PyTorch
9191
run: |
92-
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }}
92+
# If we're in a release branch or in a PR against a release branch,
93+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
94+
# `main` or in PRs against `main`, we install the nightly builds.
95+
# Note that the `test` RCs are
96+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
97+
CHANNEL=test
98+
else
99+
CHANNEL=nightly
100+
fi
101+
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cu${{ env.cuda_version_without_periods }}
93102
- name: Install torchcodec from the wheel
94103
run: |
95104
wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`

.github/workflows/linux_cuda_wheel.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,17 @@ jobs:
109109
run: ${CONDA_RUN} python -m pip install --upgrade pip
110110
- name: Install PyTorch
111111
run: |
112-
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }}
112+
# If we're in a release branch or in a PR against a release branch,
113+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
114+
# `main` or in PRs against `main`, we install the nightly builds.
115+
# Note that the `test` RCs are
116+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
117+
CHANNEL=test
118+
else
119+
CHANNEL=nightly
120+
fi
121+
122+
${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cu${{ env.cuda_version_without_periods }}
113123
${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
114124
- name: Install torchcodec from the wheel
115125
run: |

.github/workflows/linux_wheel.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,17 @@ jobs:
8585
run: python -m pip install --upgrade pip
8686
- name: Install PyTorch
8787
run: |
88-
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
88+
# If we're in a release branch or in a PR against a release branch,
89+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
90+
# `main` or in PRs against `main`, we install the nightly builds.
91+
# Note that the `test` RCs are
92+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
93+
CHANNEL=test
94+
else
95+
CHANNEL=nightly
96+
fi
97+
98+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cpu
8999
- name: Install torchcodec from the wheel
90100
run: |
91101
wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`

.github/workflows/macos_wheel.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,16 @@ jobs:
8686

8787
- name: Install PyTorch
8888
run: |
89-
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
89+
# If we're in a release branch or in a PR against a release branch,
90+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
91+
# `main` or in PRs against `main`, we install the nightly builds.
92+
# Note that the `test` RCs are
93+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
94+
CHANNEL=test
95+
else
96+
CHANNEL=nightly
97+
fi
98+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cpu
9099
91100
- name: Install torchcodec from the wheel
92101
run: |

.github/workflows/windows_wheel.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ jobs:
9393
run: python -m pip install --upgrade pip
9494
- name: Install PyTorch
9595
run: |
96-
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
96+
# If we're in a release branch or in a PR against a release branch,
97+
# we install the PyTorch RCs from the test channel. Otherwise, e.g. in
98+
# `main` or in PRs against `main`, we install the nightly builds.
99+
# Note that the `test` RCs are
100+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
101+
CHANNEL=test
102+
else
103+
CHANNEL=nightly
104+
fi
105+
python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cpu
97106
- name: Install torchcodec from the wheel
98107
run: |
99108
wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`

0 commit comments

Comments
 (0)