Skip to content
Snippets Groups Projects
Commit 7bb38af4 authored by Jirka Borovec's avatar Jirka Borovec Committed by Kai Chen
Browse files

update CI - pkg build (#1235)

* add testing in Travis

* add proj. requirements

* install CUDA

* def tested packages

* add missing meta in setup

* add empty test

* restructure travis tests

* add sample doctest

* switch to nose2

* add sample test

* using pytest

* minor fixes
parent 71a22f8c
No related branches found
No related tags found
No related merge requests found
dist: xenial
language: python
install:
- pip install isort flake8 yapf
python:
- "3.5"
- "3.6"
- "3.7"
env: CUDA=9.2.148-1 CUDA_SHORT=9.2 UBUNTU_VERSION=ubuntu1604
# Ref to CUDA installation in Travis: https://github.com/jeremad/cuda-travis
before_install:
- INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
- wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
- sudo dpkg -i ${INSTALLER}
- wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub
- sudo apt-key add 7fa2af80.pub
- sudo apt update -qq
- sudo apt install -y cuda-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-}
- sudo apt clean
- CUDA_HOME=/usr/local/cuda-${CUDA_SHORT}
- LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/include:${LD_LIBRARY_PATH}
- PATH=${CUDA_HOME}/bin:${PATH}
install:
- pip install Cython
- pip install -r requirements.txt
- pip install -r tests/requirements.txt
script:
- flake8
- isort -rc --check-only --diff mmdet/ tools/
- yapf -r -d --style .style.yapf mmdet/ tools/
\ No newline at end of file
- flake8 .
- isort -rc --check-only --diff mmdet/ tools/ tests/
- yapf -r -d --style .style.yapf mmdet/ tools/ tests/
- python setup.py check -m -s
- python setup.py build_ext --inplace
- coverage run --source mmdet -m py.test tests -v --doctest-modules
after_success:
- coverage report
\ No newline at end of file
......@@ -101,6 +101,18 @@ def flops_to_string(flops, units='GMac', precision=2):
def params_to_string(params_num):
"""converting number to string
:param float params_num: number
:returns str: number
>>> params_to_string(1e9)
'1000.0 M'
>>> params_to_string(2e5)
'200.0 k'
>>> params_to_string(3e-9)
'3e-09'
"""
if params_num // 10**6 > 0:
return str(round(params_num / 10**6, 2)) + ' M'
elif params_num // 10**3:
......
......@@ -126,6 +126,8 @@ if __name__ == '__main__':
version=get_version(),
description='Open MMLab Detection Toolbox and Benchmark',
long_description=readme(),
author='OpenMMLab',
author_email='chenkaidev@gmail.com',
keywords='computer vision, object detection',
url='https://github.com/open-mmlab/mmdetection',
packages=find_packages(exclude=('configs', 'tools', 'demo')),
......
isort
flake8
yapf
pytest-cov
codecov
\ No newline at end of file
import numpy.testing as npt
from mmdet.utils.flops_counter import params_to_string
def test_params_to_string():
npt.assert_equal(params_to_string(1e9), '1000.0 M')
npt.assert_equal(params_to_string(2e5), '200.0 k')
npt.assert_equal(params_to_string(3e-9), '3e-09')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment