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 new file mode 100644 index 000000000000..52851e9e786f --- /dev/null +++ b/.github/workflows/update-quick-start-module.yml @@ -0,0 +1,111 @@ +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 + - 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: + linux-nightly-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + 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: "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: "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: "release" + + 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" + 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_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_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 > assets/quick-start-module.js + rm *_matrix.json + - name: Create Issue if failed + uses: dacbd/create-issue-action@main + if: ${{ failure() }} # only run when this job is failed. + with: + title: Updating quick start module failed + 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.PYTORCHBOT_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/.github/workflows/validate-quick-start-module.yml b/.github/workflows/validate-quick-start-module.yml new file mode 100644 index 000000000000..1bda03522bc7 --- /dev/null +++ b/.github/workflows/validate-quick-start-module.yml @@ -0,0 +1,32 @@ +name: Validate quick start module +on: + pull_request: + branches: + site + paths: + - 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 + - .github/workflows/validate-quick-start-module.yml + workflow_dispatch: + +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 diff --git a/_includes/quick-start-module.js b/_includes/quick-start-module.js index 59ba834edbc8..e61b3b8f1687 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), @@ -98,58 +100,44 @@ function getPreferredCuda(os) { if (os == 'macos') { return 'accnone'; } - return 'cuda11.6'; + return 'cuda.x'; } // 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..0d215c6414a9 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), @@ -98,58 +100,44 @@ function getPreferredCuda(os) { if (os == 'macos') { return 'accnone'; } - return 'cuda11.6'; + return 'cuda.x'; } // 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/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_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 34a777ae4eb0..4b6df841fc94 100755 --- a/scripts/gen_quick_start_module.py +++ b/scripts/gen_quick_start_module.py @@ -1,23 +1,145 @@ #!/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 +from pathlib import Path from typing import Dict -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +from enum import Enum + +BASE_DIR = Path(__file__).parent.parent + +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_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 = { + 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 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(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 = "preview" + acc_arch_map = acc_arch_ver_map[release_version] + if release_version != "nightly": + version = release_matrix[OperatingSystem.LINUX.value][0]["stable_version"] + if version not in versions["versions"]: + versions["versions"][version] = copy.deepcopy(versions["versions"]["preview"]) + versions["latest_stable"] = version + + # Perform update of the json file from release matrix + 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 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] + 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"], @@ -26,27 +148,46 @@ 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', dest='autogenerate', action='store_true') + parser.set_defaults(autogenerate=False) + + options = parser.parse_args() versions = read_published_versions() + + if options.autogenerate: + release_matrix = {} + 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) + + 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__": 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()