Skip to content

Commit bb05b79

Browse files
authored
Add option to generate matrix for getting started page (#6971)
We will be removing torchaudio from getting started page. However would still like to include it in validation. Test: ``` python tools/scripts/generate_binary_build_matrix.py --getting-started true {"include": [{"python_version": "3.9", "gpu_arch_type": "cpu", "gpu_arch_version": "", "desired_cuda": "cpu", "container_image": "pytorch/manylinux2_28-builder:cpu", "package_type": "manywheel", "build_name": "manywheel-py3_9-cpu", "validation_runner": "linux.2xlarge", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}, {"python_version": "3.9", "gpu_arch_type": "cuda", "gpu_arch_version": "12.6", "desired_cuda": "cu126", "container_image": "pytorch/manylinux2_28-builder:cuda12.6", "package_type": "manywheel", "build_name": "manywheel-py3_9-cuda12_6", "validation_runner": "linux.g5.4xlarge.nvidia.gpu", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu126", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}, {"python_version": "3.9", "gpu_arch_type": "cuda", "gpu_arch_version": "12.8", "desired_cuda": "cu128", "container_image": "pytorch/manylinux2_28-builder:cuda12.8", "package_type": "manywheel", "build_name": "manywheel-py3_9-cuda12_8", "validation_runner": "linux.g5.4xlarge.nvidia.gpu", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu128", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}, {"python_version": "3.9", "gpu_arch_type": "cuda", "gpu_arch_version": "12.9", "desired_cuda": "cu129", "container_image": "pytorch/manylinux2_28-builder:cuda12.9", "package_type": "manywheel", "build_name": "manywheel-py3_9-cuda12_9", "validation_runner": "linux.g5.4xlarge.nvidia.gpu", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu129", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}, {"python_version": "3.9", "gpu_arch_type": "rocm", "gpu_arch_version": "6.3", "desired_cuda": "rocm6.3", "container_image": "pytorch/manylinux2_28-builder:rocm6.3", "package_type": "manywheel", "build_name": "manywheel-py3_9-rocm6_3", "validation_runner": "linux.2xlarge", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/rocm6.3", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}, {"python_version": "3.9", "gpu_arch_type": "rocm", "gpu_arch_version": "6.4", "desired_cuda": "rocm6.4", "container_image": "pytorch/manylinux2_28-builder:rocm6.4", "package_type": "manywheel", "build_name": "manywheel-py3_9-rocm6_4", "validation_runner": "linux.2xlarge", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/rocm6.4", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}, {"python_version": "3.9", "gpu_arch_type": "xpu", "gpu_arch_version": "", "desired_cuda": "xpu", "container_image": "pytorch/manylinux2_28-builder:xpu", "package_type": "manywheel", "build_name": "manywheel-py3_9-xpu", "validation_runner": "linux.2xlarge", "installation": "pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/xpu", "channel": "nightly", "upload_to_base_bucket": "no", "stable_version": "2.7.1", "use_split_build": false}]} ```
1 parent 8b7c799 commit bb05b79

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/generate_binary_build_matrix.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ on:
5959
required: false
6060
type: boolean
6161
default: false
62+
getting-started:
63+
description: "Release matrix for getting started page"
64+
required: false
65+
type: boolean
66+
default: false
6267

6368
outputs:
6469
matrix:
@@ -98,6 +103,7 @@ jobs:
98103
USE_ONLY_DL_PYTORCH_ORG: ${{ inputs.use-only-dl-pytorch-org }}
99104
BUILD_PYTHON_ONLY: ${{ inputs.build-python-only }}
100105
USE_SPLIT_BUILD: ${{ inputs.use_split_build }}
106+
GETTING_STARTED: ${{ inputs.getting-started }}
101107
PYTHON_VERSIONS: ${{ inputs.python-versions }}
102108
run: |
103109
set -eou pipefail

tools/scripts/generate_binary_build_matrix.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
MACOS_M1_RUNNER = "macos-m1-stable"
100100

101101
PACKAGES_TO_INSTALL_WHL = "torch torchvision torchaudio"
102+
PACKAGES_TO_INSTALL_GETTING_STARTED_WHL = "torch torchvision"
102103
PACKAGES_TO_INSTALL_WHL_WIN_ARM64 = "torch"
103104
WHL_INSTALL_BASE = "pip3 install"
104105
DOWNLOAD_URL_BASE = "https://download.pytorch.org"
@@ -274,10 +275,16 @@ def get_wheel_install_command(
274275
python_version: str,
275276
use_only_dl_pytorch_org: bool,
276277
use_split_build: bool = False,
278+
getting_started: bool = False,
277279
) -> str:
280+
PACKAGES_TO_INSTALL = (
281+
PACKAGES_TO_INSTALL_GETTING_STARTED_WHL
282+
if getting_started
283+
else PACKAGES_TO_INSTALL_WHL
284+
)
278285
if use_split_build:
279286
if (gpu_arch_version in CUDA_ARCHES) and (os == LINUX) and (channel == NIGHTLY):
280-
return f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL_WHL} --index-url {get_base_download_url_for_repo('whl', channel, gpu_arch_type, desired_cuda)}_pypi_pkg" # noqa: E501
287+
return f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL} --index-url {get_base_download_url_for_repo('whl', channel, gpu_arch_type, desired_cuda)}_pypi_pkg" # noqa: E501
281288
else:
282289
raise ValueError(
283290
"Split build is not supported for this configuration. It is only supported for CUDA 11.8, 12.4, 12.6 on Linux nightly builds." # noqa: E501
@@ -291,7 +298,7 @@ def get_wheel_install_command(
291298
or (os == LINUX_AARCH64)
292299
)
293300
):
294-
return f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL_WHL}"
301+
return f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL}"
295302
else:
296303
whl_install_command = ""
297304
if os == WINDOWS_ARM64:
@@ -300,9 +307,9 @@ def get_wheel_install_command(
300307
f"{WHL_INSTALL_BASE} --pre {PACKAGES_TO_INSTALL_WHL_WIN_ARM64}" # noqa: E501
301308
)
302309
elif channel == "nightly":
303-
whl_install_command = f"{WHL_INSTALL_BASE} --pre {PACKAGES_TO_INSTALL_WHL}"
310+
whl_install_command = f"{WHL_INSTALL_BASE} --pre {PACKAGES_TO_INSTALL}"
304311
else:
305-
whl_install_command = f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL_WHL}"
312+
whl_install_command = f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL}"
306313
return f"{whl_install_command} --index-url {get_base_download_url_for_repo('whl', channel, gpu_arch_type, desired_cuda)}" # noqa: E501
307314

