Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitengXue committed Oct 9, 2023
0 parents commit b9ca0ea
Show file tree
Hide file tree
Showing 935 changed files with 145,125 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2.1

# 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]

workflows:
# the always-run workflow is always triggered, regardless of the pipeline parameters.
always-run:
jobs:
# 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: |
mmdet3d/.* lint_only false
requirements/.* lint_only false
tests/.* lint_only false
tools/.* lint_only false
configs/.* lint_only false
.circleci/.* lint_only false
projects/.* lint_only false
base-revision: dev-1.x
# 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
11 changes: 11 additions & 0 deletions .circleci/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG PYTORCH="1.8.1"
ARG CUDA="10.2"
ARG CUDNN="7"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

# To fix GPG key error when running apt-get update
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub

RUN apt-get update && apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx
186 changes: 186 additions & 0 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
version: 2.1

# the default pipeline parameters, which will be updated according to
# the results of the path-filtering orb
parameters:
lint_only:
type: boolean
default: true

jobs:
lint:
docker:
- image: cimg/python:3.7.4
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-magic --ignore-regex "__repr__" --fail-under 90 mmdet3d
build_cpu:
parameters:
# The python version must match available image tags in
# https://circleci.com/developer/images/image/cimg/python
python:
type: string
torch:
type: string
torchvision:
type: string
docker:
- image: cimg/python:<< parameters.python >>
resource_class: large
steps:
- checkout
- run:
name: Install Libraries
command: |
sudo apt-get update
sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5
- run:
name: Configure Python & pip
command: |
pip install --upgrade pip
pip install wheel
- run:
name: Install PyTorch
command: |
python -V
python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
- when:
condition:
equal: ["3.9.0", << parameters.python >>]
steps:
- run: pip install "protobuf <= 3.20.1" && sudo apt-get update && sudo apt-get -y install libprotobuf-dev protobuf-compiler cmake
- run:
name: Install mmdet3d dependencies
command: |
python -m pip install git+ssh://[email protected]/open-mmlab/mmengine.git@main
pip install -U openmim
mim install 'mmcv >= 2.0.0rc4'
pip install git+ssh://[email protected]/open-mmlab/[email protected]
pip install -r requirements.txt
- run:
name: Build and install
command: |
pip install -e .
- run:
name: Run unittests
command: |
python -m coverage run --branch --source mmdet3d -m pytest tests/
python -m coverage xml
python -m coverage report -m
build_cuda:
parameters:
torch:
type: string
cuda:
type: enum
enum: ["10.1", "10.2", "11.1"]
cudnn:
type: integer
default: 7
machine:
image: ubuntu-2004-cuda-11.4:202110-01
# docker_layer_caching: true
resource_class: gpu.nvidia.small
steps:
- checkout
- run:
# Cloning repos in VM since Docker doesn't have access to the private key
name: Clone Repos
command: |
git clone -b main --depth 1 ssh://[email protected]/open-mmlab/mmengine.git /home/circleci/mmengine
git clone -b dev-3.x --depth 1 ssh://[email protected]/open-mmlab/mmdetection.git /home/circleci/mmdetection
- run:
name: Build Docker image
command: |
docker build .circleci/docker -t mmdet3d:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
docker run --gpus all -t -d -v /home/circleci/project:/mmdetection3d -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -w /mmdetection3d --name mmdet3d mmdet3d:gpu
docker exec mmdet3d apt-get install -y git
- run:
name: Install mmdet3d dependencies
command: |
docker exec mmdet3d pip install -e /mmengine
docker exec mmdet3d pip install -U openmim
docker exec mmdet3d mim install 'mmcv >= 2.0.0rc4'
docker exec mmdet3d pip install -e /mmdetection
docker exec mmdet3d pip install -r requirements.txt
- run:
name: Build and install
command: |
docker exec mmdet3d pip install -e .
- run:
name: Run unittests
command: |
docker exec mmdet3d python -m pytest tests/
workflows:
pr_stage_lint:
when: << pipeline.parameters.lint_only >>
jobs:
- lint:
name: lint
filters:
branches:
ignore:
- dev-1.x
pr_stage_test:
when:
not: << pipeline.parameters.lint_only >>
jobs:
- lint:
name: lint
filters:
branches:
ignore:
- dev-1.x
- build_cpu:
name: minimum_version_cpu
torch: 1.6.0
torchvision: 0.7.0
python: 3.7.4 # The lowest python 3.7.x version available on CircleCI images
requires:
- lint
- build_cpu:
name: maximum_version_cpu
torch: 1.13.0
torchvision: 0.14.0
python: 3.9.0
requires:
- minimum_version_cpu
- hold:
type: approval
requires:
- maximum_version_cpu
- build_cuda:
name: mainstream_version_gpu
torch: 1.8.1
# Use double quotation mark to explicitly specify its type
# as string instead of number
cuda: "10.2"
requires:
- hold
merge_stage_test:
when:
not: << pipeline.parameters.lint_only >>
jobs:
- build_cuda:
name: minimum_version_gpu
torch: 1.6.0
cuda: "10.1"
filters:
branches:
only:
- dev-1.x
26 changes: 26 additions & 0 deletions .dev_scripts/benchmark_full_models.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
configs/3dssd/3dssd_4xb4_kitti-3d-car.py
configs/centerpoint/centerpoint_pillar02_second_secfpn_head-dcn_8xb4-cyclic-20e_nus-3d.py
configs/dynamic_voxelization/second_dv_secfpn_8xb2-cosine-80e_kitti-3d-3class.py
configs/fcaf3d/fcaf3d_2xb8_s3dis-3d-5class.py
configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mono3d.py
configs/free_anchor/pointpillars_hv_regnet-1.6gf_fpn_head-free-anchor_sbn-all_8xb4-strong-aug-3x_nus-3d.py
configs/groupfree3d/groupfree3d_head-L6-O256_4xb8_scannet-seg.py
configs/h3dnet/h3dnet_8xb3_scannet-seg.py
configs/imvotenet/imvotenet_faster-rcnn-r50_fpn_4xb2_sunrgbd-3d.py
configs/imvotenet/imvotenet_stage2_8xb16_sunrgbd-3d.py
configs/imvoxelnet/imvoxelnet_8xb4_kitti-3d-car.py
configs/mvxnet/mvxnet_fpn_dv_second_secfpn_8xb2-80e_kitti-3d-3class.py
configs/paconv/paconv_ssg_8xb8-cosine-150e_s3dis-seg.py
configs/parta2/parta2_hv_secfpn_8xb2-cyclic-80e_kitti-3d-3class.py
configs/pgd/pgd_r101-caffe_fpn_head-gn_4xb3-4x_kitti-mono3d.py
configs/point_rcnn/point-rcnn_8xb2_kitti-3d-3class.py
configs/pointnet2/pointnet2_msg_2xb16-cosine-80e_s3dis-seg.py
configs/pointnet2/pointnet2_msg_2xb16-cosine-250e_scannet-seg.py
configs/pointpillars/pointpillars_hv_secfpn_8xb6-160e_kitti-3d-3class.py
configs/pv_rcnn/pv_rcnn_8xb2-80e_kitti-3d-3class.py
configs/regnet/pointpillars_hv_regnet-1.6gf_fpn_sbn-all_8xb4-2x_nus-3d.py
configs/second/second_hv_secfpn_8xb6-80e_kitti-3d-3class.py
configs/second/second_hv_secfpn_8xb6-amp-80e_kitti-3d-3class.py
configs/smoke/smoke_dla34_dlaneck_gn-all_4xb8-6x_kitti-mono3d.py
configs/ssn/ssn_hv_secfpn_sbn-all_16xb2-2x_nus-3d.py
configs/votenet/votenet_8xb8_scannet-3d.py
11 changes: 11 additions & 0 deletions .dev_scripts/benchmark_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) OpenMMLab. All rights reserved.

