From ede2554e1db7a2f5a12382c48061e0a13dacf8c4 Mon Sep 17 00:00:00 2001 From: huafengchun Date: Mon, 3 Jun 2024 09:48:16 +0800 Subject: [PATCH] Add pytorch install instructions --- _static/{actions.js => ascend_actions.js} | 12 +- _static/package_info.js | 236 +++------------------- _static/pytorch_actions.js | 74 +++++++ conf.py | 1 - index.rst | 13 +- sources/{ => ascend}/quick_install.rst | 1 + sources/pytorch/install.rst | 114 +++++++++++ 7 files changed, 237 insertions(+), 214 deletions(-) rename _static/{actions.js => ascend_actions.js} (99%) create mode 100644 _static/pytorch_actions.js rename sources/{ => ascend}/quick_install.rst (99%) create mode 100644 sources/pytorch/install.rst diff --git a/_static/actions.js b/_static/ascend_actions.js similarity index 99% rename from _static/actions.js rename to _static/ascend_actions.js index 2723974..67abd13 100644 --- a/_static/actions.js +++ b/_static/ascend_actions.js @@ -152,15 +152,10 @@ $(document).ready(function () { cann_version_select.trigger('change'); } - $.update_os_verions(); - $.update_python_versions(); - $.change_options_visible(); - $.update_cann_versions(); - $("#col-values").on("click", ".values-element", function () { id = $(this).attr("id"); fields = id.split("-"); - if (fields[1] == "cann_version") + if (id == "cann-version") return; $.reset_selection($(this)); @@ -276,4 +271,9 @@ $(document).ready(function () { $('#use_docker_section').show(); } } + + $.update_os_verions(); + $.update_python_versions(); + $.change_options_visible(); + $.update_cann_versions(); }); diff --git a/_static/package_info.js b/_static/package_info.js index 92d628f..a7b3562 100644 --- a/_static/package_info.js +++ b/_static/package_info.js @@ -1,5 +1,5 @@ const package_info = { - '8.0.RC2.alpha002': { + '8.0.RC2': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C18SPC702/Ascend-cann-toolkit_8.0.RC2.alpha002_linux-x86_64.run' }, @@ -31,39 +31,7 @@ const package_info = { } } }, - '8.0.RC2.alpha001': { - x86_64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C18B800TP015/Ascend-cann-toolkit_8.0.RC2.alpha001_linux-x86_64.run' - }, - aarch64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C18B800TP015/Ascend-cann-toolkit_8.0.RC2.alpha001_linux-aarch64.run' - }, - '910b': { - driver_version: '23.0.3', - firmware_version: '7.1.0.5.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-firmware_7.1.0.5.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C18B800TP015/Ascend-cann-kernels-910b_8.0.RC2.alpha001_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-aarch64.run', - } - }, - '310p': { - driver_version: '23.0.1', - firmware_version: '7.1.0.4.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-firmware_7.1.0.4.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C18B800TP015/Ascend-cann-kernels-310p_8.0.RC2.alpha001_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-aarch64.run', - } - } - }, - '8.0.RC1.beta1': { + '8.0.RC1': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN 8.0.RC1/Ascend-cann-toolkit_8.0.RC1_linux-x86_64.run' }, @@ -83,103 +51,7 @@ const package_info = { } } }, - '8.0.RC1.alpha003': { - x86_64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC703/Ascend-cann-toolkit_8.0.RC1.alpha003_linux-x86_64.run' - }, - aarch64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC703/Ascend-cann-toolkit_8.0.RC1.alpha003_linux-aarch64.run' - }, - '910b': { - driver_version: '23.0.3', - firmware_version: '7.1.0.5.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-firmware_7.1.0.5.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC703/Ascend-cann-kernels-910b_8.0.RC1.alpha003_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-aarch64.run', - } - }, - '310p': { - driver_version: '23.0.1', - firmware_version: '7.1.0.4.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-firmware_7.1.0.4.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC703/Ascend-cann-kernels-310p_8.0.RC1.alpha003_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-aarch64.run', - } - } - }, - '8.0.RC1.alpha002': { - x86_64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC702/Ascend-cann-toolkit_8.0.RC1.alpha002_linux-x86_64.run' - }, - aarch64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC702/Ascend-cann-toolkit_8.0.RC1.alpha002_linux-aarch64.run' - }, - '910b': { - driver_version: '23.0.3', - firmware_version: '7.1.0.5.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-firmware_7.1.0.5.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC702/Ascend-cann-kernels-3910b_8.0.RC1.alpha002_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-aarch64.run', - } - }, - '310p': { - driver_version: '23.0.1', - firmware_version: '7.1.0.4.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-firmware_7.1.0.4.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC702/Ascend-cann-kernels-310p_8.0.RC1.alpha002_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-aarch64.run', - } - } - }, - '8.0.RC1.alpha001': { - x86_64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC701/Ascend-cann-toolkit_8.0.RC1.alpha001_linux-x86_64.run' - }, - aarch64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC701/Ascend-cann-toolkit_8.0.RC1.alpha001_linux-aarch64.run' - }, - '910b': { - driver_version: '23.0.3', - firmware_version: '7.1.0.5.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-firmware_7.1.0.5.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC701/Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.3/Ascend-hdk-910b-npu-driver_23.0.3_linux-aarch64.run', - } - }, - '310p': { - driver_version: '23.0.1', - firmware_version: '7.1.0.4.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-firmware_7.1.0.4.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C17SPC701/Ascend-cann-kernels-310p_8.0.RC1.alpha001_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.2.1/Ascend-hdk-310p-npu-driver_23.0.1_linux-aarch64.run', - } - } - }, - '7.0.0.beta1': { + '7.0.0': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN 7.0.0/Ascend-cann-toolkit_7.0.0_linux-x86_64.run' }, @@ -211,71 +83,7 @@ const package_info = { } } }, - '7.0.0.alpha003': { - x86_64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC703/Ascend-cann-toolkit_7.0.0.alpha003_linux-x86_64.run' - }, - aarch64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC703/Ascend-cann-toolkit_7.0.0.alpha003_linux-aarch64.run' - }, - '910b': { - driver_version: '23.0.rc3', - firmware_version: '6.4.0.4.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-910b-npu-firmware_6.4.0.4.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC703/Ascend-cann-kernels-910b_7.0.0.alpha003_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-910b-npu-driver_23.0.rc3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-910b-npu-driver_23.0.rc3_linux-aarch64.run', - } - }, - '310p': { - driver_version: '23.0.rc3', - firmware_version: '7.0.0.5.242', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-310p-npu-firmware_7.0.0.5.242.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC703/Ascend-cann-kernels-310p_7.0.0.alpha003_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-310p-npu-driver_23.0.rc3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-310p-npu-driver_23.0.rc3_linux-aarch64.run', - } - } - }, - '7.0.0.alpha002': { - x86_64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC702/Ascend-cann-toolkit_7.0.0.alpha002_linux-x86_64.run' - }, - aarch64: { - url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC702/Ascend-cann-toolkit_7.0.0.alpha002_linux-aarch64.run' - }, - '910b': { - driver_version: '23.0.rc3', - firmware_version: '6.4.0.4.220', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-910b-npu-firmware_6.4.0.4.220.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC702/Ascend-cann-kernels-910b_7.0.0.alpha002_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-910b-npu-driver_23.0.rc3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-910b-npu-driver_23.0.rc3_linux-aarch64.run', - } - }, - '310p': { - driver_version: '23.0.rc3', - firmware_version: '7.0.0.5.242', - firmware_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-310p-npu-firmware_7.0.0.5.242.run', - kernel_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL V100R001C15SPC702/Ascend-cann-kernels-310p_7.0.0.alpha002_linux.run', - x86_64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-310p-npu-driver_23.0.rc3_linux-x86-64.run', - }, - aarch64: { - driver_url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Ascend HDK/Ascend HDK 23.0.RC3/Ascend-hdk-310p-npu-driver_23.0.rc3_linux-aarch64.run', - } - } - }, - '7.0.RC1.beta1': { + '7.0.RC1': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN 7.0.RC1/Ascend-cann-toolkit_7.0.RC1_linux-x86_64.run' }, @@ -307,7 +115,7 @@ const package_info = { } } }, - '6.3.RC2.alpha005': { + '6.3.RC2': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN 6.3.RC2/Ascend-cann-toolkit_6.3.RC2_linux-x86_64.run' }, @@ -327,7 +135,7 @@ const package_info = { } } }, - '6.3.RC1.alpha003': { + '6.3.RC1': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN 6.3.RC1/Ascend-cann-toolkit_6.3.RC1_linux-x86_64.run' }, @@ -346,7 +154,7 @@ const package_info = { } } }, - '6.0.RC1.alpha005': { + '6.0.RC1': { x86_64: { url: 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN6.0.RC1/Ascend-cann-toolkit_6.0.RC1_linux-x86_64.run' }, @@ -369,9 +177,27 @@ const package_info = { const docker_images = [ - 'cosdt/cann:8.0.rc2.alpha002-910b-ubuntu22.04-py3.10', - 'cosdt/cann:8.0.rc2.alpha002-910b-ubuntu20.04-py3.10', - 'cosdt/cann:8.0.rc2.alpha002-910b-ubuntu20.04-py3.9', - 'cosdt/cann:8.0.rc2.alpha002-910b-ubuntu20.04-py3.8', - 'cosdt/cann:8.0.rc2.alpha002-910b-openeuler22.03-py3.10', -]; \ No newline at end of file + 'cosdt/cann:8.0.rc2-910b-ubuntu22.04-py3.10', + 'cosdt/cann:8.0.rc2-910b-ubuntu20.04-py3.10', + 'cosdt/cann:8.0.rc2-910b-ubuntu20.04-py3.9', + 'cosdt/cann:8.0.rc2-910b-ubuntu20.04-py3.8', + 'cosdt/cann:8.0.rc2-910b-openeuler22.03-py3.10', +]; + +const pytorch_versions = { + '2.2.0': { + torch_npu: '2.2.0', + npu_branch: 'v2.2.0-6.0.rc1', + cann: 'CANN 8.0.RC1' + }, + '2.1.0': { + torch_npu: '2.1.0.post3', + npu_branch: 'v2.1.0-6.0.rc1', + cann: 'CANN 8.0.RC1' + }, + '2.0.1': { + torch_npu: '2.0.1.post1', + npu_branch: 'v2.1.0-5.0.0', + cann: 'CANN 7.0.0' + } +} \ No newline at end of file diff --git a/_static/pytorch_actions.js b/_static/pytorch_actions.js new file mode 100644 index 0000000..6702004 --- /dev/null +++ b/_static/pytorch_actions.js @@ -0,0 +1,74 @@ +$(document).ready(function () { + $.reset_selection = function (elem) { + elem.parent().children().each(function () { + $(this).removeClass("selected"); + }); + } + + $.get_options = function () { + var options = {}; + $('#col-values').children().each(function () { + var elem = $(this).find(".selected").each(function () { + var id = $(this).attr("id").split("-"); + var category = id[0]; + var value = id[1]; + if(category == 'pytorch') + options[category] = value; + else + options[category] = $(this).text(); + }); + }); + return options; + } + + $.update_table = function () { + var options = $.get_options(); + var pytorch_version = options['pytorch']; + match_versions = pytorch_versions[pytorch_version]; + $("#pytorch_npu-version").text(match_versions['torch_npu']); + $("#cann-version").text(match_versions['cann']); + } + + $("#col-values").on("click", ".values-element", function () { + id = $(this).attr("id"); + fields = id.split("-"); + if (fields[0] == "pytorch_npu" || fields[0] == "cann") + return; + + $.reset_selection($(this)); + $(this).addClass("selected"); + $.update_table(); + $.gen_content(); + }); + + + $.gen_content = function () { + var options = $.get_options(); + if (options['install_type'] == "pip") { + if(options['arch'] == "aarch64") + $('#install-pytorch-pip').html("pip3 install torch==" + options['pytorch']); + else + $('#install-pytorch-pip').html("pip3 install torch=="+options['pytorch']+"+cpu --index-url https://download.pytorch.org/whl/cpu"); + + $("#install-pytorch_npu-pip").html("pip3 install torch-npu==" + options['pytorch_npu']); + + $('#install-pytorch-source-section').hide(); + $('#install-pytorch_npu-source-section').hide(); + $('#install-pytorch-pip-section').show(); + $('#install-pytorch_npu-pip-section').show(); + } else { + $("#install-pytorch-source-build").html("# install requirements
conda install cmake ninja

# get source
git clone -b "+options['pytorch']+" --recursive https://github.com/pytorch/pytorch
cd pytorch
git submodule update --init --recursive

# install PyTorch
pip install -r requirements.txt
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-\"$(dirname $(which conda))/../\"}
python setup.py develop"); + + $('#install-pytorch_npu-source-build').html("# get source
git clone https://github.com/ascend/pytorch.git -b "+options['pytorch_npu']+" --depth 1 pytorch_npu
cd pytorch_npu

#install pytorch_npu
bash ci/build.sh --python=$(python --version 2>&1 | awk '{print $2}' | cut -d '.' -f 1,2)"); + + $('#install-pytorch-pip-section').hide(); + $('#install-pytorch_npu-pip-section').hide(); + $('#install-pytorch-source-section').show(); + $('#install-pytorch_npu-source-section').show(); + } + + } + + $.update_table(); + $.gen_content(); +}); diff --git a/conf.py b/conf.py index 93ef36f..682d943 100644 --- a/conf.py +++ b/conf.py @@ -65,5 +65,4 @@ def setup(app): app.add_css_file('custom.css') - app.add_js_file('actions.js') app.add_js_file('package_info.js') diff --git a/index.rst b/index.rst index 3b8a926..9edb4b1 100644 --- a/index.rst +++ b/index.rst @@ -10,12 +10,21 @@ :includehidden: :caption: Get Started - sources/quick_install.rst + sources/ascend/quick_install.rst + +.. toctree:: + :maxdepth: 2 + :hidden: + :includehidden: + :caption: PyTorch + + sources/pytorch/install.rst + .. warning:: 文档仍在开发中,内容可能存在错误,内容可能会随时更新,请勿将其用于生产环境。 -选择您的偏好,并按照 :doc:`快速安装昇腾环境` 的安装指导进行操作。 +选择您的偏好,并按照 :doc:`快速安装昇腾环境` 的安装指导进行操作。 安装成功后,请参考快速开始和样例来开始使用昇腾AI处理器。 diff --git a/sources/quick_install.rst b/sources/ascend/quick_install.rst similarity index 99% rename from sources/quick_install.rst rename to sources/ascend/quick_install.rst index 7891371..bc947d9 100644 --- a/sources/quick_install.rst +++ b/sources/ascend/quick_install.rst @@ -34,6 +34,7 @@ Python 3.8, 3.9, 3.10 .. raw:: html +
diff --git a/sources/pytorch/install.rst b/sources/pytorch/install.rst new file mode 100644 index 0000000..e294e87 --- /dev/null +++ b/sources/pytorch/install.rst @@ -0,0 +1,114 @@ +安装PyTorch和PyTorch-NPU +=========================== + +跟随指导,安装在NPU上运行的PyTorch版本。 + + +1. 选择需要安装的PyTorch版本 +------------------------------ +根据您的需求,选择合适的PyTorch和CANN版本: + +.. raw:: html + + +
+
+
+
PyTorch版本
+
PyTorch-NPU版本
+
CANN-toolkit版本
+
CPU架构
+
安装方式
+
+
+
+
PyTorch版本
+
2.2.0
+
2.1.0
+
2.0.1
+
+
+
PyTorch-NPU版本
+
null
+
+
+
CANN-toolkit版本
+
null
+
+
+
CPU架构
+
x86-64
+
aarch64
+
+
+
安装方式
+
pip
+
源码构建
+
+
+
+
+ + +请先根据上述表格建议的CANN-toolkit版本 :doc:`安装昇腾环境<../ascend/quick_install>`。 + + +2. 安装PyTorch +---------------- +.. raw:: html + +
+

使用pip安装

+
+

+                
+
+
+
+

2.1 环境依赖

+

1. Python 3.8及以上
2. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)

+
+
+

2.2 构建

+
+

+                
+
+
+ +3. 安装PyTorch-NPU +-------------------- + +.. raw:: html + +
+

使用pip安装

+
+

+                
+
+
+
+

3.1 环境依赖

+

1. Python 3.8 ~ 3.10
2. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)

+
+
+

3.2 构建

+
+

+                
+
+
+ +4. 验证安装结果 +------------------ + +:: + + import torch + import torch_npu + + torch.npu.set_device(0) + a = torch.randn(2,3).to('npu') + b = torch.randn(2,3).to('npu') + a + b \ No newline at end of file