Skip to content

Commit

Permalink
Update CI to only use python -m
Browse files Browse the repository at this point in the history
  • Loading branch information
RunningLeon committed Sep 30, 2022
1 parent b78121a commit 3d73e7d
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .circleci/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions .circleci/scripts/linux/convert_onnxruntime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion .circleci/scripts/linux/install_onnxruntime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ jobs:
- run:
name: Install pre-commit hook
command: |
pip install pre-commit
python -m pip install pre-commit
pre-commit install
- run:
name: Linting
command: pre-commit run --all-files
- 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:
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/quantize_to_ncnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down
10 changes: 5 additions & 5 deletions .github/scripts/test_mmcls_full_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,7 +22,7 @@ echo "--------------------------------------------------------------------------

mkdir -p $work_dir

python3 tools/deploy.py \
python tools/deploy.py \
$deploy_cfg \
$model_cfg \
$checkpoint \
Expand All @@ -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 \
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test_onnx2ncnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/backend-ncnn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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()'
12 changes: 6 additions & 6 deletions .github/workflows/backend-ort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/backend-pplnn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()'
2 changes: 1 addition & 1 deletion .github/workflows/backend-torchscript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/java_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
18 changes: 9 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/quantize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3d73e7d

Please sign in to comment.