[Improvement] Add more CI (#460)

* add more CI

* fix missing

* remove python-version

* fixed acc
This commit is contained in:
Jerry Jiarui XU 2021-04-08 19:29:00 -07:00 committed by GitHub
parent 99ab9bd2d9
commit d283ca6fea
3 changed files with 1110 additions and 1109 deletions

View File

@ -1,6 +1,6 @@
name: build name: build
on: [push, pull_request] on: [ push, pull_request ]
jobs: jobs:
lint: lint:
@ -29,25 +29,26 @@ jobs:
UBUNTU_VERSION: ubuntu1804 UBUNTU_VERSION: ubuntu1804
FORCE_CUDA: 1 FORCE_CUDA: 1
MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61 MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61
runs-on: ubuntu-latest runs-on: ubuntu-18.04
strategy: strategy:
matrix: matrix:
python-version: [3.6, 3.7] python-version: [ 3.6, 3.7 ]
torch: [1.3.0+cpu, 1.5.0+cpu] torch: [ 1.3.0+cpu, 1.5.0+cpu, 1.5.0+cu101, 1.6.0+cu101, 1.7.0+cu101, 1.8.0+cu101 ]
include: include:
- torch: 1.3.0+cpu - torch: 1.3.0+cpu
torchvision: 0.4.1+cpu torchvision: 0.4.1+cpu
- torch: 1.5.0+cpu - torch: 1.5.0+cpu
torchvision: 0.6.0+cpu torchvision: 0.6.0+cpu
- torch: 1.5.0+cpu
torchvision: 0.6.0+cpu
python-version: 3.8
- torch: 1.5.0+cu101 - torch: 1.5.0+cu101
torchvision: 0.6.0+cu101 torchvision: 0.6.0+cu101
python-version: 3.7
- torch: 1.6.0+cu101 - torch: 1.6.0+cu101
torchvision: 0.7.0+cu101 torchvision: 0.7.0+cu101
python-version: 3.7 - torch: 1.7.0+cu101
torchvision: 0.8.1+cu101
- torch: 1.8.0+cu101
torchvision: 0.9.0+cu101
- torch: 1.8.0+cu101
torchvision: 0.9.0+cu101
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -56,7 +57,7 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install CUDA - name: Install CUDA
if: ${{matrix.torch == '1.5.0+cu101'}} if: ${{matrix.torch == '1.5.0+cu101' || matrix.torch == '1.6.0+cu101' || matrix.torch == '1.7.0+cu101' || matrix.torch == '1.8.0+cu101'}}
run: | run: |
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER} wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
@ -88,7 +89,7 @@ jobs:
coverage report -m coverage report -m
# Only upload coverage report for python3.7 && pytorch1.5 # Only upload coverage report for python3.7 && pytorch1.5
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
if: ${{matrix.torch == '1.5.0+cu101' && matrix.python-version == '3.7'}} if: ${{matrix.torch == '1.8.0+cu101' && matrix.python-version == '3.7'}}
uses: codecov/codecov-action@v1.0.10 uses: codecov/codecov-action@v1.0.10
with: with:
file: ./coverage.xml file: ./coverage.xml

File diff suppressed because one or more lines are too long

View File

@ -44,7 +44,7 @@ def accuracy(pred, target, topk=1, thresh=None):
correct = correct & (pred_value > thresh).t() correct = correct & (pred_value > thresh).t()
res = [] res = []
for k in topk: for k in topk:
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True) correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True)
res.append(correct_k.mul_(100.0 / target.numel())) res.append(correct_k.mul_(100.0 / target.numel()))
return res[0] if return_single else res return res[0] if return_single else res