Skip to content

Commit

Permalink
add gpu ci (open-mmlab#35)
Browse files Browse the repository at this point in the history
* add gpu ci

* fix ci

* set mmcv==1.4.0 in ci config

* fix ci

* import nms in forward

* udpate

* change cuda ci

* change to cuda10.2

* change to torch1.9.0

* fix

* add cuda11.1

* add empty line
  • Loading branch information
RunningLeon authored Jan 10, 2022
1 parent 3e5c785 commit 03e1213
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 14 deletions.
103 changes: 95 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ on:
- 'tools/**'
- 'docs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_cpu:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7]
torch: [1.8.0]
torch: [1.8.0, 1.9.0]
mmcv: [1.4.0]
include:
- torch: 1.8.0
torchvision: 0.9.0
mmcv: "latest+torch1.8.0+cpu"
- torch: 1.9.0
torchvision: 0.10.0
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -33,24 +39,105 @@ jobs:
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install MMCV
run: |
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch${{matrix.torch}}/index.html
pip install mmcv-full==${{matrix.mmcv}} -f https://download.openmmlab.com/mmcv/dist/cpu/torch${{matrix.torch}}/index.html
python -c 'import mmcv; print(mmcv.__version__)'
- name: Install unittest dependencies
run: |
pip install -r requirements.txt
DIR=$(pip show mmocr | grep Location)
DIR=${DIR:10}
sed -i "s/1.4.0/1.5.0/" $(find $DIR/ -path "*mmocr/__init__.py")
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdeploy -m pytest -rsE tests/
coverage xml
coverage report -m
# Upload the coverage report for python3.7 && pytorch1.8.0
build_cuda102:
runs-on: ubuntu-18.04
container:
image: pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel
env:
FORCE_CUDA: 1
strategy:
matrix:
python-version: [3.7]
torch: [1.9.0+cu102]
mmcv: [1.4.0]
include:
- torch: 1.9.0+cu102
torch_version: torch1.9.0
torchvision: 0.10.0+cu102
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev python${{matrix.python-version}}-dev
apt-get clean
rm -rf /var/lib/apt/lists/*
- name: Install PyTorch
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install dependencies
run: |
python -V
python -m pip install mmcv-full==${{matrix.mmcv}} -f https://download.openmmlab.com/mmcv/dist/cu102/${{matrix.torch_version}}/index.html
python -m pip install -r requirements.txt
- name: Build and install
run: |
rm -rf .eggs && python -m pip install -e .
python tools/check_env.py
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdeploy -m pytest -rsE tests/
coverage xml
coverage report -m
build_cuda111:
runs-on: ubuntu-18.04
container:
image: pytorch/pytorch:1.8.0-cuda11.1-cudnn8-devel

strategy:
matrix:
python-version: [3.7]
torch: [1.8.0+cu111]
mmcv: [1.4.0]
include:
- torch: 1.8.0+cu111
torch_version: torch1.8.0
torchvision: 0.9.0+cu111

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev python${{matrix.python-version}}-dev
apt-get clean
rm -rf /var/lib/apt/lists/*
- name: Install PyTorch
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install dependencies
run: |
python -V
python -m pip install mmcv-full==${{matrix.mmcv}} -f https://download.openmmlab.com/mmcv/dist/cu111/${{matrix.torch_version}}/index.html
python -m pip install -r requirements.txt
- name: Build and install
run: |
rm -rf .eggs && python -m pip install -e .
python tools/check_env.py
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmdeploy -m pytest -rsE tests/
coverage xml
coverage report -m
- name: Upload coverage to Codecov
if: ${{matrix.torch == '1.8.0' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Check docstring coverage
run: |
pip install interrogate
interrogate -v --ignore-init-method --ignore-module --ignore-private --ignore-nested-functions --ignore-nested-classes --ignore-regex "DeployBase*" --fail-under 95 mmdeploy
interrogate -v --ignore-init-method --ignore-module --ignore-private --ignore-nested-functions --ignore-nested-classes --fail-under 95 mmdeploy
- name: Check pylint score
run: |
pip install pylint
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ formats: all
python:
version: 3.7
install:
- requirements: requirements/runtime.txt
- requirements: requirements/docs.txt
- requirements: requirements/readthedocs.txt
3 changes: 1 addition & 2 deletions mmdeploy/codebase/mmdet/deploy/mmdetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import mmcv
import torch
from mmcv.utils import Registry
from mmdet.datasets import replace_ImageToTensor
from torch.utils.data import DataLoader, Dataset

from mmdeploy.utils import Codebase, get_task_type
Expand Down Expand Up @@ -58,7 +57,7 @@ def build_dataset(dataset_cfg: Union[str, mmcv.Config],
Dataset: A PyTorch dataset.
"""
from mmdet.datasets import build_dataset as build_dataset_mmdet

from mmdet.datasets import replace_ImageToTensor
assert dataset_type in dataset_cfg.data
data_cfg = dataset_cfg.data[dataset_type]
# in case the dataset is concatenated
Expand Down
2 changes: 1 addition & 1 deletion mmdeploy/mmcv/ops/nms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.ops import nms
from torch import Tensor
from torch.onnx import symbolic_helper as sym_help

Expand Down Expand Up @@ -35,6 +34,7 @@ def forward(ctx, boxes: Tensor, scores: Tensor,
(num_selected_indices, 3) with each row of
[batch_index, class_index, box_index].
"""
from mmcv.ops import nms
batch_size, num_class, _ = scores.shape

score_threshold = float(score_threshold)
Expand Down
2 changes: 1 addition & 1 deletion requirements/optional.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ mmedit
mmocr==0.3.0
mmsegmentation
onnxruntime>=1.8.0
openvino-dev[onnx,pytorch]
openvino-dev

0 comments on commit 03e1213

Please sign in to comment.