third_part_libs = [
'conda install openblas-devel -c anaconda',
"pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps --install-option='--blas_include_dirs=/opt/conda/include' --install-option='--blas=openblas'" # noqa
]
default_floating_range = 0.5
model_floating_ranges = {
'configs/pointpillars/pointpillars_hv_secfpn_sbn-all_16xb2-2x_waymoD5-3d-3class.py': # noqa
0.7
}
14 changes: 14 additions & 0 deletions .dev_scripts/benchmark_train_models.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
configs/3dssd/3dssd_4xb4_kitti-3d-car.py
configs/centerpoint/centerpoint_pillar02_second_secfpn_head-dcn_8xb4-cyclic-20e_nus-3d.py
configs/dynamic_voxelization/second_dv_secfpn_8xb2-cosine-80e_kitti-3d-3class.py
configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mono3d.py
configs/mvxnet/mvxnet_fpn_dv_second_secfpn_8xb2-80e_kitti-3d-3class.py
configs/point_rcnn/point-rcnn_8xb2_kitti-3d-3class.py
configs/pointnet2/pointnet2_msg_2xb16-cosine-80e_s3dis-seg.py
configs/pointnet2/pointnet2_msg_2xb16-cosine-250e_scannet-seg.py
configs/pointpillars/pointpillars_hv_secfpn_8xb6-160e_kitti-3d-3class.py
configs/pv_rcnn/pv_rcnn_8xb2-80e_kitti-3d-3class.py
configs/second/second_hv_secfpn_8xb6-80e_kitti-3d-3class.py
configs/second/second_hv_secfpn_8xb6-amp-80e_kitti-3d-3class.py
configs/smoke/smoke_dla34_dlaneck_gn-all_4xb8-6x_kitti-mono3d.py
configs/votenet/votenet_8xb8_scannet-3d.py
6 changes: 6 additions & 0 deletions .dev_scripts/covignore.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Each line should be the relative path to the root directory
# of this repo. Support regular expression as well.
# For example:
# .*/utils.py

