From dc2661aa1b0fe79f3aaa03362a79147c52ec2fc1 Mon Sep 17 00:00:00 2001 From: atalman Date: Wed, 16 Nov 2022 12:34:58 -0800 Subject: [PATCH 01/17] Adding workflow for calling the release matrix run on pull Testing Testing test test Test testing test test test test test Test testing testing test Update preview section Use new scriptcalling it from the workflow Refactor code Refactor workflow naming Adding version modifications adding published_versions.json modifications Fix file writing Fix typo Use write_published_versions fix --- .../workflows/update-quick-start-module.yml | 84 ++++++++++ published_versions.json | 18 ++- scripts/gen_quick_start_module.py | 147 +++++++++++++++++- 3 files changed, 242 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/update-quick-start-module.yml diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml new file mode 100644 index 000000000000..f162010413a2 --- /dev/null +++ b/.github/workflows/update-quick-start-module.yml @@ -0,0 +1,84 @@ +name: Update quick start module +on: + workflow_dispatch: + inputs: + channel: + description: "Channel to use (nightly, test, release)" + required: true + type: choice + options: + - release + - nightly + - test + version: + description: "Version to update" + required: false + type: string + +jobs: + validate-binaries: + uses: pytorch/builder/.github/workflows/validate-binaries.yml@main + with: + os: all + channel: ${{ inputs.channel }} + linux-matrix: + needs: [validate-binaries] + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: all + os: linux + channel: ${{ inputs.channel }} + windows-matrix: + needs: [validate-binaries] + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: all + os: windows + channel: ${{ inputs.channel }} + macos-matrix: + needs: [validate-binaries] + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: all + os: macos + channel: ${{ inputs.channel }} + + generate-json-file: + needs: [linux-matrix, windows-matrix, macos-matrix] + runs-on: "ubuntu-18.04" + steps: + - name: Checkout builder + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + architecture: x64 + - name: Create json file + shell: bash + env: + LINUX_MATRIX: ${{ needs.linux-matrix.outputs.matrix }} + WINDOWS_MATRIX: ${{ needs.windows-matrix.outputs.matrix }} + MACOS_MATRIX: ${{ needs.macos-matrix.outputs.matrix }} + VERSION: ${{ inputs.version }} + run: | + set -ex + printf '%s\n' "$LINUX_MATRIX" > linux_matrix.json + printf '%s\n' "$WINDOWS_MATRIX" > windows_matrix.json + printf '%s\n' "$MACOS_MATRIX" > macos_matrix.json + if [ -z "${VERSION}" ]; then + python3 ./scripts/gen_quick_start_module.py --autogenerate enable + else + python3 ./scripts/gen_quick_start_module.py --autogenerate enable --version "${VERSION}" + fi + + rm *_matrix.json + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Modify published_versions.json file + title: '[Getting Started Page] Modify published_versions.json file' + body: > + This PR is auto-generated Gettins Started page update + labels: automated pr diff --git a/published_versions.json b/published_versions.json index 7b2098d4017d..485393506c90 100644 --- a/published_versions.json +++ b/published_versions.json @@ -75,15 +75,18 @@ "pip": { "cuda.x": { "note": "# CUDA is not available on MacOS, please use default package", - "command": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu" + "command": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", + "default": true }, "cuda.y": { "note": "# CUDA is not available on MacOS, please use default package", - "command": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu" + "command": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", + "default": true }, "rocm5.x": { "note": "# ROCm is not available on MacOS, please use default package", - "command": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu" + "command": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", + "default": true }, "accnone": { "note": "# MPS acceleration is available on MacOS 12.3+", @@ -93,15 +96,18 @@ "conda": { "cuda.x": { "note": "# CUDA is not available on MacOS, please use default package", - "command": "conda install pytorch torchvision torchaudio -c pytorch-nightly" + "command": "conda install pytorch torchvision torchaudio -c pytorch-nightly", + "default": true }, "cuda.y": { "note": "# CUDA is not available on MacOS, please use default package", - "command": "conda install pytorch torchvision torchaudio -c pytorch-nightly" + "command": "conda install pytorch torchvision torchaudio -c pytorch-nightly", + "default": true }, "rocm5.x": { "note": "# ROCm is not available on MacOS, please use default package", - "command": "conda install pytorch torchvision torchaudio -c pytorch-nightly" + "command": "conda install pytorch torchvision torchaudio -c pytorch-nightly", + "default": true }, "accnone": { "note": "# MPS acceleration is available on MacOS 12.3+", diff --git a/scripts/gen_quick_start_module.py b/scripts/gen_quick_start_module.py index 34a777ae4eb0..711dc5b371de 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -1,20 +1,139 @@ #!/usr/bin/env python3 import json import os -from typing import Dict +import argparse +import io +import sys +from pathlib import Path +from typing import Dict, Set, List, Iterable +from enum import Enum + BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +class OperatingSystem(Enum): + LINUX: str = "linux" + WINDOWS: str = "windows" + MACOS: str = "macos" + +PRE_CXX11_ABI = "pre-cxx11" +CXX11_ABI = "cxx11-abi" +DEBUG = "debug" +RELEASE = "release" +DEFAULT = "default" +ENABLE = "enable" +DISABLE = "disable" +# Mapping json to release matrix is here for now +# TBD drive the mapping via: +# 1. Scanning release matrix and picking 2 latest cuda versions and 1 latest rocm +# 2. Possibility to override the scanning algorithm with arguments passed from workflow +acc_arch_map = { + "accnone": ("cpu", ""), + "cuda.x": ("cuda", "11.6"), + "cuda.y": ("cuda", "11.7"), + "rocm5.x": ("rocm", "5.2") + } + +LIBTORCH_DWNL_INSTR = { + PRE_CXX11_ABI: "Download here (Pre-cxx11 ABI):", + CXX11_ABI: "Download here (cxx11 ABI):", + RELEASE: "Download here (Release version):", + DEBUG: "Download here (Debug version):", + } def read_published_versions(): with open(os.path.join(BASE_DIR, "published_versions.json")) as fp: return json.load(fp) +def write_published_versions(versions): + with open(os.path.join(BASE_DIR, "published_versions.json"), "w") as outfile: + json.dump(versions, outfile, indent=2) + +def read_matrix_for_os(osys: OperatingSystem): + try: + with open(os.path.join(BASE_DIR, f"{osys.value}_matrix.json")) as fp: + return json.load(fp)["include"] + except FileNotFoundError as e: + raise ImportError(f"Release matrix not found for: {osys.value} error: {e.strerror}") from e + def read_quick_start_module_template(): with open(os.path.join(BASE_DIR, "_includes", "quick-start-module.js")) as fp: return fp.read() +def update_versions(versions, release_matrix, version): + version_map = { + "preview": "preview", + } + + # Generating for a specific version + if(version != "preview"): + version_map = { + version: version, + } + if version in versions["versions"]: + if version != versions["latest_stable"]: + raise RuntimeError(f"Can only update prview, latest stable: {versions['latest_stable']} or new version") + else: + import copy + new_version = copy.deepcopy(versions["versions"]["preview"]) + versions["versions"][version] = new_version + versions["latest_stable"] = version + + # Perform update of the json file from release matrix + for ver, ver_key in version_map.items(): + for os_key, os_vers in versions["versions"][ver_key].items(): + for pkg_key, pkg_vers in os_vers.items(): + for acc_key, instr in pkg_vers.items(): + + package_type = pkg_key + if pkg_key == 'pip': + package_type = 'manywheel' if os_key == OperatingSystem.LINUX.value else 'wheel' + + gpu_arch_type, gpu_arch_version = acc_arch_map[acc_key] + if(DEFAULT in instr): + gpu_arch_type, gpu_arch_version = acc_arch_map["accnone"] + + pkg_arch_matrix = list(filter( + lambda x: + (x["package_type"], x["gpu_arch_type"], x["gpu_arch_version"]) == + (package_type, gpu_arch_type, gpu_arch_version), + release_matrix[os_key] + )) + + if pkg_arch_matrix: + if package_type != 'libtorch': + instr["command"] = pkg_arch_matrix[0]["installation"] + else: + if os_key == OperatingSystem.LINUX.value: + rel_entry_pre_cxx1 = next(filter( + lambda x: + x["devtoolset"] == PRE_CXX11_ABI, + pkg_arch_matrix + ), None) + rel_entry_cxx1_abi = next(filter( + lambda x: + x["devtoolset"] == CXX11_ABI, + pkg_arch_matrix + ), None) + if(instr['versions'] is not None): + instr['versions'][LIBTORCH_DWNL_INSTR[PRE_CXX11_ABI]] = rel_entry_pre_cxx1["installation"] + instr['versions'][LIBTORCH_DWNL_INSTR[CXX11_ABI]] = rel_entry_cxx1_abi["installation"] + elif os_key == OperatingSystem.WINDOWS.value: + rel_entry_release = next(filter( + lambda x: + x["libtorch_config"] == RELEASE, + pkg_arch_matrix + ), None) + rel_entry_debug = next(filter( + lambda x: + x["libtorch_config"] == DEBUG, + pkg_arch_matrix + ), None) + if(instr['versions'] is not None): + instr['versions'][LIBTORCH_DWNL_INSTR[RELEASE]] = rel_entry_release["installation"] + instr['versions'][LIBTORCH_DWNL_INSTR[DEBUG]] = rel_entry_debug["installation"] + def gen_install_matrix(versions) -> Dict[str, str]: rc = {} @@ -41,8 +160,34 @@ def gen_install_matrix(versions) -> Dict[str, str]: rc[key] = "
".join(lines) return rc + def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + "--version", + help="Version to generate the instructions for", + type=str, + default="preview", + ) + parser.add_argument( + "--autogenerate", + help="Is this call being initiated from workflow? update published_versions", + type=str, + choices=[ENABLE, DISABLE], + default=DISABLE, + ) + + options = parser.parse_args() versions = read_published_versions() + + if options.autogenerate == ENABLE: + release_matrix = {} + for osys in OperatingSystem: + release_matrix[osys.value] = read_matrix_for_os(osys) + + update_versions(versions, release_matrix, options.version) + write_published_versions() + template = read_quick_start_module_template() versions_str = json.dumps(gen_install_matrix(versions)) print(template.replace("{{ installMatrix }}", versions_str)) From fdf8d1a84be78269a9ad9a11c096196dedeb80ec Mon Sep 17 00:00:00 2001 From: atalman Date: Mon, 21 Nov 2022 11:26:00 -0800 Subject: [PATCH 02/17] Fix passing versions to write_published_versions() --- scripts/gen_quick_start_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_quick_start_module.py b/scripts/gen_quick_start_module.py index 711dc5b371de..792b17a7eed3 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -186,7 +186,7 @@ def main(): release_matrix[osys.value] = read_matrix_for_os(osys) update_versions(versions, release_matrix, options.version) - write_published_versions() + write_published_versions(versions) template = read_quick_start_module_template() versions_str = json.dumps(gen_install_matrix(versions)) From fe1c2c6e3809671a156553c1cffee4dab15113ff Mon Sep 17 00:00:00 2001 From: atalman Date: Mon, 21 Nov 2022 13:57:48 -0800 Subject: [PATCH 03/17] test test Refactor quick start module code --- .github/workflows/check-quickstartmodule.yml | 110 ---------- .../workflows/update-quick-start-module.yml | 87 ++++---- _includes/quick-start-module.js | 81 ++++--- _includes/quick_start_local.html | 8 +- assets/quick-start-module.js | 83 ++++---- scripts/gen_published_versions.py | 201 ------------------ scripts/gen_quick_start_module.py | 55 +++-- scripts/test_install.py | 83 -------- scripts/test_libtorch_downloadable.py | 48 ----- 9 files changed, 157 insertions(+), 599 deletions(-) delete mode 100644 .github/workflows/check-quickstartmodule.yml delete mode 100755 scripts/gen_published_versions.py delete mode 100644 scripts/test_install.py delete mode 100755 scripts/test_libtorch_downloadable.py diff --git a/.github/workflows/check-quickstartmodule.yml b/.github/workflows/check-quickstartmodule.yml deleted file mode 100644 index 71f70e7e7a06..000000000000 --- a/.github/workflows/check-quickstartmodule.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Check install matrix -on: - push: - branches: - - site - paths: - - assets/quick-start-module.js - - _includes/quick-start-module.js - - published_versions.json - - scripts/** - - .github/** - pull_request: - paths: - - assets/quick-start-module.js - - _includes/quick-start-module.js - - published_versions.json - - scripts/** - - .github/** - -jobs: - check-regen: - runs-on: ubuntu-18.04 - steps: - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.8 - architecture: x64 - - name: Checkout Pytorch.github.io - uses: actions/checkout@v2 - - name: Regen quick-start-module - run: | - python3 scripts/gen_quick_start_module.py >assets/quick-start-module.js - CHANGES=$(git status --porcelain "assets/quick-start-module.js") - echo "$CHANGES" - [ -z "$CHANGES" ] - - libtorch-downloadable: - runs-on: ubuntu-18.04 - steps: - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.8 - architecture: x64 - - name: Checkout Pytorch.github.io - uses: actions/checkout@v2 - - name: Attempt to download libtorch - run: | - python3 scripts/test_libtorch_downloadable.py - - pip-install: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rel_type: ["latest_stable", "latest_lts"] - acc_type: ["cuda.x", "cuda.y", "accnone"] - py_vers: ["3.7", "3.8", "3.9", "3.10"] - os: ["ubuntu-18.04", "macos-latest", "windows.2022.small"] - exclude: - - rel_type: "latest_lts" - py_vers: "3.10" - - env: - TEST_ACC: ${{ matrix.acc_type }} - TEST_VER: ${{ matrix.rel_type }} - steps: - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.py_vers }} - architecture: x64 - - name: Checkout Pytorch.github.io - uses: actions/checkout@v2 - - name: Test pip3 install - run: | - python3 scripts/test_install.py - if: runner.os != 'Windows' - - name: Test pip3 install on Windows - shell: powershell - run: | - $env:PATH+=';'+$env:pythonLocation - python3.exe scripts/test_install.py - if: runner.os == 'Windows' - - conda-install: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rel_type: ["latest_stable"] - acc_type: ["cuda.x", "cuda.y", "accnone"] - py_vers: ["3.7", "3.8", "3.9", "3.10"] - os: ["ubuntu-18.04", "macos-latest"] - env: - TEST_ACC: ${{ matrix.acc_type }} - TEST_VER: ${{ matrix.rel_type }} - steps: - - name: Setup Conda - uses: conda-incubator/setup-miniconda@v2 - with: - python-version: ${{ matrix.py_vers }} - architecture: x64 - - name: Checkout Pytorch.github.io - uses: actions/checkout@v2 - - name: Test conda install - shell: bash -l {0} - run: | - python3 scripts/test_install.py --conda diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index f162010413a2..b0ca2bc1304c 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -1,50 +1,53 @@ name: Update quick start module on: - workflow_dispatch: - inputs: - channel: - description: "Channel to use (nightly, test, release)" - required: true - type: choice - options: - - release - - nightly - - test - version: - description: "Version to update" - required: false - type: string - + pull_request: + paths: + - .github/workflows/update-quick-start-module.yml + - /scripts/gen_quick_start_module.py jobs: - validate-binaries: - uses: pytorch/builder/.github/workflows/validate-binaries.yml@main + linux-nightly-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main with: - os: all - channel: ${{ inputs.channel }} - linux-matrix: - needs: [validate-binaries] + package-type: all + os: linux + channel: "nightly" + windows-nightly-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: all + os: windows + channel: "nightly" + macos-nightly-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: all + os: macos + channel: "nightly" + linux-release-matrix: + needs: [linux-nightly-matrix] uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main with: package-type: all os: linux - channel: ${{ inputs.channel }} - windows-matrix: - needs: [validate-binaries] + channel: "release" + windows-release-matrix: + needs: [windows-nightly-matrix] uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main with: package-type: all os: windows - channel: ${{ inputs.channel }} - macos-matrix: - needs: [validate-binaries] + channel: "release" + macos-release-matrix: + needs: [macos-nightly-matrix] uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main with: package-type: all os: macos - channel: ${{ inputs.channel }} + channel: "release" generate-json-file: - needs: [linux-matrix, windows-matrix, macos-matrix] + needs: [linux-nightly-matrix, windows-nightly-matrix, macos-nightly-matrix, + linux-release-matrix, windows-release-matrix, macos-release-matrix] runs-on: "ubuntu-18.04" steps: - name: Checkout builder @@ -57,21 +60,21 @@ jobs: - name: Create json file shell: bash env: - LINUX_MATRIX: ${{ needs.linux-matrix.outputs.matrix }} - WINDOWS_MATRIX: ${{ needs.windows-matrix.outputs.matrix }} - MACOS_MATRIX: ${{ needs.macos-matrix.outputs.matrix }} - VERSION: ${{ inputs.version }} + LINUX_NIGHTLY_MATRIX: ${{ needs.linux-nightly-matrix.outputs.matrix }} + WINDOWS_NIGHTLY_MATRIX: ${{ needs.windows-nightly-matrix.outputs.matrix }} + MACOS_NIGHTLY_MATRIX: ${{ needs.macos-nightly-matrix.outputs.matrix }} + LINUX_RELEASE_MATRIX: ${{ needs.linux-release-matrix.outputs.matrix }} + WINDOWS_RELEASE_MATRIX: ${{ needs.windows-release-matrix.outputs.matrix }} + MACOS_RELEASE_MATRIX: ${{ needs.macos-release-matrix.outputs.matrix }} run: | set -ex - printf '%s\n' "$LINUX_MATRIX" > linux_matrix.json - printf '%s\n' "$WINDOWS_MATRIX" > windows_matrix.json - printf '%s\n' "$MACOS_MATRIX" > macos_matrix.json - if [ -z "${VERSION}" ]; then - python3 ./scripts/gen_quick_start_module.py --autogenerate enable - else - python3 ./scripts/gen_quick_start_module.py --autogenerate enable --version "${VERSION}" - fi - + printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json + printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json + printf '%s\n' "$MACOS_NIGHTLY_MATRIX" > macos_nightly_matrix.json + printf '%s\n' "$LINUX_RELEASE_MATRIX" > linux_release_matrix.json + printf '%s\n' "$WINDOWS_RELEASE_MATRIX" > windows_release_matrix.json + printf '%s\n' "$MACOS_RELEASE_MATRIX" > macos_release_matrix.json + python3 ./scripts/gen_quick_start_module.py --autogenerate enable > assets/quick-start-module.js rm *_matrix.json - name: Create Pull Request uses: peter-evans/create-pull-request@v3 diff --git a/_includes/quick-start-module.js b/_includes/quick-start-module.js index 59ba834edbc8..dfc86f163228 100644 --- a/_includes/quick-start-module.js +++ b/_includes/quick-start-module.js @@ -5,13 +5,15 @@ var supportedOperatingSystems = new Map([ ['win', 'windows'], ]); -var supportedComputePlatforms = new Map([ - ['cuda.x', new Set(['linux', 'windows'])], - ['cuda.y', new Set(['linux', 'windows'])], - ['rocm5.x', new Set(['linux'])], - ['accnone', new Set(['linux', 'macos', 'windows'])], +var archInfoMap = new Map([ + ['cuda', {title: "CUDA", platforms: new Set(['linux', 'windows'])}], + ['rocm', {title: "ROCm", platforms: new Set(['linux'])}], + ['accnone', {title: "CPU", platforms: new Set(['linux', 'macos', 'windows'])}] ]); +let version_map={{ ACC ARCH MAP }} +let stable_version={{ VERSION }}; + var default_selected_os = getAnchorSelectedOS() || getDefaultSelectedOS(); var opts = { cuda: getPreferredCuda(default_selected_os), @@ -103,53 +105,39 @@ function getPreferredCuda(os) { // Disable compute platform not supported on OS function disableUnsupportedPlatforms(os) { - supportedComputePlatforms.forEach( (oses, platform, arr) => { - var element = document.getElementById(platform); - if (element == null) { - console.log("Failed to find element for platform " + platform); + for (const [arch_key, info] of archInfoMap) { + var elems = document.querySelectorAll('[id^="'+arch_key+'"]'); + if (elems == null) { + console.log("Failed to find element for architecture " + arch_key); return; } - var supported = oses.has(os); - element.style.textDecoration = supported ? "" : "line-through"; - }); + for (var i=0; i < elems.length;i++) { + var supported = info.platforms.has(os); + elems[i].style.textDecoration = supported ? "" : "line-through"; + } + } } // Change compute versions depending on build type -function changeCUDAVersion(ptbuild) { - var cuda_element_x = document.getElementById("cuda.x"); - var cuda_element_y = document.getElementById("cuda.y"); - var rocm_element = document.getElementById("rocm5.x"); - if (cuda_element_x == null || cuda_element_y == null) { - console.log("Failed to find cuda11 elements"); - return; - } - if (cuda_element_x.childElementCount != 1 || cuda_element_y.childElementCount != 1) { - console.log("Unexpected number of children for cuda11 element"); - return; - } - if (rocm_element == null) { - console.log("Failed to find rocm5.x element"); - return; - } - if (rocm_element.childElementCount != 1) { - console.log("Unexpected number of children for rocm5.x element"); - return; - } - if (ptbuild == "preview") { - rocm_element.children[0].textContent = "ROCm 5.2"; - cuda_element_x.children[0].textContent = "CUDA 11.6"; - cuda_element_y.children[0].textContent = "CUDA 11.7"; - } else if (ptbuild == "stable") { - rocm_element.children[0].textContent = "ROCm 5.2"; - cuda_element_x.children[0].textContent = "CUDA 11.6"; - cuda_element_y.children[0].textContent = "CUDA 11.7"; - } else { - rocm_element.children[0].textContent = "ROCm 5.2"; - cuda_element_x.children[0].textContent = "CUDA 10.2"; - cuda_element_y.children[0].textContent = "CUDA 11.1"; +function changeVersion(ptbuild) { + + if(ptbuild == "preview") + archMap = version_map.nightly + else + archMap = version_map.release + + for (const [arch_key, info] of archInfoMap) { + var elems = document.querySelectorAll('[id^="'+arch_key+'"]'); + for (var i=0; i < elems.length;i++) { + elems[i].children[0].textContent = info.title + " " + archMap[elems[i].id][1] + } } + var stable_element = document.getElementById("stable"); + stable_element.children[0].textContent = stable_version; } + + // Change accnone name depending on OS type function changeAccNoneName(osname) { var accnone_element = document.getElementById("accnone"); @@ -201,7 +189,7 @@ function selectedOption(option, selection, category) { } } } else if (category == "ptbuild") { - changeCUDAVersion(opts.ptbuild); + changeVersion(opts.ptbuild); } commandMessage(buildMatcher()); if (category === "os") { @@ -272,3 +260,6 @@ function commandMessage(key) { $("#command").html("
" + object[key] + "
"); } } + +// Set cuda version right away +changeVersion("stable") diff --git a/_includes/quick_start_local.html b/_includes/quick_start_local.html index f7b065a41bd9..3c79122170be 100644 --- a/_includes/quick_start_local.html +++ b/_includes/quick_start_local.html @@ -33,7 +33,7 @@
PyTorch Build
-
Stable (1.13.0)
+
Stable (X.XX.X)
Preview (Nightly)
@@ -86,13 +86,13 @@
Compute Platform
-
CUDA 11.6
+
CUDA 11.x
-
CUDA 11.7
+
CUDA 11.y
-
ROCm 5.2
+
ROCm 5.x
CPU
diff --git a/assets/quick-start-module.js b/assets/quick-start-module.js index 0d2880aaabe9..95549e6097f3 100644 --- a/assets/quick-start-module.js +++ b/assets/quick-start-module.js @@ -5,13 +5,15 @@ var supportedOperatingSystems = new Map([ ['win', 'windows'], ]); -var supportedComputePlatforms = new Map([ - ['cuda.x', new Set(['linux', 'windows'])], - ['cuda.y', new Set(['linux', 'windows'])], - ['rocm5.x', new Set(['linux'])], - ['accnone', new Set(['linux', 'macos', 'windows'])], +var archInfoMap = new Map([ + ['cuda', {title: "CUDA", platforms: new Set(['linux', 'windows'])}], + ['rocm', {title: "ROCm", platforms: new Set(['linux'])}], + ['accnone', {title: "CPU", platforms: new Set(['linux', 'macos', 'windows'])}] ]); +let version_map={"nightly": {"accnone": ["cpu", ""], "cuda.x": ["cuda", "11.6"], "cuda.y": ["cuda", "11.7"], "rocm5.x": ["rocm", "5.2"]}, "release": {"accnone": ["cpu", ""], "cuda.x": ["cuda", "11.6"], "cuda.y": ["cuda", "11.7"], "rocm5.x": ["rocm", "5.2"]}} +let stable_version="Stable (1.13.0)"; + var default_selected_os = getAnchorSelectedOS() || getDefaultSelectedOS(); var opts = { cuda: getPreferredCuda(default_selected_os), @@ -103,53 +105,39 @@ function getPreferredCuda(os) { // Disable compute platform not supported on OS function disableUnsupportedPlatforms(os) { - supportedComputePlatforms.forEach( (oses, platform, arr) => { - var element = document.getElementById(platform); - if (element == null) { - console.log("Failed to find element for platform " + platform); + for (const [arch_key, info] of archInfoMap) { + var elems = document.querySelectorAll('[id^="'+arch_key+'"]'); + if (elems == null) { + console.log("Failed to find element for architecture " + arch_key); return; } - var supported = oses.has(os); - element.style.textDecoration = supported ? "" : "line-through"; - }); + for (var i=0; i < elems.length;i++) { + var supported = info.platforms.has(os); + elems[i].style.textDecoration = supported ? "" : "line-through"; + } + } } // Change compute versions depending on build type -function changeCUDAVersion(ptbuild) { - var cuda_element_x = document.getElementById("cuda.x"); - var cuda_element_y = document.getElementById("cuda.y"); - var rocm_element = document.getElementById("rocm5.x"); - if (cuda_element_x == null || cuda_element_y == null) { - console.log("Failed to find cuda11 elements"); - return; - } - if (cuda_element_x.childElementCount != 1 || cuda_element_y.childElementCount != 1) { - console.log("Unexpected number of children for cuda11 element"); - return; - } - if (rocm_element == null) { - console.log("Failed to find rocm5.x element"); - return; - } - if (rocm_element.childElementCount != 1) { - console.log("Unexpected number of children for rocm5.x element"); - return; - } - if (ptbuild == "preview") { - rocm_element.children[0].textContent = "ROCm 5.2"; - cuda_element_x.children[0].textContent = "CUDA 11.6"; - cuda_element_y.children[0].textContent = "CUDA 11.7"; - } else if (ptbuild == "stable") { - rocm_element.children[0].textContent = "ROCm 5.2"; - cuda_element_x.children[0].textContent = "CUDA 11.6"; - cuda_element_y.children[0].textContent = "CUDA 11.7"; - } else { - rocm_element.children[0].textContent = "ROCm 5.2"; - cuda_element_x.children[0].textContent = "CUDA 10.2"; - cuda_element_y.children[0].textContent = "CUDA 11.1"; +function changeVersion(ptbuild) { + + if(ptbuild == "preview") + archMap = version_map.nightly + else + archMap = version_map.release + + for (const [arch_key, info] of archInfoMap) { + var elems = document.querySelectorAll('[id^="'+arch_key+'"]'); + for (var i=0; i < elems.length;i++) { + elems[i].children[0].textContent = info.title + " " + archMap[elems[i].id][1] + } } + var stable_element = document.getElementById("stable"); + stable_element.children[0].textContent = stable_version; } + + // Change accnone name depending on OS type function changeAccNoneName(osname) { var accnone_element = document.getElementById("accnone"); @@ -201,7 +189,7 @@ function selectedOption(option, selection, category) { } } } else if (category == "ptbuild") { - changeCUDAVersion(opts.ptbuild); + changeVersion(opts.ptbuild); } commandMessage(buildMatcher()); if (category === "os") { @@ -260,7 +248,7 @@ $("[data-toggle='cloud-dropdown']").on("click", function(e) { }); function commandMessage(key) { - var object = {"preview,pip,linux,accnone,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,linux,cuda.x,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu116", "preview,pip,linux,cuda.y,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu117", "preview,pip,linux,rocm5.x,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.2/", "preview,conda,linux,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch-nightly -c nvidia", "preview,conda,linux,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch-nightly -c nvidia", "preview,conda,linux,rocm5.x,python": "NOTE: Conda packages are not currently available for ROCm, please use pip instead
", "preview,conda,linux,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,linux,accnone,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-cxx11-abi-shared-with-deps-latest.zip", "preview,libtorch,linux,cuda.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-shared-with-deps-latest.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-cxx11-abi-shared-with-deps-latest.zip", "preview,libtorch,linux,cuda.y,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-shared-with-deps-latest.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-cxx11-abi-shared-with-deps-latest.zip", "preview,libtorch,linux,rocm5.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/rocm5.2/libtorch-shared-with-deps-latest.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/rocm5.2/libtorch-cxx11-abi-shared-with-deps-latest.zip", "preview,pip,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,conda,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package
conda install pytorch torchvision torchaudio -c pytorch-nightly", "preview,conda,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package
conda install pytorch torchvision torchaudio -c pytorch-nightly", "preview,conda,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package
conda install pytorch torchvision torchaudio -c pytorch-nightly", "preview,conda,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+
conda install pytorch torchvision torchaudio -c pytorch-nightly", "preview,libtorch,macos,accnone,cplusplus": "Download here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,cuda.x,cplusplus": "MacOS binaries do not support CUDA. Download default libtorch here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,cuda.y,cplusplus": "MacOS binaries do not support CUDA. Download CPU libtorch here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,rocm5.x,cplusplus": "ROCm is not available on MacOS. Download default libtorch here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,pip,windows,accnone,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,windows,cuda.x,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu116", "preview,pip,windows,cuda.y,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu117", "preview,pip,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "preview,conda,windows,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch-nightly -c nvidia", "preview,conda,windows,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch-nightly -c nvidia", "preview,conda,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "preview,conda,windows,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,windows,accnone,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-latest.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-debug-latest.zip", "preview,libtorch,windows,cuda.x,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-win-shared-with-deps-latest.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-win-shared-with-deps-debug-latest.zip", "preview,libtorch,windows,cuda.y,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-win-shared-with-deps-latest.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-win-shared-with-deps-debug-latest.zip", "preview,libtorch,windows,rocm5.x,cplusplus": "NOTE: ROCm is not available on Windows", "stable,pip,linux,accnone,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu", "stable,pip,linux,cuda.x,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116", "stable,pip,linux,cuda.y,python": "pip3 install torch torchvision torchaudio", "stable,pip,linux,rocm5.x,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.2/", "stable,conda,linux,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia", "stable,conda,linux,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia", "stable,conda,linux,rocm5.x,python": "NOTE: Conda packages are not currently available for ROCm, please use pip instead
", "stable,conda,linux,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,linux,accnone,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.13.0%2Bcpu.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcpu.zip", "stable,libtorch,linux,cuda.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/cu116/libtorch-shared-with-deps-1.13.0%2Bcu116.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/cu116/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu116.zip", "stable,libtorch,linux,cuda.y,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/cu117/libtorch-shared-with-deps-1.13.0%2Bcu117.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/cu117/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu117.zip", "stable,libtorch,linux,rocm5.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/rocm5.2/libtorch-shared-with-deps-1.13.0%2Brocm5.2.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/rocm5.2/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Brocm5.2.zip", "stable,pip,macos,cuda.x,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
pip3 install torch torchvision torchaudio", "stable,pip,macos,cuda.y,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
pip3 install torch torchvision torchaudio", "stable,pip,macos,rocm5.x,python": "NOTE: ROCm is not available on MacOS", "stable,pip,macos,accnone,python": "pip3 install torch torchvision torchaudio", "stable,conda,macos,cuda.x,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
conda install pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,cuda.y,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
conda install pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,rocm5.x,python": "NOTE: ROCm is not available on MacOS", "stable,conda,macos,accnone,python": "conda install pytorch torchvision torchaudio -c pytorch", "stable,libtorch,macos,accnone,cplusplus": "Download here:
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip", "stable,libtorch,macos,cuda.x,cplusplus": "MacOS binaries do not support CUDA. Download CPU libtorch here:
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip", "stable,libtorch,macos,cuda.y,cplusplus": "MacOS binaries do not support CUDA. Download CPU libtorch here:
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip", "stable,libtorch,macos,rocm5.x,cplusplus": "NOTE: ROCm is not available on MacOS", "stable,pip,windows,accnone,python": "pip3 install torch torchvision torchaudio", "stable,pip,windows,cuda.x,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116", "stable,pip,windows,cuda.y,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117", "stable,pip,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "stable,conda,windows,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia", "stable,conda,windows,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia", "stable,conda,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "stable,conda,windows,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,windows,accnone,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.13.0%2Bcpu.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.13.0%2Bcpu.zip", "stable,libtorch,windows,cuda.x,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-1.13.0%2Bcu116.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-debug-1.13.0%2Bcu116.zip", "stable,libtorch,windows,cuda.y,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-1.13.0%2Bcu117.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-debug-1.13.0%2Bcu117.zip", "stable,libtorch,windows,rocm5.x,cplusplus": "NOTE: ROCm is not available on Windows"}; + var object = {"preview,pip,linux,accnone,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,linux,cuda.x,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu116", "preview,pip,linux,cuda.y,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu117", "preview,pip,linux,rocm5.x,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.2", "preview,conda,linux,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch-nightly -c nvidia", "preview,conda,linux,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch-nightly -c nvidia", "preview,conda,linux,rocm5.x,python": "NOTE: Conda packages are not currently available for ROCm, please use pip instead
", "preview,conda,linux,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,linux,accnone,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-1.13.0%2Bcpu.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcpu.zip", "preview,libtorch,linux,cuda.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-shared-with-deps-1.13.0%2Bcu116.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu116.zip", "preview,libtorch,linux,cuda.y,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-shared-with-deps-1.13.0%2Bcu117.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu117.zip", "preview,libtorch,linux,rocm5.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/rocm5.2/libtorch-shared-with-deps-1.13.0%2Brocm5.2.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/nightly/rocm5.2/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Brocm5.2.zip", "preview,pip,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,conda,macos,cuda.x,python": "# CUDA is not available on MacOS, please use default package
conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,conda,macos,cuda.y,python": "# CUDA is not available on MacOS, please use default package
conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,conda,macos,rocm5.x,python": "# ROCm is not available on MacOS, please use default package
conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,conda,macos,accnone,python": "# MPS acceleration is available on MacOS 12.3+
conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,macos,accnone,cplusplus": "Download here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,cuda.x,cplusplus": "MacOS binaries do not support CUDA. Download default libtorch here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,cuda.y,cplusplus": "MacOS binaries do not support CUDA. Download CPU libtorch here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,rocm5.x,cplusplus": "ROCm is not available on MacOS. Download default libtorch here:
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,pip,windows,accnone,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu", "preview,pip,windows,cuda.x,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu116", "preview,pip,windows,cuda.y,python": "pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu117", "preview,pip,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "preview,conda,windows,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch-nightly -c nvidia", "preview,conda,windows,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch-nightly -c nvidia", "preview,conda,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "preview,conda,windows,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch-nightly", "preview,libtorch,windows,accnone,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-latest.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-debug-latest.zip", "preview,libtorch,windows,cuda.x,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-win-shared-with-deps-latest.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/nightly/cu116/libtorch-win-shared-with-deps-debug-latest.zip", "preview,libtorch,windows,cuda.y,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-win-shared-with-deps-latest.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/nightly/cu117/libtorch-win-shared-with-deps-debug-latest.zip", "preview,libtorch,windows,rocm5.x,cplusplus": "NOTE: ROCm is not available on Windows", "stable,pip,linux,accnone,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu", "stable,pip,linux,cuda.x,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116", "stable,pip,linux,cuda.y,python": "pip3 install torch torchvision torchaudio", "stable,pip,linux,rocm5.x,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.2", "stable,conda,linux,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia", "stable,conda,linux,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia", "stable,conda,linux,rocm5.x,python": "NOTE: Conda packages are not currently available for ROCm, please use pip instead
", "stable,conda,linux,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,linux,accnone,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.13.0%2Bcpu.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcpu.zip", "stable,libtorch,linux,cuda.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/cu116/libtorch-shared-with-deps-1.13.0%2Bcu116.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/cu116/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu116.zip", "stable,libtorch,linux,cuda.y,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/cu117/libtorch-shared-with-deps-1.13.0%2Bcu117.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/cu117/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcu117.zip", "stable,libtorch,linux,rocm5.x,cplusplus": "Download here (Pre-cxx11 ABI):
https://download.pytorch.org/libtorch/rocm5.2/libtorch-shared-with-deps-1.13.0%2Brocm5.2.zip
Download here (cxx11 ABI):
https://download.pytorch.org/libtorch/rocm5.2/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Brocm5.2.zip", "stable,pip,macos,cuda.x,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
pip3 install torch torchvision torchaudio", "stable,pip,macos,cuda.y,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
pip3 install torch torchvision torchaudio", "stable,pip,macos,rocm5.x,python": "NOTE: ROCm is not available on MacOS", "stable,pip,macos,accnone,python": "pip3 install torch torchvision torchaudio", "stable,conda,macos,cuda.x,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
conda install pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,cuda.y,python": "# MacOS Binaries dont support CUDA, install from source if CUDA is needed
conda install pytorch torchvision torchaudio -c pytorch", "stable,conda,macos,rocm5.x,python": "NOTE: ROCm is not available on MacOS", "stable,conda,macos,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,macos,accnone,cplusplus": "Download here:
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip", "stable,libtorch,macos,cuda.x,cplusplus": "MacOS binaries do not support CUDA. Download CPU libtorch here:
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip", "stable,libtorch,macos,cuda.y,cplusplus": "MacOS binaries do not support CUDA. Download CPU libtorch here:
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip", "stable,libtorch,macos,rocm5.x,cplusplus": "NOTE: ROCm is not available on MacOS", "stable,pip,windows,accnone,python": "pip3 install torch torchvision torchaudio", "stable,pip,windows,cuda.x,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116", "stable,pip,windows,cuda.y,python": "pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117", "stable,pip,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "stable,conda,windows,cuda.x,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia", "stable,conda,windows,cuda.y,python": "conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia", "stable,conda,windows,rocm5.x,python": "NOTE: ROCm is not available on Windows", "stable,conda,windows,accnone,python": "conda install pytorch torchvision torchaudio cpuonly -c pytorch", "stable,libtorch,windows,accnone,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.13.0%2Bcpu.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.13.0%2Bcpu.zip", "stable,libtorch,windows,cuda.x,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-1.13.0%2Bcu116.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-debug-1.13.0%2Bcu116.zip", "stable,libtorch,windows,cuda.y,cplusplus": "Download here (Release version):
https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-1.13.0%2Bcu117.zip
Download here (Debug version):
https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-debug-1.13.0%2Bcu117.zip", "stable,libtorch,windows,rocm5.x,cplusplus": "NOTE: ROCm is not available on Windows"}; if (!object.hasOwnProperty(key)) { $("#command").html( @@ -273,3 +261,6 @@ function commandMessage(key) { } } +// Set cuda version right away +changeVersion("stable") + diff --git a/scripts/gen_published_versions.py b/scripts/gen_published_versions.py deleted file mode 100755 index cde1970f9d09..000000000000 --- a/scripts/gen_published_versions.py +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/env python3 -# Generates published versions based on unstructured quick-start-module - -import json -from urllib.request import urlopen -from typing import Any, Dict, Optional, Union - - -class ConfigStr: - version: str - conf_type: str - os: str - accel: str - extra: str - - @staticmethod - def parse(val: str) -> "ConfigStr": - vals = val.split(",") - assert len(vals) == 5 - rc = ConfigStr() - for k, v in zip(["version", "conf_type", "os", "accel", "extra"], vals): - rc.__setattr__(k, v) - return rc - - def __repr__(self) -> str: - return self.__dict__.__repr__() - - -class LibTorchInstruction: - note: Optional[str] - versions: Union[Dict[str, str], str, None] - - def __init__(self, note: Optional[str] = None, versions: Union[Dict[str, str], str, None] = None) -> None: - self.note = note - self.versions = versions - - @staticmethod - def parse(val: str) -> "LibTorchInstruction": - import re - href_pattern = re.compile("([^<]*)") - line_separator = "
" - lines = val.split(line_separator) - versions = {} - idx_to_delete = set() - for idx, line in enumerate(lines): - url = href_pattern.findall(line) - if len(url) == 0: - continue - # There should be only one URL per line and value inside and outside of URL shoudl match - assert len(url) == 1 - assert url[0][0] == url[0][1].rstrip(), url - versions[lines[idx - 1].strip()] = url[0][0] - idx_to_delete.add(idx - 1) - idx_to_delete.add(idx) - lines = [lines[idx] for idx in range(len(lines)) if idx not in idx_to_delete] - if len(lines) == 1 and len(lines[0]) == 0: - lines = [] - return LibTorchInstruction(note=line_separator.join(lines) if len(lines) > 0 else None, - versions=versions if len(versions) > 0 else None) - - def __repr__(self) -> str: - return self.__dict__.__repr__() - - -class PyTorchInstruction: - note: Optional[str] - command: Optional[str] - - def __init__(self, note: Optional[str] = None, command: Optional[str] = None) -> None: - self.note = note - self.command = command - - @staticmethod - def parse(val: str) -> "PyTorchInstruction": - def is_cmd(cmd: str) -> bool: - return cmd.startswith("pip3 install") or cmd.startswith("conda install") - line_separator = "
" - lines = val.split(line_separator) - if is_cmd(lines[-1]): - note = line_separator.join(lines[:-1]) if len(lines) > 1 else None - command = lines[-1] - elif is_cmd(lines[0]): - note = line_separator.join(lines[1:]) if len(lines) > 1 else None - command = lines[0] - else: - note = val - command = None - return PyTorchInstruction(note=note, command=command) - - def __repr__(self) -> str: - return self.__dict__.__repr__() - - -class PublishedAccVersion: - libtorch: Dict[str, LibTorchInstruction] - conda: Dict[str, PyTorchInstruction] - pip: Dict[str, PyTorchInstruction] - - def __init__(self): - self.pip = dict() - self.conda = dict() - self.libtorch = dict() - - def __repr__(self) -> str: - return self.__dict__.__repr__() - - def add_instruction(self, conf: ConfigStr, val: str) -> None: - if conf.conf_type == "libtorch": - self.libtorch[conf.accel] = LibTorchInstruction.parse(val) - elif conf.conf_type == "conda": - self.conda[conf.accel] = PyTorchInstruction.parse(val) - elif conf.conf_type == "pip": - self.pip[conf.accel] = PyTorchInstruction.parse(val) - else: - raise RuntimeError(f"Unknown config type {conf.conf_type}") - - -class PublishedOSVersion: - linux: PublishedAccVersion - macos: PublishedAccVersion - windows: PublishedAccVersion - - def __init__(self): - self.linux = PublishedAccVersion() - self.macos = PublishedAccVersion() - self.windows = PublishedAccVersion() - - def add_instruction(self, conf: ConfigStr, val: str) -> None: - if conf.os == "linux": - self.linux.add_instruction(conf, val) - elif conf.os == "macos": - self.macos.add_instruction(conf, val) - elif conf.os == "windows": - self.windows.add_instruction(conf, val) - else: - raise RuntimeError(f"Unknown os type {conf.os}") - - def __repr__(self) -> str: - return self.__dict__.__repr__() - - -class PublishedVersions: - latest_stable: str - latest_lts: str - versions: Dict[str, PublishedOSVersion] = dict() - - def __init__(self, latest_stable: str, latest_lts: str) -> None: - self.latest_stable = latest_stable - self.latest_lts = latest_lts - self.versions = dict() - - def parse_objects(self, objects: Dict[str, str]) -> None: - for key, val in objects.items(): - conf = ConfigStr.parse(key) - if conf.version not in self.versions: - self.versions[conf.version] = PublishedOSVersion() - self.versions[conf.version].add_instruction(conf, val) - if 'stable' in self.versions: - self.versions[self.latest_stable] = self.versions.pop('stable') - if 'lts' in self.versions: - self.versions[self.latest_lts] = self.versions.pop('lts') - - -def get_objects(commit_hash: str = "0ba2a203045bc94d165d52e56c87ceaa463f4284") -> Dict[str, str]: - """ - Extract install commands as they are currently hardcoded - in pytorch.github.io/assets/quick-start-module.js - """ - raw_base = "raw.githubusercontent.com" - obj_start = "var object = {" - obj_end = "};" - with urlopen(f"https://{raw_base}/pytorch/pytorch.github.io/{commit_hash}/assets/quick-start-module.js") as url: - raw_data = url.read().decode("latin1") - start_idx = raw_data.find(obj_start) - end_idx = raw_data.find(obj_end, start_idx) - # Adjust start end end indexes - start_idx = raw_data.find("{", start_idx, end_idx) - end_idx = raw_data.rfind('"', start_idx, end_idx) - if any(x < 0 for x in [start_idx, end_idx]): - raise RuntimeError("Unexpected raw_data") - return json.loads(raw_data[start_idx:end_idx] + '"}') - - -def dump_to_file(fname: str, o: Any) -> None: - class DictEncoder(json.JSONEncoder): - def default(self, o): - return o.__dict__ - - with open(fname, "w") as fp: - json.dump(o, fp, indent=2, cls=DictEncoder) - - -def main() -> None: - install_objects = get_objects() - rc = PublishedVersions(latest_stable="1.9.0", latest_lts="lts-1.8.2") - rc.parse_objects(install_objects) - dump_to_file("published_versions.json", rc) - - -if __name__ == "__main__": - main() diff --git a/scripts/gen_quick_start_module.py b/scripts/gen_quick_start_module.py index 792b17a7eed3..0a380ea91eb2 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -27,11 +27,20 @@ class OperatingSystem(Enum): # TBD drive the mapping via: # 1. Scanning release matrix and picking 2 latest cuda versions and 1 latest rocm # 2. Possibility to override the scanning algorithm with arguments passed from workflow -acc_arch_map = { + +acc_arch_ver_map = { + "nightly": { + "accnone": ("cpu", ""), + "cuda.x": ("cuda", "11.6"), + "cuda.y": ("cuda", "11.7"), + "rocm5.x": ("rocm", "5.2") + }, + "release": { "accnone": ("cpu", ""), "cuda.x": ("cuda", "11.6"), "cuda.y": ("cuda", "11.7"), "rocm5.x": ("rocm", "5.2") + } } LIBTORCH_DWNL_INSTR = { @@ -49,9 +58,9 @@ def write_published_versions(versions): with open(os.path.join(BASE_DIR, "published_versions.json"), "w") as outfile: json.dump(versions, outfile, indent=2) -def read_matrix_for_os(osys: OperatingSystem): +def read_matrix_for_os(osys: OperatingSystem, value: str): try: - with open(os.path.join(BASE_DIR, f"{osys.value}_matrix.json")) as fp: + with open(os.path.join(BASE_DIR, f"{osys.value}_{value}_matrix.json")) as fp: return json.load(fp)["include"] except FileNotFoundError as e: raise ImportError(f"Release matrix not found for: {osys.value} error: {e.strerror}") from e @@ -61,20 +70,24 @@ def read_quick_start_module_template(): with open(os.path.join(BASE_DIR, "_includes", "quick-start-module.js")) as fp: return fp.read() -def update_versions(versions, release_matrix, version): +def update_versions(versions, release_matrix, release_version): version_map = { "preview": "preview", } + version = "" + acc_arch_map = acc_arch_ver_map[release_version] + + if(release_version == "nightly"): + version = "preview" + else: + version = release_matrix[OperatingSystem.LINUX.value][0]["stable_version"] # Generating for a specific version if(version != "preview"): version_map = { version: version, } - if version in versions["versions"]: - if version != versions["latest_stable"]: - raise RuntimeError(f"Can only update prview, latest stable: {versions['latest_stable']} or new version") - else: + if version not in versions["versions"]: import copy new_version = copy.deepcopy(versions["versions"]["preview"]) versions["versions"][version] = new_version @@ -160,37 +173,39 @@ def gen_install_matrix(versions) -> Dict[str, str]: rc[key] = "
".join(lines) return rc - def main(): parser = argparse.ArgumentParser() - parser.add_argument( - "--version", - help="Version to generate the instructions for", - type=str, - default="preview", - ) parser.add_argument( "--autogenerate", help="Is this call being initiated from workflow? update published_versions", type=str, choices=[ENABLE, DISABLE], - default=DISABLE, + default=ENABLE, ) options = parser.parse_args() versions = read_published_versions() + if options.autogenerate == ENABLE: release_matrix = {} - for osys in OperatingSystem: - release_matrix[osys.value] = read_matrix_for_os(osys) + for val in ("nightly", "release"): + release_matrix[val] = {} + for osys in OperatingSystem: + release_matrix[val][osys.value] = read_matrix_for_os(osys, val) + + for val in ("nightly", "release"): + update_versions(versions, release_matrix[val], val) - update_versions(versions, release_matrix, options.version) write_published_versions(versions) + template = read_quick_start_module_template() versions_str = json.dumps(gen_install_matrix(versions)) - print(template.replace("{{ installMatrix }}", versions_str)) + template = template.replace("{{ installMatrix }}", versions_str) + template = template.replace("{{ VERSION }}", f"\"Stable ({versions['latest_stable']})\"") + print(template.replace("{{ ACC ARCH MAP }}", json.dumps(acc_arch_ver_map))) + if __name__ == "__main__": diff --git a/scripts/test_install.py b/scripts/test_install.py deleted file mode 100644 index b22156a0fe88..000000000000 --- a/scripts/test_install.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 - -def read_published_versions(): - import json - import os - base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - with open(os.path.join(base_dir, "published_versions.json")) as fp: - return json.load(fp) - - -def get_os() -> str: - import sys - if sys.platform.startswith("darwin"): - return "macos" - if sys.platform.startswith("linux"): - return "linux" - if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): - return "windows" - raise RuntimeError(f"Unknown platform {sys.platform}") - - -def get_acc() -> str: - import os - return os.getenv("TEST_ACC", "accnone") - - -def get_ver() -> str: - import os - return os.getenv("TEST_VER", "latest_stable") - - -def get_pkg_type() -> str: - import sys - if len(sys.argv) > 1 and sys.argv[1] == "--conda": - return "conda" - return "pip" - - -def main() -> None: - import subprocess - import sys - published_versions = read_published_versions() - - os = get_os() - acc = get_acc() - pkg_type = get_pkg_type() - version = get_ver() - if version in ["latest_lts", "latest_stable"]: - version = published_versions[version] - - versions = published_versions["versions"][version] - pkg_vers = versions[os][pkg_type] - acc_vers = pkg_vers[acc] - note, cmd = acc_vers["note"], acc_vers["command"] - if cmd is None: - print(note) - sys.exit(0) - # Check that PyTorch + Domains are installable - print(f"Installing PyTorch {version} + {acc} using {pkg_type} and Python {sys.version}") - if pkg_type == "pip": - cmd_args = [sys.executable] + cmd.split(" ") - cmd_args[1] = "-mpip" - subprocess.check_call(cmd_args) - else: - assert pkg_type == "conda" - args = cmd.split(" ") - # Add `-y` argument - for idx, arg in enumerate(args): - if arg == "install": - args.insert(idx +1, "-y") - subprocess.check_call(args) - - # Check that torch is importable after install - subprocess.check_call([sys.executable, "-c", "import torch;print('PyTorch version is ', torch.__version__)"]) - subprocess.check_call([sys.executable, "-c", "import torchvision;print('torchvision version is ', torchvision.__version__)"]) - subprocess.check_call([sys.executable, - "-c", - "import torch;import torchvision;print('Is torchvision useable?', all(x is not None for x in [torch.ops.image.decode_png, torch.ops.torchvision.roi_align]))" - ]) - - -if __name__ == "__main__": - main() diff --git a/scripts/test_libtorch_downloadable.py b/scripts/test_libtorch_downloadable.py deleted file mode 100755 index 2ef6335f445e..000000000000 --- a/scripts/test_libtorch_downloadable.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python3 -# Tests libtorch is downloadable - -import sys - - -def check_url_downloadable(url: str) -> bool: - from urllib.request import Request, urlopen - req = Request(url, method="HEAD") - try: - with urlopen(req): - return True - except: - pass - return False - - -def read_published_versions(): - import json - import os - base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - with open(os.path.join(base_dir, "published_versions.json")) as fp: - return json.load(fp) - - -def main() -> None: - versions = read_published_versions() - for ver in [versions["latest_stable"], versions["latest_lts"]]: - for os, os_vers in versions["versions"][ver].items(): - for acc, acc_vers in os_vers["libtorch"].items(): - vers = acc_vers["versions"] - if vers is None: - continue - if isinstance(vers, str): - if not check_url_downloadable(vers): - print(f"Can not download libtorch at url {vers}") - sys.exit(-1) - print(f"{vers} can be downloaded") - assert isinstance(vers, dict) - for name, url in vers.items(): - if not check_url_downloadable(url): - print(f"Can not download libtorch at url {url}") - sys.exit(-1) - print(f"{url} can be downloaded") - - -if __name__ == "__main__": - main() From 4fa56772c86d820c3375f019f775aee5b57a2d85 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 09:37:11 -0800 Subject: [PATCH 04/17] refactor --- _includes/quick-start-module.js | 2 +- assets/quick-start-module.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/quick-start-module.js b/_includes/quick-start-module.js index dfc86f163228..e61b3b8f1687 100644 --- a/_includes/quick-start-module.js +++ b/_includes/quick-start-module.js @@ -100,7 +100,7 @@ function getPreferredCuda(os) { if (os == 'macos') { return 'accnone'; } - return 'cuda11.6'; + return 'cuda.x'; } // Disable compute platform not supported on OS diff --git a/assets/quick-start-module.js b/assets/quick-start-module.js index 95549e6097f3..0d215c6414a9 100644 --- a/assets/quick-start-module.js +++ b/assets/quick-start-module.js @@ -100,7 +100,7 @@ function getPreferredCuda(os) { if (os == 'macos') { return 'accnone'; } - return 'cuda11.6'; + return 'cuda.x'; } // Disable compute platform not supported on OS From 3482a9927012b6b2266501d13f432ac375bbb373 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 09:43:59 -0800 Subject: [PATCH 05/17] Add validate quick start module workflow --- .../workflows/validate-quick-start-module.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/validate-quick-start-module.yml diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml new file mode 100644 index 000000000000..e745636715d1 --- /dev/null +++ b/.github/workflows/validate-quick-start-module.yml @@ -0,0 +1,21 @@ +name: Validate quick start module +on: + pull_request: + paths: + - published_versions.json + - assets/quick-start-module.js + - .github/workflows/validate-quick-start-module.yml +jobs: + validate-nightly-binaries: + uses: pytorch/builder/.github/workflows/validate-binaries.yml@main + with: + os: all + channel: "nightly" + ref: main + validate-release-binaries: + uses: pytorch/builder/.github/workflows/validate-binaries.yml@main + needs: validate-nightly-binaries + with: + os: all + channel: "release" + ref: main From 4a2baee6f1535d5754b2bacfb829a41827067fa4 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 10:04:17 -0800 Subject: [PATCH 06/17] Adding update quick start module on push --- .github/workflows/update-quick-start-module.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index b0ca2bc1304c..0e52795a437f 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -4,6 +4,13 @@ on: paths: - .github/workflows/update-quick-start-module.yml - /scripts/gen_quick_start_module.py + push: + branches: + site + paths: + - .github/workflows/update-quick-start-module.yml + - /scripts/gen_quick_start_module.py + jobs: linux-nightly-matrix: uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main From acc868b1e6c822bc821d98c91a12f1eb2d360d2b Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 10:09:43 -0800 Subject: [PATCH 07/17] Validate quick start module --- .github/workflows/validate-quick-start-module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml index e745636715d1..3d80a3d9e914 100644 --- a/.github/workflows/validate-quick-start-module.yml +++ b/.github/workflows/validate-quick-start-module.yml @@ -3,7 +3,7 @@ on: pull_request: paths: - published_versions.json - - assets/quick-start-module.js + - /assets/quick-start-module.js - .github/workflows/validate-quick-start-module.yml jobs: validate-nightly-binaries: From d5d5a7b89f34f6fdfb0ebc1ff06348618012896c Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 10:10:37 -0800 Subject: [PATCH 08/17] testing --- .github/workflows/validate-quick-start-module.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml index 3d80a3d9e914..4115f2910440 100644 --- a/.github/workflows/validate-quick-start-module.yml +++ b/.github/workflows/validate-quick-start-module.yml @@ -5,6 +5,12 @@ on: - published_versions.json - /assets/quick-start-module.js - .github/workflows/validate-quick-start-module.yml + push: + branches: + site + paths: + - published_versions.json + - /assets/quick-start-module.js jobs: validate-nightly-binaries: uses: pytorch/builder/.github/workflows/validate-binaries.yml@main From 1bbc640a1b5cc8fc6590cd08a0d9215e5769e393 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 10:12:47 -0800 Subject: [PATCH 09/17] testing --- .github/workflows/validate-quick-start-module.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml index 4115f2910440..2bc0457a0680 100644 --- a/.github/workflows/validate-quick-start-module.yml +++ b/.github/workflows/validate-quick-start-module.yml @@ -11,6 +11,7 @@ on: paths: - published_versions.json - /assets/quick-start-module.js + - .github/workflows/validate-quick-start-module.yml jobs: validate-nightly-binaries: uses: pytorch/builder/.github/workflows/validate-binaries.yml@main From b1d23a0d029cd87b51c4dd6e570311d43a4534b2 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 10:25:09 -0800 Subject: [PATCH 10/17] workflow changes --- .github/workflows/update-quick-start-module.yml | 4 ++++ .github/workflows/validate-quick-start-module.yml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index 0e52795a437f..d2b15fd68085 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -1,5 +1,8 @@ name: Update quick start module on: + schedule: + # At 18:30 pm UTC (1:30 pm EST) + - cron: "30 18 * * *" pull_request: paths: - .github/workflows/update-quick-start-module.yml @@ -10,6 +13,7 @@ on: paths: - .github/workflows/update-quick-start-module.yml - /scripts/gen_quick_start_module.py + workflow_dispatch: jobs: linux-nightly-matrix: diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml index 2bc0457a0680..0f8603757ca5 100644 --- a/.github/workflows/validate-quick-start-module.yml +++ b/.github/workflows/validate-quick-start-module.yml @@ -12,6 +12,8 @@ on: - published_versions.json - /assets/quick-start-module.js - .github/workflows/validate-quick-start-module.yml + workflow_dispatch: + jobs: validate-nightly-binaries: uses: pytorch/builder/.github/workflows/validate-binaries.yml@main From 6f119607cc70707d02854a2ea5d5e07b494b3cd9 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 10:38:09 -0800 Subject: [PATCH 11/17] Add action when update job fails --- .github/workflows/update-quick-start-module.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index d2b15fd68085..86f9e3625379 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -87,6 +87,15 @@ jobs: printf '%s\n' "$MACOS_RELEASE_MATRIX" > macos_release_matrix.json python3 ./scripts/gen_quick_start_module.py --autogenerate enable > assets/quick-start-module.js rm *_matrix.json + - uses: nashmaniac/create-issue-action@v1.1 + if: ${{ failure() }} # only run when this job is failed. + name: Create Issue Action + with: + title: Updating quick start module failed + token: ${{secrets.GITHUB_TOKEN}} + assignees: ${{github.actor}} + labels: bug + body: Updating quick start module failed, please fix update quick start module - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: From 99fadb4582f9cccbbde802136681167496b2fb36 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 11:01:11 -0800 Subject: [PATCH 12/17] test failure --- .github/workflows/update-quick-start-module.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index 86f9e3625379..48bba8ba841b 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -79,8 +79,8 @@ jobs: MACOS_RELEASE_MATRIX: ${{ needs.macos-release-matrix.outputs.matrix }} run: | set -ex - printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json - printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json + # printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json + # printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json printf '%s\n' "$MACOS_NIGHTLY_MATRIX" > macos_nightly_matrix.json printf '%s\n' "$LINUX_RELEASE_MATRIX" > linux_release_matrix.json printf '%s\n' "$WINDOWS_RELEASE_MATRIX" > windows_release_matrix.json @@ -89,7 +89,7 @@ jobs: rm *_matrix.json - uses: nashmaniac/create-issue-action@v1.1 if: ${{ failure() }} # only run when this job is failed. - name: Create Issue Action + name: Create Issue if failed with: title: Updating quick start module failed token: ${{secrets.GITHUB_TOKEN}} From 877de8e8064e4e6141ed54f1b76d5e3cb0164a97 Mon Sep 17 00:00:00 2001 From: atalman Date: Fri, 25 Nov 2022 11:15:47 -0800 Subject: [PATCH 13/17] testing --- .github/workflows/update-quick-start-module.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index 48bba8ba841b..bfb877a80401 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -87,9 +87,9 @@ jobs: printf '%s\n' "$MACOS_RELEASE_MATRIX" > macos_release_matrix.json python3 ./scripts/gen_quick_start_module.py --autogenerate enable > assets/quick-start-module.js rm *_matrix.json - - uses: nashmaniac/create-issue-action@v1.1 + - name: Create Issue if failed + uses: dacbd/create-issue-action@main if: ${{ failure() }} # only run when this job is failed. - name: Create Issue if failed with: title: Updating quick start module failed token: ${{secrets.GITHUB_TOKEN}} From bb5a8386be8fa9ac461877ce1930d07cc0df154b Mon Sep 17 00:00:00 2001 From: atalman Date: Mon, 28 Nov 2022 16:06:52 -0800 Subject: [PATCH 14/17] Testing update quick start moduke --- .../workflows/update-quick-start-module.yml | 12 +- scripts/gen_quick_start_module.py | 212 ++++++++---------- 2 files changed, 103 insertions(+), 121 deletions(-) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index bfb877a80401..ff824b10aada 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -7,12 +7,16 @@ on: paths: - .github/workflows/update-quick-start-module.yml - /scripts/gen_quick_start_module.py + - _includes/quick-start-module.js + - _includes/quick_start_local.html push: branches: site paths: - .github/workflows/update-quick-start-module.yml - /scripts/gen_quick_start_module.py + - _includes/quick-start-module.js + - _includes/quick_start_local.html workflow_dispatch: jobs: @@ -56,7 +60,7 @@ jobs: os: macos channel: "release" - generate-json-file: + update-quick-start: needs: [linux-nightly-matrix, windows-nightly-matrix, macos-nightly-matrix, linux-release-matrix, windows-release-matrix, macos-release-matrix] runs-on: "ubuntu-18.04" @@ -79,13 +83,13 @@ jobs: MACOS_RELEASE_MATRIX: ${{ needs.macos-release-matrix.outputs.matrix }} run: | set -ex - # printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json - # printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json + printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json + printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json printf '%s\n' "$MACOS_NIGHTLY_MATRIX" > macos_nightly_matrix.json printf '%s\n' "$LINUX_RELEASE_MATRIX" > linux_release_matrix.json printf '%s\n' "$WINDOWS_RELEASE_MATRIX" > windows_release_matrix.json printf '%s\n' "$MACOS_RELEASE_MATRIX" > macos_release_matrix.json - python3 ./scripts/gen_quick_start_module.py --autogenerate enable > assets/quick-start-module.js + python3 ./scripts/gen_quick_start_module.py --autogenerate > assets/quick-start-module.js rm *_matrix.json - name: Create Issue if failed uses: dacbd/create-issue-action@main diff --git a/scripts/gen_quick_start_module.py b/scripts/gen_quick_start_module.py index 0a380ea91eb2..f7e7641d92b6 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -1,14 +1,21 @@ #!/usr/bin/env python3 +""" +Generates quick start module for https://pytorch.org/get-started/locally/ page +If called from update-quick-start-module.yml workflow (--autogenerate parameter set) +Will output new quick-start-module.js, and new published_version.json file +based on the current release matrix. +If called standalone will generate quick-start-module.js from existing +published_version.json file +""" + import json -import os +import copy import argparse -import io -import sys from pathlib import Path -from typing import Dict, Set, List, Iterable +from typing import Dict from enum import Enum -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BASE_DIR = Path(__file__).parent.parent class OperatingSystem(Enum): LINUX: str = "linux" @@ -27,7 +34,6 @@ class OperatingSystem(Enum): # TBD drive the mapping via: # 1. Scanning release matrix and picking 2 latest cuda versions and 1 latest rocm # 2. Possibility to override the scanning algorithm with arguments passed from workflow - acc_arch_ver_map = { "nightly": { "accnone": ("cpu", ""), @@ -50,106 +56,87 @@ class OperatingSystem(Enum): DEBUG: "Download here (Debug version):", } +def load_json_from_basedir(filename: str): + try: + with open(BASE_DIR / filename) as fptr: + return json.load(fptr) + except FileNotFoundError as exc: + raise ImportError(f"File {filename} not found error: {exc.strerror}") from exc + except json.JSONDecodeError as exc: + raise ImportError(f"Invalid JSON {filename}") from exc + def read_published_versions(): - with open(os.path.join(BASE_DIR, "published_versions.json")) as fp: - return json.load(fp) + return load_json_from_basedir("published_versions.json") def write_published_versions(versions): - with open(os.path.join(BASE_DIR, "published_versions.json"), "w") as outfile: - json.dump(versions, outfile, indent=2) - -def read_matrix_for_os(osys: OperatingSystem, value: str): - try: - with open(os.path.join(BASE_DIR, f"{osys.value}_{value}_matrix.json")) as fp: - return json.load(fp)["include"] - except FileNotFoundError as e: - raise ImportError(f"Release matrix not found for: {osys.value} error: {e.strerror}") from e + with open(BASE_DIR / "published_versions.json", "w") as outfile: + json.dump(versions, outfile, indent=2) +def read_matrix_for_os(osys: OperatingSystem, channel: str): + jsonfile = load_json_from_basedir(f"{osys.value}_{channel}_matrix.json") + return jsonfile["include"] def read_quick_start_module_template(): - with open(os.path.join(BASE_DIR, "_includes", "quick-start-module.js")) as fp: - return fp.read() - + with open(BASE_DIR / "_includes" / "quick-start-module.js") as fptr: + return fptr.read() + +def get_package_type(pkg_key: str, os_key: OperatingSystem) -> str: + if pkg_key != "pip": + return pkg_key + return "manywheel" if os_key == OperatingSystem.LINUX.value else "wheel" + +def get_gpu_info(acc_key, instr, acc_arch_map): + gpu_arch_type, gpu_arch_version = acc_arch_map[acc_key] + if DEFAULT in instr: + gpu_arch_type, gpu_arch_version = acc_arch_map["accnone"] + return (gpu_arch_type, gpu_arch_version) + +# This method is used for generating new published_versions.json file +# It will modify versions json object with installation instructions +# Provided by generate install matrix Github Workflow, stored in release_matrix +# json object. def update_versions(versions, release_matrix, release_version): - version_map = { - "preview": "preview", - } - version = "" + version = "preview" acc_arch_map = acc_arch_ver_map[release_version] - if(release_version == "nightly"): - version = "preview" - else: + if release_version != "nightly": version = release_matrix[OperatingSystem.LINUX.value][0]["stable_version"] - - # Generating for a specific version - if(version != "preview"): - version_map = { - version: version, - } if version not in versions["versions"]: - import copy - new_version = copy.deepcopy(versions["versions"]["preview"]) - versions["versions"][version] = new_version + versions["versions"][version] = copy.deepcopy(versions["versions"]["preview"]) versions["latest_stable"] = version # Perform update of the json file from release matrix - for ver, ver_key in version_map.items(): - for os_key, os_vers in versions["versions"][ver_key].items(): - for pkg_key, pkg_vers in os_vers.items(): - for acc_key, instr in pkg_vers.items(): - - package_type = pkg_key - if pkg_key == 'pip': - package_type = 'manywheel' if os_key == OperatingSystem.LINUX.value else 'wheel' - - gpu_arch_type, gpu_arch_version = acc_arch_map[acc_key] - if(DEFAULT in instr): - gpu_arch_type, gpu_arch_version = acc_arch_map["accnone"] - - pkg_arch_matrix = list(filter( - lambda x: - (x["package_type"], x["gpu_arch_type"], x["gpu_arch_version"]) == - (package_type, gpu_arch_type, gpu_arch_version), - release_matrix[os_key] - )) - - if pkg_arch_matrix: - if package_type != 'libtorch': - instr["command"] = pkg_arch_matrix[0]["installation"] - else: - if os_key == OperatingSystem.LINUX.value: - rel_entry_pre_cxx1 = next(filter( - lambda x: - x["devtoolset"] == PRE_CXX11_ABI, - pkg_arch_matrix - ), None) - rel_entry_cxx1_abi = next(filter( - lambda x: - x["devtoolset"] == CXX11_ABI, - pkg_arch_matrix - ), None) - if(instr['versions'] is not None): - instr['versions'][LIBTORCH_DWNL_INSTR[PRE_CXX11_ABI]] = rel_entry_pre_cxx1["installation"] - instr['versions'][LIBTORCH_DWNL_INSTR[CXX11_ABI]] = rel_entry_cxx1_abi["installation"] - elif os_key == OperatingSystem.WINDOWS.value: - rel_entry_release = next(filter( - lambda x: - x["libtorch_config"] == RELEASE, - pkg_arch_matrix - ), None) - rel_entry_debug = next(filter( - lambda x: - x["libtorch_config"] == DEBUG, - pkg_arch_matrix - ), None) - if(instr['versions'] is not None): - instr['versions'][LIBTORCH_DWNL_INSTR[RELEASE]] = rel_entry_release["installation"] - instr['versions'][LIBTORCH_DWNL_INSTR[DEBUG]] = rel_entry_debug["installation"] - - + for os_key, os_vers in versions["versions"][version].items(): + for pkg_key, pkg_vers in os_vers.items(): + for acc_key, instr in pkg_vers.items(): + package_type = get_package_type(pkg_key, os_key) + gpu_arch_type, gpu_arch_version = get_gpu_info(acc_key, instr, acc_arch_map) + + pkg_arch_matrix = [ + x for x in release_matrix[os_key] + if (x["package_type"], x["gpu_arch_type"], x["gpu_arch_version"]) == + (package_type, gpu_arch_type, gpu_arch_version) + ] + + if pkg_arch_matrix: + if package_type != "libtorch": + instr["command"] = pkg_arch_matrix[0]["installation"] + else: + if os_key == OperatingSystem.LINUX.value: + rel_entry_dict = {x["devtoolset"]: x["installation"] for x in pkg_arch_matrix} + if instr["versions"] is not None: + for ver in [PRE_CXX11_ABI, CXX11_ABI]: + instr["versions"][LIBTORCH_DWNL_INSTR[ver]] = rel_entry_dict[ver] + elif os_key == OperatingSystem.WINDOWS.value: + rel_entry_dict = {x["libtorch_config"]: x["installation"] for x in pkg_arch_matrix} + if instr["versions"] is not None: + for ver in [RELEASE, DEBUG]: + instr["versions"][LIBTORCH_DWNL_INSTR[ver]] = rel_entry_dict[ver] + +# This method is used for generating new quick-start-module.js +# from the versions json object def gen_install_matrix(versions) -> Dict[str, str]: - rc = {} + result = {} version_map = { "preview": "preview", "stable": versions["latest_stable"], @@ -158,36 +145,30 @@ def gen_install_matrix(versions) -> Dict[str, str]: for os_key, os_vers in versions["versions"][ver_key].items(): for pkg_key, pkg_vers in os_vers.items(): for acc_key, instr in pkg_vers.items(): - extra_key = 'python' if pkg_key != 'libtorch' else 'cplusplus' - key = f"{ver},{pkg_key},{os_key},{acc_key},{extra_key}" - note = instr["note"] - lines = [note] if note is not None else [] - if pkg_key == "libtorch": - ivers = instr["versions"] - if ivers is not None: - lines += [f"{lab}
{val}" for (lab, val) in ivers.items()] - else: - command = instr["command"] - if command is not None: - lines.append(command) - rc[key] = "
".join(lines) - return rc + extra_key = 'python' if pkg_key != 'libtorch' else 'cplusplus' + key = f"{ver},{pkg_key},{os_key},{acc_key},{extra_key}" + note = instr["note"] + lines = [note] if note is not None else [] + if pkg_key == "libtorch": + ivers = instr["versions"] + if ivers is not None: + lines += [f"{lab}
{val}" for (lab, val) in ivers.items()] + else: + command = instr["command"] + if command is not None: + lines.append(command) + result[key] = "
".join(lines) + return result def main(): parser = argparse.ArgumentParser() - parser.add_argument( - "--autogenerate", - help="Is this call being initiated from workflow? update published_versions", - type=str, - choices=[ENABLE, DISABLE], - default=ENABLE, - ) + parser.add_argument('--autogenerate', dest='autogenerate', action='store_true') + parser.set_defaults(autogenerate=False) options = parser.parse_args() versions = read_published_versions() - - if options.autogenerate == ENABLE: + if options.autogenerate: release_matrix = {} for val in ("nightly", "release"): release_matrix[val] = {} @@ -199,14 +180,11 @@ def main(): write_published_versions(versions) - template = read_quick_start_module_template() versions_str = json.dumps(gen_install_matrix(versions)) template = template.replace("{{ installMatrix }}", versions_str) template = template.replace("{{ VERSION }}", f"\"Stable ({versions['latest_stable']})\"") print(template.replace("{{ ACC ARCH MAP }}", json.dumps(acc_arch_ver_map))) - - if __name__ == "__main__": main() From 3827e79cc77a3898a6fe96a5689c076846dd3651 Mon Sep 17 00:00:00 2001 From: atalman Date: Mon, 28 Nov 2022 16:57:00 -0800 Subject: [PATCH 15/17] test --- scripts/gen_quick_start_module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/gen_quick_start_module.py b/scripts/gen_quick_start_module.py index f7e7641d92b6..4b6df841fc94 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -123,7 +123,10 @@ def update_versions(versions, release_matrix, release_version): instr["command"] = pkg_arch_matrix[0]["installation"] else: if os_key == OperatingSystem.LINUX.value: - rel_entry_dict = {x["devtoolset"]: x["installation"] for x in pkg_arch_matrix} + rel_entry_dict = { + x["devtoolset"]: x["installation"] for x in pkg_arch_matrix + if x["libtorch_variant"] == "shared-with-deps" + } if instr["versions"] is not None: for ver in [PRE_CXX11_ABI, CXX11_ABI]: instr["versions"][LIBTORCH_DWNL_INSTR[ver]] = rel_entry_dict[ver] From 22880e401dc9eece9d1cc4733285f4d0f311eda7 Mon Sep 17 00:00:00 2001 From: atalman Date: Mon, 28 Nov 2022 16:59:20 -0800 Subject: [PATCH 16/17] testing --- .github/workflows/update-quick-start-module.yml | 4 ++-- .github/workflows/validate-quick-start-module.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index ff824b10aada..af406805ff2a 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -6,7 +6,7 @@ on: pull_request: paths: - .github/workflows/update-quick-start-module.yml - - /scripts/gen_quick_start_module.py + - scripts/gen_quick_start_module.py - _includes/quick-start-module.js - _includes/quick_start_local.html push: @@ -14,7 +14,7 @@ on: site paths: - .github/workflows/update-quick-start-module.yml - - /scripts/gen_quick_start_module.py + - scripts/gen_quick_start_module.py - _includes/quick-start-module.js - _includes/quick_start_local.html workflow_dispatch: diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml index 0f8603757ca5..e8db7f24742c 100644 --- a/.github/workflows/validate-quick-start-module.yml +++ b/.github/workflows/validate-quick-start-module.yml @@ -3,14 +3,14 @@ on: pull_request: paths: - published_versions.json - - /assets/quick-start-module.js + - assets/quick-start-module.js - .github/workflows/validate-quick-start-module.yml push: branches: site paths: - published_versions.json - - /assets/quick-start-module.js + - assets/quick-start-module.js - .github/workflows/validate-quick-start-module.yml workflow_dispatch: From f5a6ee353fd1f264f6ffb18e03d8d1b4aee8cbba Mon Sep 17 00:00:00 2001 From: atalman Date: Tue, 29 Nov 2022 12:53:21 -0800 Subject: [PATCH 17/17] Testing --- .github/workflows/update-quick-start-module.yml | 4 ++-- .github/workflows/validate-quick-start-module.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-quick-start-module.yml b/.github/workflows/update-quick-start-module.yml index af406805ff2a..52851e9e786f 100644 --- a/.github/workflows/update-quick-start-module.yml +++ b/.github/workflows/update-quick-start-module.yml @@ -96,14 +96,14 @@ jobs: if: ${{ failure() }} # only run when this job is failed. with: title: Updating quick start module failed - token: ${{secrets.GITHUB_TOKEN}} + token: ${{secrets.PYTORCHBOT_TOKEN}} assignees: ${{github.actor}} labels: bug body: Updating quick start module failed, please fix update quick start module - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PYTORCHBOT_TOKEN }} commit-message: Modify published_versions.json file title: '[Getting Started Page] Modify published_versions.json file' body: > diff --git a/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml index e8db7f24742c..1bda03522bc7 100644 --- a/.github/workflows/validate-quick-start-module.yml +++ b/.github/workflows/validate-quick-start-module.yml @@ -1,6 +1,8 @@ name: Validate quick start module on: pull_request: + branches: + site paths: - published_versions.json - assets/quick-start-module.js