Skip to content

Commit 8332e83

Browse files
authored
Specific PYTORCH_VERSION when building RC for test channel (#4803)
With 2 candidate RC in the test channel (2.1.2 and 2.2.0), we need to have a way to specify which PYTORCH_VERSION to use. The issue surfaces when we are trying to cut RC3 for 2.1.2 today while there is already RC1 for 2.2.0 in place. In the current state, `PYTHON_VERSION=3.11 PACKAGE_TYPE=conda CU_VERSION=cpu ARCH_NAME=arm64 CHANNEL=test python -m pytorch_pkg_helpers` will set `PYTORCH_VERSION` to 2.2.0 whenever domains are built For example, https://github.com/pytorch/vision/actions/runs/7190086502/job/19582646141#step:6:743 build M1 conda for vision 0.16.2 and it's expected to use 2.1.2 there, not 2.2.0. The fix here is to: 1. Correctly set the channel to `test` when building RC 2. If the channel is test, use the current candidate version as PYTORCH_VERSION. The value is exposed via the build matrix as `stable_version` 3. When doing branch cut for test-infra, the `CURRENT_CANDIDATE_VERSION` variable could be set accordingly, for example, use 2.1.2 for `release/2.1` and 2.2.0 for `release/2.2` ### Testing plan This PR #4803 tests `nightly` while the cherry pick #4804 covers `test` channel
1 parent 5b5ddf3 commit 8332e83

File tree

9 files changed

+48
-8
lines changed

9 files changed

+48
-8
lines changed

.github/actions/set-channel/action.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ description: Add CHANNEL to GITHUB_ENV
66
runs:
77
using: composite
88
steps:
9-
- name: Set default CHANNEL
10-
shell: bash
11-
run: |
12-
set -euxo pipefail
13-
echo "CHANNEL=nightly" >> "${GITHUB_ENV}"
149
- name: Set CHANNEL for tagged pushes
1510
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
1611
shell: bash
@@ -26,3 +21,12 @@ runs:
2621
run: |
2722
set -euxo pipefail
2823
echo "CHANNEL=test" >> "$GITHUB_ENV"
24+
- name: Set default CHANNEL
25+
# Set this to nightly only when the CHANNEL hasn't been set yet. In GHA, once
26+
# an env is set, it's fixed unless we can figure out a way to overwrite it in
27+
# $GITHUB_ENV
28+
if: ${{ env.CHANNEL == '' }}
29+
shell: bash
30+
run: |
31+
set -euxo pipefail
32+
echo "CHANNEL=nightly" >> "${GITHUB_ENV}"

.github/workflows/build_conda_linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ jobs:
9696
ref: ${{ inputs.test-infra-ref }}
9797
path: test-infra
9898
- uses: ./test-infra/.github/actions/set-channel
99+
- name: Set PYTORCH_VERSION
100+
if: ${{ env.CHANNEL == 'test' }}
101+
run: |
102+
# When building RC, set the version to be the current candidate version,
103+
# otherwise, leave it alone so nightly will pick up the latest
104+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
99105
- uses: ./test-infra/.github/actions/setup-binary-builds
100106
with:
101107
repository: ${{ inputs.repository }}

.github/workflows/build_conda_macos.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ jobs:
106106
- name: Set env variable for architecture name
107107
run: echo "ARCH_NAME=$(uname -m)" >> "${GITHUB_ENV}"
108108
- uses: ./test-infra/.github/actions/set-channel
109+
- name: Set PYTORCH_VERSION
110+
if: ${{ env.CHANNEL == 'test' }}
111+
run: |
112+
# When building RC, set the version to be the current candidate version,
113+
# otherwise, leave it alone so nightly will pick up the latest
114+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
109115
- uses: ./test-infra/.github/actions/setup-binary-builds
110116
with:
111117
repository: ${{ inputs.repository }}

.github/workflows/build_conda_windows.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ jobs:
9696
ref: ${{ inputs.test-infra-ref }}
9797
path: test-infra
9898
- uses: ./test-infra/.github/actions/set-channel
99+
- name: Set PYTORCH_VERSION
100+
if: ${{ env.CHANNEL == 'test' }}
101+
run: |
102+
# When building RC, set the version to be the current candidate version,
103+
# otherwise, leave it alone so nightly will pick up the latest
104+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
99105
- uses: ./test-infra/.github/actions/setup-ssh
100106
name: Setup SSH
101107
with:

.github/workflows/build_wheels_linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ jobs:
134134
echo "/opt/conda/bin" >> $GITHUB_PATH
135135
set -e
136136
- uses: ./test-infra/.github/actions/set-channel
137+
- name: Set PYTORCH_VERSION
138+
if: ${{ env.CHANNEL == 'test' }}
139+
run: |
140+
# When building RC, set the version to be the current candidate version,
141+
# otherwise, leave it alone so nightly will pick up the latest
142+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
137143
- uses: ./test-infra/.github/actions/setup-binary-builds
138144
env:
139145
PLATFORM: ${{ inputs.architecture == 'aarch64' && 'linux-aarch64' || ''}}

.github/workflows/build_wheels_macos.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ jobs:
9898
ref: ${{ inputs.test-infra-ref }}
9999
path: test-infra
100100
- uses: ./test-infra/.github/actions/set-channel
101+
- name: Set PYTORCH_VERSION
102+
if: ${{ env.CHANNEL == 'test' }}
103+
run: |
104+
# When building RC, set the version to be the current candidate version,
105+
# otherwise, leave it alone so nightly will pick up the latest
106+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
101107
- uses: ./test-infra/.github/actions/setup-binary-builds
102108
with:
103109
repository: ${{ inputs.repository }}

.github/workflows/build_wheels_windows.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ jobs:
105105
run: |
106106
echo "C:/Jenkins/Miniconda3/Scripts" >> $GITHUB_PATH
107107
- uses: ./test-infra/.github/actions/set-channel
108+
- name: Set PYTORCH_VERSION
109+
if: ${{ env.CHANNEL == 'test' }}
110+
run: |
111+
# When building RC, set the version to be the current candidate version,
112+
# otherwise, leave it alone so nightly will pick up the latest
113+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
108114
- uses: ./test-infra/.github/actions/setup-binary-builds
109115
with:
110116
repository: ${{ inputs.repository }}

.github/workflows/generate_binary_build_matrix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
type: string
1414
channel:
1515
description: "Channel to use (nightly, test, release, all)"
16-
default: "nightly"
16+
default: ""
1717
type: string
1818
test-infra-repository:
1919
description: "Test infra repository to use"
@@ -60,7 +60,7 @@ jobs:
6060
env:
6161
PACKAGE_TYPE: ${{ inputs.package-type }}
6262
OS: ${{ inputs.os }}
63-
CHANNEL: ${{ inputs.channel }}
63+
CHANNEL: ${{ inputs.channel != '' && inputs.channel || env.CHANNEL }}
6464
WITH_CUDA: ${{ inputs.with-cuda }}
6565
WITH_ROCM: ${{ inputs.with-rocm }}
6666
WITH_CPU: ${{ inputs.with-cpu }}

tools/scripts/generate_binary_build_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
ROCM = "rocm"
5959

6060

61-
CURRENT_CANDIDATE_VERSION = "2.1.2"
61+
CURRENT_CANDIDATE_VERSION = "2.2.0"
6262
CURRENT_STABLE_VERSION = "2.1.1"
6363
mod.CURRENT_VERSION = CURRENT_STABLE_VERSION
6464

0 commit comments

Comments
 (0)