From 9eef63b0aefdb840a412794c37c85f63bc6f0539 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Sun, 28 Jul 2024 13:54:00 +0800 Subject: [PATCH 1/5] update 3x torch installation Signed-off-by: chensuyue --- README.md | 17 ++++++++++++++++- docs/source/installation_guide.md | 16 ++++++++++++++++ requirements_pt.txt | 1 - 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4aac08639b2..a10e98d61e7 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,26 @@ support AMD CPU, ARM CPU, and NVidia GPU through ONNX Runtime with limited testi * [2024/07] Performance optimizations and usability improvements on [client-side](https://github.com/intel/neural-compressor/blob/master/docs/source/3x/client_quant.md). ## Installation +### Install Framework +#### Install torch for CPU +```Shell +pip install torch --index-url https://download.pytorch.org/whl/cpu +``` +#### Install torch for XPU +https://intel.github.io/intel-extension-for-pytorch/index.html#installation + +#### Install torch for other platform +https://pytorch.org/get-started/locally + +#### Install tensorflow +```Shell +pip install tensorflow +``` ### Install from pypi ```Shell # Install 2.X API + Framework extension API + PyTorch dependency -pip install neural-compressor[pt] +pip install neural-compressor[pt] # Install 2.X API + Framework extension API + TensorFlow dependency pip install neural-compressor[tf] ``` diff --git a/docs/source/installation_guide.md b/docs/source/installation_guide.md index f4497806c58..a3f4b47aacd 100644 --- a/docs/source/installation_guide.md +++ b/docs/source/installation_guide.md @@ -27,6 +27,22 @@ The following prerequisites and requirements must be satisfied for a successful > Notes: > - If you get some build issues, please check [frequently asked questions](faq.md) at first. +### Install Framework +#### Install torch for CPU +```Shell +pip install torch --index-url https://download.pytorch.org/whl/cpu +``` +#### Install torch for XPU +https://intel.github.io/intel-extension-for-pytorch/index.html#installation + +#### Install torch for other platform +https://pytorch.org/get-started/locally + +#### Install tensorflow +```Shell +pip install tensorflow +``` + ### Install from Binary - Install from Pypi ```Shell diff --git a/requirements_pt.txt b/requirements_pt.txt index 10e8715df2d..b858822cc6b 100644 --- a/requirements_pt.txt +++ b/requirements_pt.txt @@ -5,4 +5,3 @@ prettytable psutil py-cpuinfo pydantic -torch From 830cb84d0328c1d4d03c36075ad7a72d3ae87c9a Mon Sep 17 00:00:00 2001 From: chensuyue Date: Sun, 28 Jul 2024 14:10:41 +0800 Subject: [PATCH 2/5] update test Signed-off-by: chensuyue --- .azure-pipelines/scripts/install_nc.sh | 3 +++ README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index 55b323c56c2..dc211d0f512 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -6,6 +6,9 @@ if [[ $1 = *"3x_pt"* ]]; then python -m pip install --no-cache-dir -r requirements_pt.txt python setup.py pt bdist_wheel pip install --no-deps dist/neural_compressor*.whl --force-reinstall + if [[ $1 != *"3x_pt_fp8"* ]]; then + pip install torch --index-url https://download.pytorch.org/whl/cpu + fi elif [[ $1 = *"3x_tf"* ]]; then python -m pip install --no-cache-dir -r requirements_tf.txt python setup.py tf bdist_wheel diff --git a/README.md b/README.md index a10e98d61e7..1568706994e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ support AMD CPU, ARM CPU, and NVidia GPU through ONNX Runtime with limited testi ```Shell pip install torch --index-url https://download.pytorch.org/whl/cpu ``` -#### Install torch for XPU +#### Install torch/intel_extension_for_pytorch for XPU https://intel.github.io/intel-extension-for-pytorch/index.html#installation #### Install torch for other platform From 4454f6f64ebd0ac4bf0cb67581f7ef299d3b0093 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Sun, 28 Jul 2024 14:27:07 +0800 Subject: [PATCH 3/5] freeze torch vision Signed-off-by: chensuyue --- .azure-pipelines/scripts/install_nc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index dc211d0f512..0caf4b1a651 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -7,7 +7,7 @@ if [[ $1 = *"3x_pt"* ]]; then python setup.py pt bdist_wheel pip install --no-deps dist/neural_compressor*.whl --force-reinstall if [[ $1 != *"3x_pt_fp8"* ]]; then - pip install torch --index-url https://download.pytorch.org/whl/cpu + pip install torch==2.3.0 --index-url https://download.pytorch.org/whl/cpu fi elif [[ $1 = *"3x_tf"* ]]; then python -m pip install --no-cache-dir -r requirements_tf.txt From 74e9381213e931524f25080773d7644c7f739bc9 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Sun, 28 Jul 2024 15:40:51 +0800 Subject: [PATCH 4/5] install torch cpu Signed-off-by: chensuyue --- .azure-pipelines/scripts/install_nc.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index 0caf4b1a651..6a80419259f 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -3,12 +3,13 @@ echo -e "\n Install Neural Compressor ... " cd /neural-compressor if [[ $1 = *"3x_pt"* ]]; then - python -m pip install --no-cache-dir -r requirements_pt.txt - python setup.py pt bdist_wheel - pip install --no-deps dist/neural_compressor*.whl --force-reinstall if [[ $1 != *"3x_pt_fp8"* ]]; then + echo -e "\n Install torch CPU ... " pip install torch==2.3.0 --index-url https://download.pytorch.org/whl/cpu fi + python -m pip install --no-cache-dir -r requirements_pt.txt + python setup.py pt bdist_wheel + pip install --no-deps dist/neural_compressor*.whl --force-reinstall elif [[ $1 = *"3x_tf"* ]]; then python -m pip install --no-cache-dir -r requirements_tf.txt python setup.py tf bdist_wheel From a78a7da4c7ac419f08686a77e3522f0a0b5d9872 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Mon, 29 Jul 2024 12:08:00 +0800 Subject: [PATCH 5/5] update torch install Signed-off-by: chensuyue --- README.md | 5 ++++- docs/source/installation_guide.md | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1568706994e..5fbad1d0434 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,10 @@ support AMD CPU, ARM CPU, and NVidia GPU through ONNX Runtime with limited testi ```Shell pip install torch --index-url https://download.pytorch.org/whl/cpu ``` -#### Install torch/intel_extension_for_pytorch for XPU +#### Use Docker Image with torch installed for HPU +https://docs.habana.ai/en/latest/Installation_Guide/Bare_Metal_Fresh_OS.html#bare-metal-fresh-os-single-click + +#### Install torch/intel_extension_for_pytorch for Intel GPU https://intel.github.io/intel-extension-for-pytorch/index.html#installation #### Install torch for other platform diff --git a/docs/source/installation_guide.md b/docs/source/installation_guide.md index a3f4b47aacd..ca33138b2a4 100644 --- a/docs/source/installation_guide.md +++ b/docs/source/installation_guide.md @@ -32,7 +32,10 @@ The following prerequisites and requirements must be satisfied for a successful ```Shell pip install torch --index-url https://download.pytorch.org/whl/cpu ``` -#### Install torch for XPU +#### Use Docker Image with torch installed for HPU +https://docs.habana.ai/en/latest/Installation_Guide/Bare_Metal_Fresh_OS.html#bare-metal-fresh-os-single-click + +#### Install torch/intel_extension_for_pytorch for Intel GPU https://intel.github.io/intel-extension-for-pytorch/index.html#installation #### Install torch for other platform