Update CI and UT (#601)

* update ci

* update ut

* fix lint

* update
This commit is contained in:
Yixiao Fang 2022-12-02 17:09:00 +08:00 committed by GitHub
parent 6db04339a6
commit bc0807d3cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 2 deletions

View File

@ -99,6 +99,58 @@ jobs:
python setup.py check -m -s
TORCH_CUDA_ARCH_LIST=7.0 pip install -e .
build_cu116:
runs-on: ubuntu-18.04
container:
image: pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel
env:
FORCE_CUDA: 1
MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61
strategy:
matrix:
python-version: ['3.9']
torch: [1.13.0+cu116]
include:
- torch: 1.13.0+cu116
torchvision: 0.14.0+cu116
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Add PPA
run: |
apt-get update && apt-get install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
- name: Install python-dev
run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python${{matrix.python-version}}-dev
- name: python -m Install PyTorch
run: python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies
run: apt-get update && apt-get install -y ffmpeg libturbojpeg ninja-build
- name: Install MMSelfSup dependencies
run: |
pip install -U openmim
mim install mmengine
mim install 'mmcv>=2.0.0rc1'
mim install 'mmdet>=3.0.0rc0'
mim install 'mmsegmentation>=1.0.0rc0'
pip install -r requirements/tests.txt
- name: Build and install
run: |
rm -rf .eggs
pip install -e . -U
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmselfsup -m pytest tests/
coverage xml
coverage report -m
build_windows:
runs-on: ${{ matrix.os }}
strategy:

View File

@ -16,7 +16,7 @@ def get_config_list(path, file_list):
def test_configs():
path = osp.join(osp.dirname(__file__), '..', 'configs', 'benchmarks')
path = osp.join(osp.dirname(__file__), '..', 'configs')
config_list = []
get_config_list(path, config_list)

View File

@ -54,7 +54,7 @@ def test_simclr():
fake_inputs, fake_data_samples = alg.data_preprocessor(fake_data)
fake_loss = alg(fake_inputs, fake_data_samples, mode='loss')
assert fake_loss['loss'].item() > 0
assert isinstance(fake_loss['loss'].item(), float)
# test extract
fake_feat = alg(fake_inputs, fake_data_samples, mode='tensor')