.*/__init__.py
42 changes: 42 additions & 0 deletions .dev_scripts/diff_coverage_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

readarray -t IGNORED_FILES < $( dirname "$0" )/covignore.cfg


REUSE_COVERAGE_REPORT=${REUSE_COVERAGE_REPORT:-0}
REPO=${1:-"origin"}
BRANCH=${2:-"refactor_dev"}

git fetch $REPO $BRANCH

PY_FILES=""
for FILE_NAME in $(git diff --name-only ${REPO}/${BRANCH}); do
# Only test python files in mmdet3d/ existing in current branch, and not ignored in covignore.cfg
if [ ${FILE_NAME: -3} == ".py" ] && [ ${FILE_NAME:0:8} == "mmdet3d/" ] && [ -f "$FILE_NAME" ]; then
IGNORED=false
for IGNORED_FILE_NAME in "${IGNORED_FILES[@]}"; do
# Skip blank lines
if [ -z "$IGNORED_FILE_NAME" ]; then
continue
fi
if [ "${IGNORED_FILE_NAME::1}" != "#" ] && [[ "$FILE_NAME" =~ $IGNORED_FILE_NAME ]]; then
echo "Ignoring $FILE_NAME"
IGNORED=true
break
fi
done
if [ "$IGNORED" = false ]; then
PY_FILES="$PY_FILES $FILE_NAME"
fi
fi
done

# Only test the coverage when PY_FILES are not empty, otherwise they will test the entire project
if [ ! -z "${PY_FILES}" ]
then
if [ "$REUSE_COVERAGE_REPORT" == "0" ]; then
coverage run --branch --source mmocr -m pytest tests/
fi
coverage report --fail-under 80 -m $PY_FILES
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 95 $PY_FILES
fi
Loading

0 comments on commit b9ca0ea

Please sign in to comment.