diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index afc894ee034..1f3f3beb647 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -44,15 +44,3 @@ stages: parameters: codeScanFileName: "bandit" uploadPath: "bandit.log" - - - stage: PylintCodeScan - displayName: Pylint Code Scan - dependsOn: [] - jobs: - - job: Pylint - displayName: Pylint - steps: - - template: template/code-scan-template.yml - parameters: - codeScanFileName: "pylint" - uploadPath: "pylint.json" diff --git a/.azure-pipelines/docker/DockerfileCodeScan.devel b/.azure-pipelines/docker/DockerfileCodeScan.devel index f6359248a7c..611fe02e235 100644 --- a/.azure-pipelines/docker/DockerfileCodeScan.devel +++ b/.azure-pipelines/docker/DockerfileCodeScan.devel @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ RUN ln -sf $(which python3) /usr/bin/python -RUN python -m pip install --no-cache-dir pylint==2.12.1\ +RUN python -m pip install --no-cache-dir \ bandit\ pyspelling\ pydocstyle diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh deleted file mode 100644 index 5631dcc0917..00000000000 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -for var in "$@" -do - case $var in - --scan_module=*) - scan_module=$(echo $var |cut -f2 -d=) - ;; - esac -done - -source /neural-compressor/.azure-pipelines/scripts/change_color.sh -RESET="echo -en \\E[0m \\n" # close color - -log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" -mkdir -p $log_dir - -apt-get install -y --no-install-recommends --fix-missing \ - autoconf \ - build-essential - -pip install -r /neural-compressor/requirements.txt -pip install -r /neural-compressor/requirements_pt.txt -pip install cmake - -pip install torch \ - horovod \ - google \ - autograd \ - ofa \ - fvcore \ - pymoo \ - onnxruntime_extensions \ - peft \ - tf_slim \ - transformers \ - accelerate \ - flask==2.1.3 \ - xgboost \ - datasets \ - prettytable \ - psutil \ - py-cpuinfo \ - pyyaml \ - pydantic \ - protobuf - -echo "[DEBUG] list pipdeptree..." -pip install pipdeptree -pipdeptree - -python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto \ ---ignored-modules=tensorflow,keras,torch,torch.quantization,torch.tensor,torchvision,fairseq,mxnet,onnx,onnxruntime,intel_extension_for_pytorch,intel_extension_for_tensorflow,torchinfo,horovod,transformers \ -/neural-compressor/${scan_module} > $log_dir/pylint.json - -exit_code=$? - -$BOLD_YELLOW && echo " ----------------- Current pylint cmd start --------------------------" && $RESET -echo "python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,fairseq,mxnet,onnx,onnxruntime,intel_extension_for_pytorch,intel_extension_for_tensorflow,torchinfo,horovod,transformers -/neural-compressor/${scan_module}>$log_dir/pylint.json" -$BOLD_YELLOW && echo " ----------------- Current pylint cmd end --------------------------" && $RESET - -$BOLD_YELLOW && echo " ----------------- Current log file output start --------------------------" && $RESET -cat $log_dir/pylint.json -$BOLD_YELLOW && echo " ----------------- Current log file output end --------------------------" && $RESET - -if [ ${exit_code} -ne 0 ]; then - $BOLD_RED && echo "Error!! Please Click on the artifact button to download and view Pylint error details." && $RESET - exit 1 -fi -$BOLD_PURPLE && echo "Congratulations, Pylint check passed!" && $LIGHT_PURPLE && echo " You can click on the artifact button to see the log details." && $RESET -exit 0 diff --git a/.azure-pipelines/scripts/fwk_version.sh b/.azure-pipelines/scripts/fwk_version.sh index b0ea9fa0b4f..82845e8982e 100644 --- a/.azure-pipelines/scripts/fwk_version.sh +++ b/.azure-pipelines/scripts/fwk_version.sh @@ -1,27 +1,10 @@ #!/bin/bash echo "export FWs version..." -test_mode=$1 - -if [ "$test_mode" == "coverage" ] || [ "$test_mode" == "latest" ]; then - export tensorflow_version='2.15.0-official' - export pytorch_version='2.3.0+cpu' - export torchvision_version='0.18.0+cpu' - export ipex_version='2.3.0+cpu' - export onnx_version='1.16.0' - export onnxruntime_version='1.18.0' - export mxnet_version='1.9.1' -else - export tensorflow_version='2.15.0-official' - export pytorch_version='2.2.1+cpu' - export torchvision_version='0.17.1+cpu' - export ipex_version='2.2.0+cpu' - export onnx_version='1.15.0' - export onnxruntime_version='1.17.1' - export mxnet_version='1.9.1' -fi - - - - - +export tensorflow_version='2.15.0-official' +export pytorch_version='2.3.0+cpu' +export torchvision_version='0.18.0+cpu' +export ipex_version='2.3.0+cpu' +export onnx_version='1.16.0' +export onnxruntime_version='1.18.0' +export mxnet_version='1.9.1' diff --git a/.azure-pipelines/scripts/models/env_setup.sh b/.azure-pipelines/scripts/models/env_setup.sh index 2c356d7307b..adf4f01df67 100644 --- a/.azure-pipelines/scripts/models/env_setup.sh +++ b/.azure-pipelines/scripts/models/env_setup.sh @@ -100,12 +100,6 @@ if [[ "${fwk_ver}" != "latest" ]]; then elif [[ "${framework}" == "onnxrt" ]]; then pip install onnx==1.15.0 pip install onnxruntime==${fwk_ver} - elif [[ "${framework}" == "mxnet" ]]; then - pip install numpy==1.23.5 - echo "re-install pycocotools resolve the issue with numpy..." - pip uninstall pycocotools -y - pip install --no-cache-dir pycocotools - pip install mxnet==${fwk_ver} fi fi @@ -118,9 +112,6 @@ if [ -f "requirements.txt" ]; then sed -i '/tensorflow==/d;/tensorflow$/d' requirements.txt sed -i '/^intel-tensorflow/d' requirements.txt fi - if [ "${framework}" == "mxnet" ]; then - sed -i '/mxnet==/d;/mxnet$/d;/mxnet-mkl==/d;/mxnet-mkl$/d' requirements.txt - fi if [ "${framework}" == "pytorch" ]; then sed -i '/torch==/d;/torch$/d;/torchvision==/d;/torchvision$/d' requirements.txt fi diff --git a/.azure-pipelines/scripts/models/run_model_trigger_common.sh b/.azure-pipelines/scripts/models/run_model_trigger_common.sh index 8cb5f8c9855..28201dca309 100644 --- a/.azure-pipelines/scripts/models/run_model_trigger_common.sh +++ b/.azure-pipelines/scripts/models/run_model_trigger_common.sh @@ -80,8 +80,6 @@ if [ "${mode}" == "env_setup" ]; then elif [ "${mode}" == "tuning" ]; then if [ "${framework}" == "onnxrt" ]; then output_model=${log_dir}/${model}/${framework}-${model}-tune.onnx - elif [ "${framework}" == "mxnet" ]; then - output_model=${log_dir}/${model}/resnet50_v1 elif [ "${framework}" == "tensorflow" ]; then output_model=${log_dir}/${model}/${framework}-${model}-tune.pb fi @@ -140,8 +138,6 @@ elif [ "${mode}" == "int8_benchmark" ]; then $BOLD_YELLOW && echo "====== run benchmark int8 =======" && $RESET if [[ "${framework}" == "onnxrt" ]]; then model_name="${log_dir}/${model}/${framework}-${model}-tune.onnx" - elif [[ "${framework}" == "mxnet" ]]; then - model_name="${log_dir}/${model}" elif [[ "${framework}" == "tensorflow" ]]; then model_name="${log_dir}/${model}/${framework}-${model}-tune.pb" elif [[ "${framework}" == "pytorch" ]]; then diff --git a/.azure-pipelines/scripts/models/run_mxnet_models_trigger.sh b/.azure-pipelines/scripts/models/run_mxnet_models_trigger.sh deleted file mode 100644 index 21be4c96031..00000000000 --- a/.azure-pipelines/scripts/models/run_mxnet_models_trigger.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -set -eo pipefail -# get parameters -PATTERN='[-a-zA-Z0-9_]*=' - -for i in "$@" -do - case $i in - --model=*) - model=`echo $i | sed "s/${PATTERN}//"`;; - --mode=*) - mode=`echo $i | sed "s/${PATTERN}//"`;; - --USE_TUNE_ACC=*) - USE_TUNE_ACC=`echo $i | sed "s/${PATTERN}//"`;; - --PERF_STABLE_CHECK=*) - PERF_STABLE_CHECK=`echo $i | sed "s/${PATTERN}//"`;; - --BUILD_BUILDID=*) - BUILD_BUILDID=`echo $i | sed "s/${PATTERN}//"`;; - *) - echo "Parameter $i not recognized."; exit 1;; - esac -done - -echo "specify FWs version..." -source /neural-compressor/.azure-pipelines/scripts/fwk_version.sh 'latest' -FRAMEWORK="mxnet" -FRAMEWORK_VERSION=${mxnet_version} - -inc_new_api=false -# ======== set up config for mxnet models ======== -if [ "${model}" == "resnet50v1" ]; then - model_src_dir="image_recognition/cnn_models/quantization/ptq" - dataset_location="/tf_dataset/mxnet/val_256_q90.rec" - input_model="/tf_dataset/mxnet/resnet50_v1" - yaml="cnn.yaml" - strategy="mse" - batch_size=1 - new_benchmark=false - tuning_cmd="bash run_tuning.sh --topology=resnet50_v1 --dataset_location=${dataset_location} --input_model=${input_model}" - benchmark_cmd="bash run_benchmark.sh --topology=resnet50_v1 --dataset_location=${dataset_location} --batch_size=1 --iters=500 --mode=benchmark" -fi - - -/bin/bash run_model_trigger_common.sh \ - --yaml=${yaml} \ - --framework=${FRAMEWORK} \ - --fwk_ver=${FRAMEWORK_VERSION} \ - --model=${model} \ - --model_src_dir=${model_src_dir} \ - --dataset_location=${dataset_location} \ - --input_model=${input_model} \ - --batch_size=${batch_size} \ - --strategy=${strategy} \ - --new_benchmark=${new_benchmark} \ - --tuning_cmd="${tuning_cmd}" \ - --benchmark_cmd="${benchmark_cmd}" \ - --inc_new_api="${inc_new_api}" \ - --mode=${mode} \ - --USE_TUNE_ACC=${USE_TUNE_ACC} \ - --PERF_STABLE_CHECK=${PERF_STABLE_CHECK} \ - --BUILD_BUILDID=${BUILD_BUILDID} diff --git a/.azure-pipelines/ut-basic-no-cover.yml b/.azure-pipelines/ut-basic-no-cover.yml deleted file mode 100644 index 64eaf141e82..00000000000 --- a/.azure-pipelines/ut-basic-no-cover.yml +++ /dev/null @@ -1,108 +0,0 @@ -trigger: none - -pr: - autoCancel: true - drafts: false - branches: - include: - - master - paths: - include: - - neural_compressor - - test - - setup.py - - requirements.txt - - .azure-pipelines/scripts/ut - exclude: - - test/3x - - neural_compressor/common - - neural_compressor/torch - - neural_compressor/tensorflow - - neural_compressor/onnxrt - - .azure-pipelines/scripts/ut/3x - -pool: ICX-16C - -variables: - IMAGE_NAME: "neural-compressor" - IMAGE_TAG: "py310" - UPLOAD_PATH: $(Build.SourcesDirectory)/log_dir - DOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dir - ARTIFACT_NAME: "UT_report" - REPO: $(Build.Repository.Uri) - -stages: - - stage: Adaptor - displayName: Unit Test FWKs adaptor - dependsOn: [] - jobs: - - job: - displayName: Test FWKs adaptor - steps: - - template: template/ut-template.yml - parameters: - dockerConfigName: "commonDockerConfig" - utScriptFileName: "run_basic_adaptor" - uploadPath: $(UPLOAD_PATH) - utArtifact: "ut_adaptor" - utTestMode: "no-coverage" - utContainerName: "utTest-no-coverage" - - - stage: API - displayName: Unit Test User facing API - dependsOn: [] - jobs: - - job: - displayName: Test User facing API - steps: - - template: template/ut-template.yml - parameters: - dockerConfigName: "commonDockerConfig" - utScriptFileName: "run_basic_api" - uploadPath: $(UPLOAD_PATH) - utArtifact: "ut_api" - utTestMode: "no-coverage" - utContainerName: "utTest-no-coverage" - - - stage: Pruning - displayName: Unit Test Pruning - dependsOn: [] - jobs: - - job: - displayName: Test PyTorch Pruning - steps: - - template: template/ut-template.yml - parameters: - dockerConfigName: "commonDockerConfig" - utScriptFileName: "run_basic_pt_pruning" - uploadPath: $(UPLOAD_PATH) - utArtifact: "ut_pt-pruning" - utTestMode: "no-coverage" - utContainerName: "utTest-no-coverage" - - job: - displayName: Test TensorFlow Pruning - steps: - - template: template/ut-template.yml - parameters: - dockerConfigName: "commonDockerConfig" - utScriptFileName: "run_basic_tf_pruning" - uploadPath: $(UPLOAD_PATH) - utArtifact: "ut_tf-pruning" - utTestMode: "no-coverage" - utContainerName: "utTest-no-coverage" - - - stage: Others - displayName: Unit Test other basic case - dependsOn: [] - jobs: - - job: - displayName: Test other basic case - steps: - - template: template/ut-template.yml - parameters: - dockerConfigName: "commonDockerConfig" - utScriptFileName: "run_basic_others" - uploadPath: $(UPLOAD_PATH) - utArtifact: "ut_others" - utTestMode: "no-coverage" - utContainerName: "utTest-no-coverage" diff --git a/.github/checkgroup.yml b/.github/checkgroup.yml index c1e6e147fab..9f566749da0 100644 --- a/.github/checkgroup.yml +++ b/.github/checkgroup.yml @@ -11,7 +11,6 @@ subprojects: - "Code-Scan" - "Code-Scan (Bandit Code Scan Bandit)" - "Code-Scan (DocStyle Code Scan DocStyle)" - - "Code-Scan (Pylint Code Scan Pylint)" - id: "Model Tests workflow" paths: @@ -79,27 +78,6 @@ subprojects: - "UT-Basic (Unit Test other basic case Test other basic case)" - "UT-Basic (Unit Test other cases baseline Test other cases baseline)" - - id: "Unit Tests basic no coverage workflow" - paths: - - "neural_compressor/**" - - "test/**" - - "setup.py" - - "requirements.txt" - - ".azure-pipelines/scripts/ut/**" - - "!test/3x/**" - - "!neural_compressor/common/**" - - "!neural_compressor/torch/**" - - "!neural_compressor/tensorflow/**" - - "!neural_compressor/onnxrt/**" - - "!.azure-pipelines/scripts/ut/3x/**" - checks: - - "UT-Basic-No-Coverage" - - "UT-Basic-No-Coverage (Unit Test FWKs adaptor Test FWKs adaptor)" - - "UT-Basic-No-Coverage (Unit Test Pruning Test PyTorch Pruning)" - - "UT-Basic-No-Coverage (Unit Test Pruning Test TensorFlow Pruning)" - - "UT-Basic-No-Coverage (Unit Test User facing API Test User facing API)" - - "UT-Basic-No-Coverage (Unit Test other basic case Test other basic case)" - - id: "Unit Tests ITREX workflow" paths: - "neural_compressor/**" diff --git a/docs/source/CONTRIBUTING.md b/docs/source/CONTRIBUTING.md index 58c703a20cd..3378ba30e73 100644 --- a/docs/source/CONTRIBUTING.md +++ b/docs/source/CONTRIBUTING.md @@ -48,7 +48,7 @@ IntelĀ® Neural Compressor use [Azure DevOps](https://learn.microsoft.com/en-us/a And generally use [Azure Cloud Instance](https://azure.microsoft.com/en-us/pricing/purchase-options/pay-as-you-go) to deploy pipelines, e.g. Standard E16s v5. | Test Name | Test Scope | Test Pass Criteria | |-------------------------------|-----------------------------------------------|---------------------------| -| Code Scan | Pylint/Bandit/CopyRight/DocStyle/SpellCheck | PASS | +| Code Scan | Bandit/CopyRight/DocStyle/SpellCheck | PASS | | [DCO](https://github.com/apps/dco/) | Use `git commit -s` to sign off | PASS | | Unit Test | Pytest scripts under [test](/test) | PASS (No failure, No core dump, No segmentation fault, No coverage drop) | | Model Test | Pytorch + TensorFlow + ONNX Runtime + MXNet | PASS (Functionality pass, FP32/INT8 No performance regression) |