-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into test_speed
- Loading branch information
Showing
198 changed files
with
5,001 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline process engine. | ||
# See: https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||
jobs: | ||
lint: | ||
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor | ||
docker: | ||
- image: cimg/python:3.7.4 | ||
# Add steps to the job | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#steps | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install pre-commit hook | ||
command: | | ||
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 | ||
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 80 mmdeploy | ||
# this allows you to use CircleCI's dynamic configuration feature | ||
setup: true | ||
|
||
# the path-filtering orb is required to continue a pipeline based on | ||
# the path of an updated fileset | ||
orbs: | ||
path-filtering: circleci/[email protected] | ||
|
||
# Invoke jobs via workflows | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
pr_stage_test: | ||
# the always-run workflow is always triggered, regardless of the pipeline parameters. | ||
always-run: | ||
jobs: | ||
- lint | ||
# the path-filtering/filter job determines which pipeline | ||
# parameters to update. | ||
- path-filtering/filter: | ||
name: check-updated-files | ||
# 3-column, whitespace-delimited mapping. One mapping per | ||
# line: | ||
# <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter> | ||
mapping: | | ||
.circle/.* lint_only false | ||
cmake/.* lint_only false | ||
configs/.* lint_only false | ||
csrc/.* lint_only false | ||
demo/csrc/.* lint_only false | ||
docker/.* lint_only false | ||
mmdeploy/.* lint_only false | ||
requirements/.* lint_only false | ||
tests/.* lint_only false | ||
third_party/.* lint_only false | ||
tools/.* lint_only false | ||
base-revision: master | ||
# this is the path of the configuration we should trigger once | ||
# path filtering and pipeline parameter value updates are | ||
# complete. In this case, we are using the parent dynamic | ||
# configuration itself. | ||
config-path: .circleci/test.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM nvcr.io/nvidia/tensorrt:21.04-py3 | ||
|
||
ARG CUDA=11.3 | ||
ARG PYTHON_VERSION=3.8 | ||
ARG TORCH_VERSION=1.10.0 | ||
ARG TORCHVISION_VERSION=0.11.0 | ||
ARG MMCV_VERSION=1.5.0 | ||
ARG PPLCV_VERSION=0.6.2 | ||
ENV FORCE_CUDA="1" | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
### update apt and install libs | ||
RUN apt-get update &&\ | ||
apt-get install -y libopencv-dev --no-install-recommends &&\ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ | ||
chmod +x ~/miniconda.sh && \ | ||
~/miniconda.sh -b -p /opt/conda && \ | ||
rm ~/miniconda.sh && \ | ||
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} && \ | ||
/opt/conda/bin/conda clean -ya | ||
|
||
### pytorch | ||
RUN /opt/conda/bin/conda install pytorch==${TORCH_VERSION} torchvision==${TORCHVISION_VERSION} cudatoolkit=${CUDA} -c pytorch -c conda-forge | ||
ENV PATH /opt/conda/bin:$PATH | ||
|
||
### install mmcv-full | ||
RUN /opt/conda/bin/pip install mmcv-full==${MMCV_VERSION} -f https://download.openmmlab.com/mmcv/dist/cu${CUDA//./}/torch${TORCH_VERSION}/index.html | ||
|
||
WORKDIR /workspace | ||
|
||
### build ppl.cv | ||
RUN git clone https://github.com/openppl-public/ppl.cv.git &&\ | ||
cd ppl.cv &&\ | ||
git checkout tags/v${PPLCV_VERSION} -b v${PPLCV_VERSION} &&\ | ||
./build.sh cuda | ||
|
||
# RUN ln -sf /opt/conda /home/circleci/project/conda | ||
ENV TENSORRT_DIR=/workspace/tensorrt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
ARGS=("$@") | ||
|
||
cd mmdeploy | ||
MMDEPLOY_DIR=$(pwd) | ||
mkdir -p build && cd build | ||
cmake .. -DMMDEPLOY_BUILD_SDK=ON -DMMDEPLOY_BUILD_TEST=ON -DMMDEPLOY_BUILD_SDK_PYTHON_API=ON \ | ||
-DMMDEPLOY_BUILD_SDK_CXX_API=ON -DMMDEPLOY_BUILD_SDK_CSHARP_API=ON \ | ||
-DMMDEPLOY_TARGET_DEVICES="$1" -DMMDEPLOY_TARGET_BACKENDS="$2" "${ARGS[@]:2}" | ||
|
||
make -j$(nproc) && make install | ||
cd install/example | ||
mkdir -p build | ||
cd build | ||
cmake .. -DMMDeploy_DIR="$MMDEPLOY_DIR"/build/install/lib/cmake/MMDeploy "${ARGS[@]:2}" && make -j$(nproc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
if [ $# != 2 ]; then | ||
echo "wrong command. usage: bash converter.sh <codebase> <work dir>" | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" == 'mmcls' ]; then | ||
python3 -m pip install mmcls | ||
git clone --recursive https://github.com/open-mmlab/mmclassification.git | ||
wget https://download.openmmlab.com/mmclassification/v0/resnet/resnet18_8xb32_in1k_20210831-fbbb1da6.pth | ||
python3 mmdeploy/tools/deploy.py \ | ||
mmdeploy/configs/mmcls/classification_onnxruntime_dynamic.py \ | ||
mmclassification/configs/resnet/resnet18_8xb32_in1k.py \ | ||
resnet18_8xb32_in1k_20210831-fbbb1da6.pth \ | ||
mmclassification/demo/demo.JPEG \ | ||
--work-dir "$2" --dump-info | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
if [ $# != 2 ]; then | ||
echo "wrong command. usage: bash install_onnxruntime.sh <cpu|cuda> <version>" | ||
exit 1 | ||
fi | ||
|
||
PLATFORM=$1 | ||
VERSION=$2 | ||
|
||
if [ "$PLATFORM" == 'cpu' ]; then | ||
python -m pip install onnxruntime=="$VERSION" | ||
|
||
wget https://github.com/microsoft/onnxruntime/releases/download/v"$VERSION"/onnxruntime-linux-x64-"$VERSION".tgz | ||
tar -zxvf onnxruntime-linux-x64-"$VERSION".tgz | ||
ln -sf onnxruntime-linux-x64-"$VERSION" onnxruntime | ||
elif [ "$PLATFORM" == 'cuda' ]; then | ||
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 | ||
ln -sf onnxruntime-linux-x64-gpu-"$VERSION" onnxruntime | ||
else | ||
echo "'$PLATFORM' is not supported" | ||
exit 1 | ||
fi | ||
|
||
export ONNXRUNTIME_DIR=$(pwd)/onnxruntime | ||
echo "export ONNXRUNTIME_DIR=${ONNXRUNTIME_DIR}" >> ~/.bashrc | ||
echo "export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH" >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -lt 1 ]; then | ||
echo 'use python 3.8.5 as default' | ||
PYTHON_VERSION=3.8.5 | ||
else | ||
PYTHON_VERSION=$1 | ||
fi | ||
|
||
sudo apt-get update | ||
# liblzma-dev need to be installed. Refer to https://github.com/pytorch/vision/issues/2921 | ||
# python3-tk tk-dev is for 'import tkinter' | ||
sudo apt-get install -y liblzma-dev python3-tk tk-dev | ||
# python3+ need to be reinstalled due to https://github.com/pytorch/vision/issues/2921 | ||
pyenv uninstall -f "$PYTHON_VERSION" | ||
pyenv install "$PYTHON_VERSION" | ||
pyenv global "$PYTHON_VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if ($args.Count -lt 2) { | ||
Write-Host "wrong command. usage: intall_onnxruntime.ps1 <cpu|cuda> <version>" | ||
Exit 1 | ||
} | ||
|
||
$platform = $args[0] | ||
$version = $args[1] | ||
|
||
if ($platform -eq "cpu") { | ||
python -m pip install onnxruntime==$version | ||
Invoke-WebRequest -Uri https://github.com/microsoft/onnxruntime/releases/download/v$version/onnxruntime-win-x64-$version.zip -OutFile onnxruntime.zip | ||
Expand-Archive onnxruntime.zip . | ||
Move-Item onnxruntime-win-x64-$version onnxruntime | ||
} elseif ($platform == "cuda") { | ||
Write-Host "TODO: install onnxruntime-gpu" | ||
Exit | ||
} else { | ||
Write-Host "'$platform' is not supported" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Invoke-WebRequest -Uri https://download.openmmlab.com/mmdeploy/library/opencv-4.5.5.zip -OutFile opencv.zip | ||
Expand-Archive opencv.zip . | ||
Move-Item opencv-4.5.5 opencv |
Oops, something went wrong.