Skip to content

Commit 04c2714

Browse files
authored
feat: Add new mmdetection (#19)
#16
1 parent 22f0674 commit 04c2714

File tree

2,388 files changed

+291164
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,388 files changed

+291164
-0
lines changed

newmm/.circleci/config.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 2.1
2+
3+
# this allows you to use CircleCI's dynamic configuration feature
4+
setup: true
5+
6+
# the path-filtering orb is required to continue a pipeline based on
7+
# the path of an updated fileset
8+
orbs:
9+
path-filtering: circleci/path-filtering@0.1.2
10+
11+
workflows:
12+
# the always-run workflow is always triggered, regardless of the pipeline parameters.
13+
always-run:
14+
jobs:
15+
# the path-filtering/filter job determines which pipeline
16+
# parameters to update.
17+
- path-filtering/filter:
18+
name: check-updated-files
19+
# 3-column, whitespace-delimited mapping. One mapping per
20+
# line:
21+
# <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
22+
mapping: |
23+
mmdet/.* lint_only false
24+
requirements/.* lint_only false
25+
tests/.* lint_only false
26+
tools/.* lint_only false
27+
configs/.* lint_only false
28+
.circleci/.* lint_only false
29+
base-revision: dev-3.x
30+
# this is the path of the configuration we should trigger once
31+
# path filtering and pipeline parameter value updates are
32+
# complete. In this case, we are using the parent dynamic
33+
# configuration itself.
34+
config-path: .circleci/test.yml

newmm/.circleci/docker/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG PYTORCH="1.8.1"
2+
ARG CUDA="10.2"
3+
ARG CUDNN="7"
4+
5+
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
6+
7+
# To fix GPG key error when running apt-get update
8+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
9+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
10+
11+
RUN apt-get update && apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx

newmm/.circleci/test.yml

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
version: 2.1
2+
3+
# the default pipeline parameters, which will be updated according to
4+
# the results of the path-filtering orb
5+
parameters:
6+
lint_only:
7+
type: boolean
8+
default: true
9+
10+
jobs:
11+
lint:
12+
docker:
13+
- image: cimg/python:3.7.4
14+
steps:
15+
- checkout
16+
- run:
17+
name: Install pre-commit hook
18+
command: |
19+
pip install pre-commit
20+
pre-commit install
21+
- run:
22+
name: Linting
23+
command: pre-commit run --all-files
24+
- run:
25+
name: Check docstring coverage
26+
command: |
27+
pip install interrogate
28+
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 85 mmdet
29+
30+
build_cpu:
31+
parameters:
32+
# The python version must match available image tags in
33+
# https://circleci.com/developer/images/image/cimg/python
34+
python:
35+
type: string
36+
torch:
37+
type: string
38+
torchvision:
39+
type: string
40+
docker:
41+
- image: cimg/python:<< parameters.python >>
42+
resource_class: large
43+
steps:
44+
- checkout
45+
- run:
46+
name: Install Libraries
47+
command: |
48+
sudo apt-get update
49+
sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5
50+
- run:
51+
name: Configure Python & pip
52+
command: |
53+
pip install --upgrade pip
54+
pip install wheel
55+
- run:
56+
name: Install PyTorch
57+
command: |
58+
python -V
59+
python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
60+
- when:
61+
condition:
62+
equal: ["3.9.0", << parameters.python >>]
63+
steps:
64+
- run: pip install "protobuf <= 3.20.1" && sudo apt-get update && sudo apt-get -y install libprotobuf-dev protobuf-compiler cmake
65+
- run: pip install dsdl
66+
- run:
67+
name: Install mmdet dependencies
68+
# numpy may be downgraded after building pycocotools, which causes `ImportError: numpy.core.multiarray failed to import`
69+
# force reinstall pycocotools to ensure pycocotools being built under the currenct numpy
70+
command: |
71+
python -m pip install git+ssh://git@github.com/open-mmlab/mmengine.git@main
72+
pip install -U openmim
73+
mim install 'mmcv >= 2.0.0rc4'
74+
pip install -r requirements/tests.txt -r requirements/optional.txt
75+
pip install --force-reinstall pycocotools
76+
pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
77+
pip install -r requirements/tracking.txt
78+
pip install git+https://github.com/cocodataset/panopticapi.git
79+
pip install git+https://github.com/JonathonLuiten/TrackEval.git
80+
- run:
81+
name: Build and install
82+
command: |
83+
pip install -e .
84+
- run:
85+
name: Run unittests
86+
command: |
87+
python -m coverage run --branch --source mmdet -m pytest tests/
88+
python -m coverage xml
89+
python -m coverage report -m
90+
91+
build_cuda:
92+
parameters:
93+
torch:
94+
type: string
95+
cuda:
96+
type: enum
97+
enum: ["11.1", "11.7", "11.8"]
98+
cudnn:
99+
type: integer
100+
default: 8
101+
machine:
102+
image: linux-cuda-11:default
103+
# docker_layer_caching: true
104+
resource_class: gpu.nvidia.small.multi
105+
steps:
106+
- checkout
107+
- run:
108+
# CLoning repos in VM since Docker doesn't have access to the private key
109+
name: Clone Repos
110+
command: |
111+
git clone -b main --depth 1 ssh://git@github.com/open-mmlab/mmengine.git /home/circleci/mmengine
112+
- run:
113+
name: Install nvidia-container-toolkit and Restart Docker
114+
command: |
115+
sudo apt-get update
116+
sudo apt-get install -y nvidia-container-toolkit
117+
sudo systemctl restart docker
118+
- run:
119+
name: Build Docker image
120+
command: |
121+
docker build .circleci/docker -t mmdetection:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
122+
docker run --gpus all -t -d -v /home/circleci/project:/mmdetection -v /home/circleci/mmengine:/mmengine -w /mmdetection --name mmdetection mmdetection:gpu
123+
docker exec mmdetection apt-get install -y git
124+
- run:
125+
name: Install mmdet dependencies
126+
command: |
127+
docker exec mmdetection pip install -e /mmengine
128+
docker exec mmdetection pip install -U openmim
129+
docker exec mmdetection mim install 'mmcv >= 2.0.0rc4'
130+
docker exec mmdetection pip install -r requirements/tests.txt -r requirements/optional.txt
131+
docker exec mmdetection pip install pycocotools
132+
docker exec mmdetection pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
133+
docker exec mmdetection pip install -r requirements/tracking.txt
134+
docker exec mmdetection pip install git+https://github.com/cocodataset/panopticapi.git
135+
docker exec mmdetection pip install git+https://github.com/JonathonLuiten/TrackEval.git
136+
docker exec mmdetection python -c 'import mmcv; print(mmcv.__version__)'
137+
- run:
138+
name: Build and install
139+
command: |
140+
docker exec mmdetection pip install -e .
141+
- run:
142+
name: Run unittests
143+
command: |
144+
docker exec mmdetection python -m pytest tests/
145+
146+
workflows:
147+
pr_stage_lint:
148+
when: << pipeline.parameters.lint_only >>
149+
jobs:
150+
- lint:
151+
name: lint
152+
filters:
153+
branches:
154+
ignore:
155+
- dev-3.x
156+
pr_stage_test:
157+
when:
158+
not: << pipeline.parameters.lint_only >>
159+
jobs:
160+
- lint:
161+
name: lint
162+
filters:
163+
branches:
164+
ignore:
165+
- dev-3.x
166+
- build_cpu:
167+
name: minimum_version_cpu
168+
torch: 1.8.0
169+
torchvision: 0.9.0
170+
python: 3.7.16
171+
requires:
172+
- lint
173+
- build_cpu:
174+
name: maximum_version_cpu
175+
torch: 2.0.0
176+
torchvision: 0.15.1
177+
python: 3.9.0
178+
requires:
179+
- minimum_version_cpu
180+
- hold:
181+
type: approval
182+
requires:
183+
- maximum_version_cpu
184+
- build_cuda:
185+
name: mainstream_version_gpu
186+
torch: 1.8.1
187+
# Use double quotation mark to explicitly specify its type
188+
# as string instead of number
189+
cuda: "11.1"
190+
requires:
191+
- hold
192+
- build_cuda:
193+
name: maximum_version_gpu
194+
torch: 2.0.0
195+
cuda: "11.7"
196+
cudnn: 8
197+
requires:
198+
- hold
199+
merge_stage_test:
200+
when:
201+
not: << pipeline.parameters.lint_only >>
202+
jobs:
203+
- build_cuda:
204+
name: minimum_version_gpu
205+
torch: 1.8.0
206+
cuda: "11.1"
207+
filters:
208+
branches:
209+
only:
210+
- dev-3.x

0 commit comments

Comments
 (0)