From 3d73e7d63b0510b314d4b6bc2a03febf33ff4578 Mon Sep 17 00:00:00 2001 From: RunningLeon Date: Fri, 30 Sep 2022 17:26:35 +0800 Subject: [PATCH] Update CI to only use python -m --- .circleci/docker/Dockerfile | 4 ++-- .circleci/scripts/linux/convert_onnxruntime.sh | 6 +++--- .circleci/scripts/linux/install_onnxruntime.sh | 2 +- .circleci/test.yml | 16 ++++++++-------- .github/scripts/quantize_to_ncnn.py | 2 +- .github/scripts/test_mmcls_full_pipeline.sh | 10 +++++----- .github/scripts/test_onnx2ncnn.py | 2 +- .github/workflows/backend-ncnn.yml | 12 ++++++------ .github/workflows/backend-ort.yml | 12 ++++++------ .github/workflows/backend-pplnn.yml | 8 ++++---- .github/workflows/backend-torchscript.yml | 2 +- .github/workflows/build.yml | 8 ++++---- .github/workflows/java_api.yml | 4 ++-- .github/workflows/lint.yml | 18 +++++++++--------- .github/workflows/quantize.yml | 2 +- 15 files changed, 54 insertions(+), 54 deletions(-) diff --git a/.circleci/docker/Dockerfile b/.circleci/docker/Dockerfile index 1ab3850bd0..6971faf302 100644 --- a/.circleci/docker/Dockerfile +++ b/.circleci/docker/Dockerfile @@ -28,8 +28,8 @@ ENV PATH /opt/conda/bin:$PATH ### install mim, mmengine, mmcv RUN /opt/conda/bin/pip install openmim &&\ - mim install mmengine &&\ - mim install 'mmcv>=2.0.0rc1' + python -m mim install mmengine &&\ + python -m mim install 'mmcv>=2.0.0rc1' WORKDIR /workspace diff --git a/.circleci/scripts/linux/convert_onnxruntime.sh b/.circleci/scripts/linux/convert_onnxruntime.sh index 409f6f392e..3d62aab546 100644 --- a/.circleci/scripts/linux/convert_onnxruntime.sh +++ b/.circleci/scripts/linux/convert_onnxruntime.sh @@ -6,9 +6,9 @@ if [ $# != 2 ]; then fi if [ "$1" == 'mmcls' ]; then - mim install $(cat mmdeploy/requirements/codebases.txt | grep mmcls) - mim download mmcls --config resnet18_8xb32_in1k --dest . - python3 mmdeploy/tools/deploy.py \ + python -m mim install $(cat mmdeploy/requirements/codebases.txt | grep mmcls) + python -m mim download mmcls --config resnet18_8xb32_in1k --dest . + python mmdeploy/tools/deploy.py \ mmdeploy/configs/mmcls/classification_onnxruntime_dynamic.py \ ./resnet18_8xb32_in1k.py \ ./resnet18_8xb32_in1k_20210831-fbbb1da6.pth \ diff --git a/.circleci/scripts/linux/install_onnxruntime.sh b/.circleci/scripts/linux/install_onnxruntime.sh index 797673b6bf..b8f6ec6fc4 100644 --- a/.circleci/scripts/linux/install_onnxruntime.sh +++ b/.circleci/scripts/linux/install_onnxruntime.sh @@ -15,7 +15,7 @@ if [ "$PLATFORM" == 'cpu' ]; then tar -zxvf onnxruntime-linux-x64-"$VERSION".tgz ln -sf onnxruntime-linux-x64-"$VERSION" onnxruntime elif [ "$PLATFORM" == 'cuda' ]; then - pip install onnxruntime-gpu=="$VERSION" + python -m pip install onnxruntime-gpu=="$VERSION" wget https://github.com/microsoft/onnxruntime/releases/download/v"$VERSION"/onnxruntime-linux-x64-gpu-"$VERSION".tgz tar -zxvf onnxruntime-linux-x64-gpu-"$VERSION".tgz diff --git a/.circleci/test.yml b/.circleci/test.yml index 8b737959c4..52b1fb20a9 100644 --- a/.circleci/test.yml +++ b/.circleci/test.yml @@ -113,7 +113,7 @@ jobs: - run: name: Install pre-commit hook command: | - pip install pre-commit + python -m pip install pre-commit pre-commit install - run: name: Linting @@ -121,7 +121,7 @@ jobs: - run: name: Check docstring coverage command: | - pip install interrogate + python -m pip install interrogate interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmdeploy test_linux_tensorrt: @@ -141,15 +141,15 @@ jobs: name: Install MMDeploy # https://stackoverflow.com/questions/28037802/docker-exec-failed-cd-executable-file-not-found-in-path command: | - docker exec -i mmdeploy bash -c "cd mmdeploy && pip install -v -e ." + docker exec -i mmdeploy bash -c "cd mmdeploy && python -m pip install -v -e ." - run: name: Install requirements command: | - docker exec mmdeploy pip install onnxruntime==1.8.1 - docker exec mmdeploy mim install -r mmdeploy/requirements/codebases.txt - docker exec mmdeploy pip install -r mmdeploy/requirements/tests.txt - docker exec mmdeploy pip install -r mmdeploy/requirements/runtime.txt - docker exec mmdeploy pip install -U numpy + docker exec mmdeploy python -m pip install onnxruntime==1.8.1 + docker exec mmdeploy python -m mim install -r mmdeploy/requirements/codebases.txt + docker exec mmdeploy python -m pip install -r mmdeploy/requirements/tests.txt + docker exec mmdeploy python -m pip install -r mmdeploy/requirements/runtime.txt + docker exec mmdeploy python -m pip install -U numpy - run: name: Perform Model Converter unittests command: | diff --git a/.github/scripts/quantize_to_ncnn.py b/.github/scripts/quantize_to_ncnn.py index 337264b0c1..f4e40098d9 100644 --- a/.github/scripts/quantize_to_ncnn.py +++ b/.github/scripts/quantize_to_ncnn.py @@ -47,7 +47,7 @@ def main(): model_cfg = conf[2] deploy_cfg = 'configs/mmcls/classification_ncnn-int8_static.py' quant_cmd = [ - 'python3', 'tools/onnx2ncnn_quant_table.py', '--onnx', model, + 'python', 'tools/onnx2ncnn_quant_table.py', '--onnx', model, '--deploy-cfg', deploy_cfg, '--model-cfg', model_cfg, '--out-onnx', 'quant.onnx', '--out-table', 'ncnn.table', '--image-dir', data_dir ] diff --git a/.github/scripts/test_mmcls_full_pipeline.sh b/.github/scripts/test_mmcls_full_pipeline.sh index f4906360dd..178b784f75 100644 --- a/.github/scripts/test_mmcls_full_pipeline.sh +++ b/.github/scripts/test_mmcls_full_pipeline.sh @@ -2,11 +2,11 @@ set -e # print env -python3 tools/check_env.py +python tools/check_env.py deploy_cfg=configs/mmcls/classification_onnxruntime_dynamic.py device=cpu -mim download mmcls --config resnet18_8xb32_in1k --dest ../ +python -m mim download mmcls --config resnet18_8xb32_in1k --dest ../ model_cfg=../resnet18_8xb32_in1k.py checkpoint=../resnet18_8xb32_in1k_20210831-fbbb1da6.pth sdk_cfg=configs/mmcls/classification_sdk_dynamic.py @@ -22,7 +22,7 @@ echo "-------------------------------------------------------------------------- mkdir -p $work_dir -python3 tools/deploy.py \ +python tools/deploy.py \ $deploy_cfg \ $model_cfg \ $checkpoint \ @@ -37,7 +37,7 @@ unzip data/imagenet-val100.zip -d data/ echo "Running test with ort" -python3 tools/test.py \ +python tools/test.py \ $deploy_cfg \ $model_cfg \ --model $work_dir/end2end.onnx \ @@ -54,7 +54,7 @@ echo "Running test with sdk" # change topk for test sed -i 's/"topk": 5/"topk": 1000/g' work_dir/pipeline.json -python3 tools/test.py \ +python tools/test.py \ $sdk_cfg \ $model_cfg \ --model $work_dir \ diff --git a/.github/scripts/test_onnx2ncnn.py b/.github/scripts/test_onnx2ncnn.py index 7fc701e3a5..fb3a0938d2 100644 --- a/.github/scripts/test_onnx2ncnn.py +++ b/.github/scripts/test_onnx2ncnn.py @@ -55,7 +55,7 @@ def generate_onnx(args): config = os.path.join(args.repo_dir, conf[0]) model = conf[1] convert_cmd = [ - 'python3', 'tools/deploy.py', + 'python', 'tools/deploy.py', 'configs/mmcls/classification_ncnn_static.py', config, model, 'cat-dog.png', '--work-dir', 'work_dir', '--device', 'cpu' ] diff --git a/.github/workflows/backend-ncnn.yml b/.github/workflows/backend-ncnn.yml index b6b486b76d..7cf75022ca 100644 --- a/.github/workflows/backend-ncnn.yml +++ b/.github/workflows/backend-ncnn.yml @@ -33,7 +33,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install unittest dependencies run: | - pip install cmake onnx + python -m pip install cmake onnx - name: update run: sudo apt update - name: gcc-multilib @@ -59,7 +59,7 @@ jobs: run: | echo $(pwd) ln -s build/bin/mmdeploy_onnx2ncnn ./ - python3 .github/scripts/test_onnx2ncnn.py --run 1 + python .github/scripts/test_onnx2ncnn.py --run 1 script_install: runs-on: ubuntu-20.04 strategy: @@ -76,7 +76,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install mmdeploy run: | - python3 tools/scripts/build_ubuntu_x64_ncnn.py - python3 -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu - python3 -m pip install mmcv-lite mmengine - python3 -c 'import mmdeploy.apis.ncnn as ncnn_api; assert ncnn_api.is_available() and ncnn_api.is_custom_ops_available()' + python tools/scripts/build_ubuntu_x64_ncnn.py + python -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu + python -m pip install mmcv-lite mmengine + python -c 'import mmdeploy.apis.ncnn as ncnn_api; assert ncnn_api.is_available() and ncnn_api.is_custom_ops_available()' diff --git a/.github/workflows/backend-ort.yml b/.github/workflows/backend-ort.yml index e89dd85688..23b436fbde 100644 --- a/.github/workflows/backend-ort.yml +++ b/.github/workflows/backend-ort.yml @@ -33,14 +33,14 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install mmdeploy run: | - python3 tools/scripts/build_ubuntu_x64_ort.py - python3 -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu - python3 -m pip install mmcv-lite mmengine - python3 -c 'import mmdeploy.apis.onnxruntime as ort_api; assert ort_api.is_available() and ort_api.is_custom_ops_available()' + python tools/scripts/build_ubuntu_x64_ort.py + python -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu + python -m pip install mmcv-lite mmengine + python -c 'import mmdeploy.apis.onnxruntime as ort_api; assert ort_api.is_available() and ort_api.is_custom_ops_available()' - name: test mmcls full pipeline run: | - pip install openmim - mim install $(cat requirements/codebases.txt | grep mmcls) + python -m pip install openmim + python -m mim install $(cat requirements/codebases.txt | grep mmcls) export MMDEPLOY_DIR=$(pwd) export ONNXRUNTIME_DIR=$MMDEPLOY_DIR/../mmdeploy-dep/onnxruntime-linux-x64-1.8.1 export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$MMDEPLOY_DIR/build/install/lib:$LD_LIBRARY_PATH diff --git a/.github/workflows/backend-pplnn.yml b/.github/workflows/backend-pplnn.yml index be34dc0b72..c25497de07 100644 --- a/.github/workflows/backend-pplnn.yml +++ b/.github/workflows/backend-pplnn.yml @@ -33,7 +33,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install mmdeploy run: | - python3 tools/scripts/build_ubuntu_x64_pplnn.py - python3 -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu - python3 -m pip install mmcv-lite mmengine - python3 -c 'import mmdeploy.apis.pplnn as pplnn_api; assert pplnn_api.is_available()' + python tools/scripts/build_ubuntu_x64_pplnn.py + python -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu + python -m pip install mmcv-lite mmengine + python -c 'import mmdeploy.apis.pplnn as pplnn_api; assert pplnn_api.is_available()' diff --git a/.github/workflows/backend-torchscript.yml b/.github/workflows/backend-torchscript.yml index b7f6b690ba..d52f372be1 100644 --- a/.github/workflows/backend-torchscript.yml +++ b/.github/workflows/backend-torchscript.yml @@ -33,4 +33,4 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install mmdeploy run: | - python3 tools/scripts/build_ubuntu_x64_torchscript.py + python tools/scripts/build_ubuntu_x64_torchscript.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02e4124167..746e939aa3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install PyTorch - run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html + run: python -m pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html - name: Install unittest dependencies run: | python -m pip install openmim @@ -53,7 +53,7 @@ jobs: python -m pip list - name: Build and install run: | - rm -rf .eggs && pip install -e . + rm -rf .eggs && python -m pip install -e . python tools/check_env.py - name: Run python unittests and generate coverage report run: | @@ -131,7 +131,7 @@ jobs: python -m pip list - name: Build and install run: | - rm -rf .eggs && pip install -e . + rm -rf .eggs && python -m python -m pip install -e . python tools/check_env.py - name: Run unittests and generate coverage report run: | @@ -180,7 +180,7 @@ jobs: python -m pip list - name: Build and install run: | - rm -rf .eggs && pip install -e . + rm -rf .eggs && python -m pip install -e . python tools/check_env.py - name: Run unittests and generate coverage report run: | diff --git a/.github/workflows/java_api.yml b/.github/workflows/java_api.yml index c2e5b9317d..296ac3b5cc 100644 --- a/.github/workflows/java_api.yml +++ b/.github/workflows/java_api.yml @@ -28,7 +28,7 @@ jobs: python-version: 3.7 - name: Install unittest dependencies run: | - pip install cmake onnx + python -m pip install cmake onnx - name: update run: sudo apt update - name: Install OpenJDK @@ -69,4 +69,4 @@ jobs: export PATH=${JAVA_HOME}/bin:${PATH} export LD_LIBRARY_PATH=/build/lib:${LD_LIBRARY_PATH} java --version - python3 .github/scripts/test_java_demo.py + python .github/scripts/test_java_demo.py diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5a5743bc3a..07320fe5a2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: python-version: 3.7 - name: Install pre-commit hook run: | - pip install pre-commit + python -m pip install pre-commit pre-commit install - name: Linting run: pre-commit run --all-files @@ -25,19 +25,19 @@ jobs: style: file - name: Check index.rst run: | - python3 .github/scripts/check_index_rst.py docs/en/index.rst - python3 .github/scripts/check_index_rst.py docs/zh_cn/index.rst + python .github/scripts/check_index_rst.py docs/en/index.rst + python .github/scripts/check_index_rst.py docs/zh_cn/index.rst - name: Check doc link run: | - python3 .github/scripts/doc_link_checker.py --target docs/zh_cn - python3 .github/scripts/doc_link_checker.py --target README_zh-CN.md - python3 .github/scripts/doc_link_checker.py --target docs/en - python3 .github/scripts/doc_link_checker.py --target README.md + python .github/scripts/doc_link_checker.py --target docs/zh_cn + python .github/scripts/doc_link_checker.py --target README_zh-CN.md + python .github/scripts/doc_link_checker.py --target docs/en + python .github/scripts/doc_link_checker.py --target README.md - name: Check docstring coverage run: | - pip install interrogate + python -m pip install interrogate interrogate -v --ignore-init-method --ignore-module --ignore-private --ignore-nested-functions --ignore-nested-classes --fail-under 80 mmdeploy - name: Check pylint score run: | - pip install pylint + python -m pip install pylint pylint mmdeploy diff --git a/.github/workflows/quantize.yml b/.github/workflows/quantize.yml index 441214bd9c..361b5cdce3 100644 --- a/.github/workflows/quantize.yml +++ b/.github/workflows/quantize.yml @@ -69,4 +69,4 @@ jobs: - name: Run tests run: | echo $(pwd) - python3 .github/scripts/quantize_to_ncnn.py + python .github/scripts/quantize_to_ncnn.py