Skip to content

Commit c5b0e8a

Browse files
authored
[Enhancement] Upgrade CI for PyTorch1.9 (open-mmlab#712)
* Upgrade CI for PyTorch1.9 * fix typo * merge build_cu101 and build_cu102 to build_cuda * fix substitution bug * test * test * test * test * test * test * test * test * test * test * test * test * remove redudant items * add python 3.9 to CI * add python 3.9 to setup.py * remove some versions of pytorch for python 3.9 test * fix torch version error * delete mim files * update ubuntu version * fix mmcv cuda version
1 parent d35fbbd commit c5b0e8a

File tree

2 files changed

+66
-29
lines changed

2 files changed

+66
-29
lines changed

.github/workflows/build.yml

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [ push, pull_request ]
44

55
jobs:
66
lint:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-18.04
88
steps:
99
- uses: actions/checkout@v2
1010
- name: Set up Python 3.7
@@ -21,33 +21,39 @@ jobs:
2121
run: |
2222
pip install interrogate
2323
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --exclude mmseg/ops --ignore-regex "__repr__" --fail-under 80 mmseg
24-
2524
build_cpu:
2625
runs-on: ubuntu-18.04
2726
strategy:
2827
matrix:
29-
python-version: [ 3.6, 3.7 ]
30-
torch: [ 1.3.0, 1.5.0 ]
28+
python-version: [3.7]
29+
torch: [1.3.0, 1.5.0, 1.7.0, 1.9.0]
3130
include:
3231
- torch: 1.3.0
3332
torchvision: 0.4.1
3433
- torch: 1.5.0
3534
torchvision: 0.6.0
35+
- torch: 1.7.0
36+
torchvision: 0.8.1
37+
- torch: 1.9.0
38+
torchvision: 0.10.0
3639
steps:
3740
- uses: actions/checkout@v2
3841
- name: Set up Python ${{ matrix.python-version }}
3942
uses: actions/setup-python@v2
4043
with:
4144
python-version: ${{ matrix.python-version }}
45+
- name: Upgrade pip
46+
run: pip install pip --upgrade
4247
- name: Install Pillow
43-
if: ${{matrix.torchvision < 0.5}}
48+
if: ${{matrix.torchvision == '0.4.1'}}
4449
run: pip install Pillow==6.2.2
4550
- name: Install PyTorch
4651
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
4752
- name: Install mmseg dependencies
4853
run: |
4954
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch${{matrix.torch}}/index.html
5055
pip install -r requirements.txt
56+
python -c 'import mmcv; print(mmcv.__version__)'
5157
- name: Build and install
5258
run: rm -rf .eggs && pip install -e .
5359
- name: Run unittests and generate coverage report
@@ -57,55 +63,84 @@ jobs:
5763
coverage report -m
5864
5965
build_cuda:
66+
runs-on: ubuntu-18.04
6067
env:
61-
CUDA: 10.1.105-1
62-
CUDA_SHORT: 10.1
6368
UBUNTU_VERSION: ubuntu1804
64-
FORCE_CUDA: 1
65-
MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61
66-
runs-on: ubuntu-18.04
6769
strategy:
6870
matrix:
69-
python-version: [ 3.6, 3.7 ]
70-
torch: [ 1.5.0, 1.6.0, 1.7.0, 1.8.0 ]
71+
python-version: [3.7]
72+
torch: [1.5.0+cu101, 1.7.0+cu101, 1.8.0+cu101, 1.9.0+cu102]
7173
include:
72-
- torch: 1.5.0
73-
torchvision: 0.6.0
74-
- torch: 1.6.0
75-
torchvision: 0.7.0
76-
- torch: 1.7.0
77-
torchvision: 0.8.1
78-
- torch: 1.8.0
79-
torchvision: 0.9.0
74+
- torch: 1.5.0+cu101
75+
torch_version: torch1.5.0
76+
torchvision: 0.6.0+cu101
77+
CUDA: 10.1.105-1
78+
CUDA_SHORT: 10-1
79+
- torch: 1.7.0+cu101
80+
torch_version: torch1.7.0
81+
torchvision: 0.8.1+cu101
82+
CUDA: 10.1.105-1
83+
CUDA_SHORT: 10-1
84+
- torch: 1.8.0+cu101
85+
torch_version: torch1.8.0
86+
torchvision: 0.9.0+cu101
87+
CUDA: 10.1.105-1
88+
CUDA_SHORT: 10-1
89+
- torch: 1.9.0+cu102
90+
torch_version: torch1.9.0
91+
torchvision: 0.10.0+cu102
92+
CUDA: 10.2.89-1
93+
CUDA_SHORT: 10-2
94+
- python-version: 3.6
95+
torch: 1.8.0+cu101
96+
torch_version: torch1.8.0
97+
torchvision: 0.9.0+cu101
98+
CUDA: 10.1.105-1
99+
CUDA_SHORT: 10-1
100+
- python-version: 3.8
101+
torch: 1.8.0+cu101
102+
torch_version: torch1.8.0
103+
torchvision: 0.9.0+cu101
104+
CUDA: 10.1.105-1
105+
CUDA_SHORT: 10-1
106+
- python-version: 3.9
107+
torch: 1.8.0+cu101
108+
torch_version: torch1.8.0
109+
torchvision: 0.9.0+cu101
110+
CUDA: 10.1.105-1
111+
CUDA_SHORT: 10-1
80112
steps:
81113
- uses: actions/checkout@v2
82114
- name: Set up Python ${{ matrix.python-version }}
83115
uses: actions/setup-python@v2
84116
with:
85117
python-version: ${{ matrix.python-version }}
118+
- name: Upgrade pip
119+
run: pip install pip --upgrade
86120
- name: Install CUDA
87121
run: |
88-
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
122+
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${{matrix.CUDA}}_amd64.deb
89123
wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
90124
sudo dpkg -i ${INSTALLER}
91125
wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub
92126
sudo apt-key add 7fa2af80.pub
93127
sudo apt update -qq
94-
sudo apt install -y cuda-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-}
128+
sudo apt install -y cuda-${{matrix.CUDA_SHORT}} cuda-cufft-dev-${{matrix.CUDA_SHORT}}
95129
sudo apt clean
96-
export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT}
130+
export CUDA_HOME=/usr/local/cuda-${{matrix.CUDA_SHORT}}
97131
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/include:${LD_LIBRARY_PATH}
98132
export PATH=${CUDA_HOME}/bin:${PATH}
99133
sudo apt-get install -y ninja-build
100-
- name: Install Pillow
101-
if: ${{matrix.torchvision < 0.5}}
102-
run: pip install Pillow==6.2.2
103134
- name: Install PyTorch
104-
run: pip install torch==${{matrix.torch}}+cu101 torchvision==${{matrix.torchvision}}+cu101 -f https://download.pytorch.org/whl/torch_stable.html
135+
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
105136
- name: Install mmseg dependencies
106137
run: |
107-
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch${{matrix.torch}}/index.html
138+
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/${CUDA_SHORT/-/}/${{matrix.torch_version}}/index.html
108139
pip install -r requirements.txt
140+
python -c 'import mmcv; print(mmcv.__version__)'
141+
- name: Install dependencies for compiling onnx when python=3.9
142+
run: pip install protobuf && sudo apt-get install libprotobuf-dev protobuf-compiler
143+
if: ${{matrix.python-version == '3.9'}}
109144
- name: Build and install
110145
run: rm -rf .eggs && pip install -e .
111146
- name: Run unittests and generate coverage report
@@ -115,7 +150,8 @@ jobs:
115150
coverage report -m
116151
# Only upload coverage report for python3.7 && pytorch1.5
117152
- name: Upload coverage to Codecov
118-
uses: codecov/[email protected]
153+
if: ${{matrix.torch == '1.5.0+cu101' && matrix.python-version == '3.7'}}
154+
uses: codecov/[email protected]
119155
with:
120156
file: ./coverage.xml
121157
flags: unittests

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def add_mim_extension():
167167
'Programming Language :: Python :: 3.6',
168168
'Programming Language :: Python :: 3.7',
169169
'Programming Language :: Python :: 3.8',
170+
'Programming Language :: Python :: 3.9',
170171
],
171172
license='Apache License 2.0',
172173
setup_requires=parse_requirements('requirements/build.txt'),

0 commit comments

Comments
 (0)