308315

@@ -409,6 +416,7 @@ def generate_wheels_matrix(
409416
limit_pr_builds: bool,
410417
use_only_dl_pytorch_org: bool,
411418
use_split_build: bool = False,
419+
getting_started: bool = False,
412420
python_versions: Optional[List[str]] = None,
413421
arches: Optional[List[str]] = None,
414422
) -> List[Dict[str, str]]:
@@ -483,6 +491,8 @@ def generate_wheels_matrix(
483491
desired_cuda,
484492
python_version,
485493
use_only_dl_pytorch_org,
494+
use_split_build,
495+
getting_started,
486496
),
487497
"channel": channel,
488498
"upload_to_base_bucket": upload_to_base_bucket,
@@ -526,6 +536,7 @@ def generate_build_matrix(
526536
use_only_dl_pytorch_org: str,
527537
build_python_only: str,
528538
use_split_build: str = "false",
539+
getting_started: str = "false",
529540
python_versions: Optional[List[str]] = None,
530541
) -> Dict[str, List[Dict[str, str]]]:
531542
includes = []
@@ -550,6 +561,7 @@ def generate_build_matrix(
550561
limit_pr_builds == "true",
551562
use_only_dl_pytorch_org == "true",
552563
use_split_build == "true",
564+
getting_started == "true",
553565
python_versions,
554566
)
555567
)
@@ -645,6 +657,14 @@ def main(args: List[str]) -> None:
645657
default=os.getenv("USE_SPLIT_BUILD", DISABLE),
646658
)
647659

660+
parser.add_argument(
661+
"--getting-started",
662+
help="Matrix for getting started page",
663+
type=str,
664+
choices=["true", "false"],
665+
default=os.getenv("GETTING_STARTED", "false"),
666+
)
667+
648668
parser.add_argument(
649669
"--python-versions",
650670
help="Only build the select JSON-encoded list of python versions",
@@ -674,6 +694,7 @@ def main(args: List[str]) -> None:
674694
options.use_only_dl_pytorch_org,
675695
options.build_python_only,
676696
options.use_split_build,
697+
options.getting_started,
677698
python_versions,
678699
)
679700

0 commit comments

Comments
 (0)