Skip to content

Commit

Permalink
update installation and ci test for 3x api (#1991)
Browse files Browse the repository at this point in the history
Signed-off-by: chensuyue <[email protected]>
(cherry picked from commit f2c454f)
  • Loading branch information
chensuyue committed Aug 30, 2024
1 parent 9486bf3 commit 0e88b25
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
13 changes: 8 additions & 5 deletions .azure-pipelines/scripts/install_nc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
echo -e "\n Install Neural Compressor ... "
cd /neural-compressor
if [[ $1 = *"3x_pt"* ]]; then
if [[ $1 != *"3x_pt_fp8"* ]]; then
python -m pip install --no-cache-dir -r requirements_pt.txt
if [[ $1 = *"3x_pt_fp8"* ]]; then
pip uninstall neural_compressor_3x_pt -y || true
python setup.py pt bdist_wheel
else
echo -e "\n Install torch CPU ... "
pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cpu
python -m pip install --no-cache-dir -r requirements.txt
python setup.py bdist_wheel
fi
python -m pip install --no-cache-dir -r requirements_pt.txt
# python setup.py pt bdist_wheel
python setup.py 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.txt
python -m pip install --no-cache-dir -r requirements_tf.txt
# python setup.py tf bdist_wheel
python setup.py bdist_wheel
pip install dist/neural_compressor*.whl --force-reinstall
else
Expand Down
2 changes: 2 additions & 0 deletions .azure-pipelines/scripts/ut/3x/run_3x_pt_fp8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ echo "${test_case}"
echo "set up UT env..."
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
sed -i '/^intel_extension_for_pytorch/d' /neural-compressor/test/3x/torch/requirements.txt
sed -i '/^auto_round/d' /neural-compressor/test/3x/torch/requirements.txt
cat /neural-compressor/test/3x/torch/requirements.txt
pip install -r /neural-compressor/test/3x/torch/requirements.txt
pip install git+https://github.com/HabanaAI/[email protected]
pip install pytest-cov
Expand Down
6 changes: 3 additions & 3 deletions neural_compressor/torch/algorithms/fp8_quant/_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def update_mod_dict(config):
def print_init_info(config):
import importlib.metadata

versionStr = importlib.metadata.version("neural_compressor_3x_pt")
versionStr = importlib.metadata.version("neural_compressor_pt")
locationStr = versionStr.find("git") + 3
logger.info("neural_compressor_3x_pt Git revision = %s", versionStr[locationStr:])
logger.info("neural_compressor_3x_pt Configuration = %s", config)
logger.info("neural_compressor_pt Git revision = %s", versionStr[locationStr:])
logger.info("neural_compressor_pt Configuration = %s", config)


def is_substr(substr_list, target):
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def get_build_version():
},
},
# 3.x pt binary build config, pip install neural-compressor-pt, install 3.x PyTorch API.
"neural_compressor_3x_pt": {
"project_name": "neural_compressor_3x_pt",
"neural_compressor_pt": {
"project_name": "neural_compressor_pt",
"include_packages": find_packages(
include=[
"neural_compressor.common",
Expand All @@ -73,8 +73,8 @@ def get_build_version():
"install_requires": fetch_requirements("requirements_pt.txt"),
},
# 3.x tf binary build config, pip install neural-compressor-tf, install 3.x TensorFlow API.
"neural_compressor_3x_tf": {
"project_name": "neural_compressor_3x_tf",
"neural_compressor_tf": {
"project_name": "neural_compressor_tf",
"include_packages": find_packages(
include=[
"neural_compressor.common",
Expand All @@ -100,11 +100,11 @@ def get_build_version():

if "pt" in sys.argv:
sys.argv.remove("pt")
cfg_key = "neural_compressor_3x_pt"
cfg_key = "neural_compressor_pt"

if "tf" in sys.argv:
sys.argv.remove("tf")
cfg_key = "neural_compressor_3x_tf"
cfg_key = "neural_compressor_tf"

if bool(os.getenv("USE_FP8_CONVERT", False)):
from torch.utils.cpp_extension import BuildExtension, CppExtension
Expand Down

0 comments on commit 0e88b25

Please sign in to comment.