Skip to content

Commit 550e02b

Browse files
hellockxvjiarui
andauthored
Add pypi deployment (open-mmlab#11)
* add pypi deployment * remove useless jobs * fixed typo and cleanup * delete build.tx * add change log Co-authored-by: Jiarui XU <[email protected]>
1 parent b975d3b commit 550e02b

File tree

12 files changed

+89
-124
lines changed

12 files changed

+89
-124
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ We use the following tools for linting and formatting:
2727
- [yapf](https://github.com/google/yapf): formatter
2828
- [isort](https://github.com/timothycrosley/isort): sort imports
2929

30-
Style configurations of yapf and isort can be found in [.style.yapf](../.style.yapf) and [.isort.cfg](../.isort.cfg).
30+
Style configurations of yapf and isort can be found in [setup.cfg](../setup.cfg) and [.isort.cfg](../.isort.cfg).
3131

3232
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`,
3333
fixes `end-of-files`, sorts `requirments.txt` automatically on every commit.

.github/workflows/build.yml

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: build
52

63
on: [push, pull_request]
74

85
jobs:
9-
106
lint:
117
runs-on: ubuntu-latest
128
steps:
@@ -53,49 +49,49 @@ jobs:
5349
python-version: 3.7
5450

5551
steps:
56-
- uses: actions/checkout@v2
57-
- name: Set up Python ${{ matrix.python-version }}
58-
uses: actions/setup-python@v2
59-
with:
60-
python-version: ${{ matrix.python-version }}
61-
- name: Install CUDA
62-
if: ${{matrix.torch == '1.5.0+cu101'}}
63-
run: |
64-
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
65-
wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
66-
sudo dpkg -i ${INSTALLER}
67-
wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub
68-
sudo apt-key add 7fa2af80.pub
69-
sudo apt update -qq
70-
sudo apt install -y cuda-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-}
71-
sudo apt clean
72-
export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT}
73-
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/include:${LD_LIBRARY_PATH}
74-
export PATH=${CUDA_HOME}/bin:${PATH}
75-
sudo apt-get install -y ninja-build
76-
- name: Install Pillow
77-
if: ${{matrix.torchvision == '0.4.2+cpu'}}
78-
run: pip install Pillow==6.2.2
79-
- name: Install PyTorch
80-
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
81-
- name: Install mmseg dependencies
82-
run: |
83-
pip install mmcv-full==latest+torch${{matrix.torch}} -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
84-
pip install -r requirements.txt
85-
- name: Build and install
86-
run: rm -rf .eggs && pip install -e .
87-
- name: Run unittests and generate coverage report
88-
run: |
89-
coverage run --branch --source mmseg -m pytest tests/
90-
coverage xml
91-
coverage report -m --omit="mmseg/utils/*","mmseg/apis/*"
92-
# Only upload coverage report for python3.7 && pytorch1.5
93-
- name: Upload coverage to Codecov
94-
if: ${{matrix.torch == '1.5.0+cu101' && matrix.python-version == '3.7'}}
95-
uses: codecov/[email protected]
96-
with:
97-
file: ./coverage.xml
98-
flags: unittests
99-
env_vars: OS,PYTHON
100-
name: codecov-umbrella
101-
fail_ci_if_error: false
52+
- uses: actions/checkout@v2
53+
- name: Set up Python ${{ matrix.python-version }}
54+
uses: actions/setup-python@v2
55+
with:
56+
python-version: ${{ matrix.python-version }}
57+
- name: Install CUDA
58+
if: ${{matrix.torch == '1.5.0+cu101'}}
59+
run: |
60+
export INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
61+
wget http://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/${INSTALLER}
62+
sudo dpkg -i ${INSTALLER}
63+
wget https://developer.download.nvidia.com/compute/cuda/repos/${UBUNTU_VERSION}/x86_64/7fa2af80.pub
64+
sudo apt-key add 7fa2af80.pub
65+
sudo apt update -qq
66+
sudo apt install -y cuda-${CUDA_SHORT/./-} cuda-cufft-dev-${CUDA_SHORT/./-}
67+
sudo apt clean
68+
export CUDA_HOME=/usr/local/cuda-${CUDA_SHORT}
69+
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/include:${LD_LIBRARY_PATH}
70+
export PATH=${CUDA_HOME}/bin:${PATH}
71+
sudo apt-get install -y ninja-build
72+
- name: Install Pillow
73+
if: ${{matrix.torchvision == '0.4.2+cpu'}}
74+
run: pip install Pillow==6.2.2
75+
- name: Install PyTorch
76+
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
77+
- name: Install mmseg dependencies
78+
run: |
79+
pip install mmcv-full==latest+torch${{matrix.torch}} -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
80+
pip install -r requirements.txt
81+
- name: Build and install
82+
run: rm -rf .eggs && pip install -e .
83+
- name: Run unittests and generate coverage report
84+
run: |
85+
coverage run --branch --source mmseg -m pytest tests/
86+
coverage xml
87+
coverage report -m
88+
# Only upload coverage report for python3.7 && pytorch1.5
89+
- name: Upload coverage to Codecov
90+
if: ${{matrix.torch == '1.5.0+cu101' && matrix.python-version == '3.7'}}
91+
uses: codecov/[email protected]
92+
with:
93+
file: ./coverage.xml
94+
flags: unittests
95+
env_vars: OS,PYTHON
96+
name: codecov-umbrella
97+
fail_ci_if_error: false

.github/workflows/deploy.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: deploy
2+
3+
on: push
4+
5+
jobs:
6+
build-n-publish:
7+
runs-on: ubuntu-latest
8+
if: startsWith(github.event.ref, 'refs/tags')
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python 3.7
12+
uses: actions/setup-python@v2
13+
with:
14+
python-version: 3.7
15+
- name: Build MMSegmentation
16+
run: python setup.py sdist bdist_wheel
17+
- name: Publish distribution to PyPI
18+
run: |
19+
pip install twine
20+
twine upload dist/* -u __token__ -p ${{ secrets.pypi_password }}

.style.yapf

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ The master branch works with **PyTorch 1.3 to 1.5**.
4141

4242
This project is released under the [Apache 2.0 license](LICENSE).
4343

44+
## Changelog
45+
46+
v0.5.0 was released in 10/7/2020.
47+
4448
## Benchmark and model zoo
4549

4650
Results and models are available in the [model zoo](docs/model_zoo.md).

docs/install.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,31 @@ conda activate open-mmlab
1818

1919
b. Install PyTorch and torchvision following the [official instructions](https://pytorch.org/).
2020
Here we use PyTorch 1.5.0 and CUDA 10.1.
21-
You may also switch to other version by specifying version number.
21+
You may also switch to other version by specifying the version number.
2222

2323
```shell
2424
conda install pytorch=1.5.0 torchvision cudatoolkit=10.1 -c pytorch
2525
```
2626

27-
c. Clone the mmsegmentation repository.
27+
c. Install [MMCV](https://mmcv.readthedocs.io/en/latest/) following the [official instructions](https://mmcv.readthedocs.io/en/latest/#installation).
28+
Either `mmcv` or `mmcv-full` is compatible with MMSegmentation, but for methods like CCNet and PSANet, CUDA ops in `mmcv-full` is required
2829

29-
```shell
30-
git clone http://github.com/open-mmlab/mmsegmentation
31-
cd mmsegmentation
32-
```
33-
34-
d. Install [MMCV](https://mmcv.readthedocs.io/en/latest/).
35-
Either *mmcv* or *mmcv-full* is compatible with MMSegmentation, but for methods like CCNet and PSANet, CUDA ops in *mmcv-full* is required
30+
The pre-build mmcv-full (with PyTorch 1.5 and CUDA 10.1) can be installed by running: (other available versions could be found [here](https://mmcv.readthedocs.io/en/latest/#install-with-pip))
3631

37-
The pre-build *mmcv-full* could be installed by running: (available versions could be found [here](https://mmcv.readthedocs.io/en/latest/#install-with-pip))
38-
```
32+
```shell
3933
pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
4034
```
4135

42-
Optionally, you could also install lite version by running:
43-
```
44-
pip install mmcv
45-
```
46-
or build full version from source:
47-
```
48-
pip install mmcv-full
36+
d. Install MMSegmentation.
37+
38+
```shell
39+
pip install mmseg # install the latest release
4940
```
5041

51-
e. Install build requirements and then install MMSegmentation.
42+
or
5243

5344
```shell
54-
pip install -r requirements/build.txt # or "pip install -r requirements.txt" for everything.
55-
pip install -e . # or "python setup.py develop"
45+
pip install git+https://github.com/open-mmlab/mmsegmentation.git # install the master branch
5646
```
5747

5848
Note:
@@ -68,7 +58,6 @@ you can install it before installing MMCV.
6858
4. Some dependencies are optional. Simply running `pip install -e .` will only install the minimum runtime requirements.
6959
To use optional dependencies like `cityscapessripts` either install them manually with `pip install -r requirements/optional.txt` or specify desired extras when calling `pip` (e.g. `pip install -e .[optional]`). Valid keys for the extras field are: `all`, `tests`, `build`, and `optional`.
7060

71-
7261
### A from-scratch setup script
7362

7463
Here is a full script for setting up mmsegmentation with conda and link the dataset path (supposing that your dataset path is $DATA_ROOT).
@@ -78,11 +67,8 @@ conda create -n open-mmlab python=3.7 -y
7867
conda activate open-mmlab
7968

8069
conda install pytorch=1.5.0 torchvision cudatoolkit=10.1 -c pytorch
81-
git clone http://github.com/open-mmlab/mmsegmentation
82-
cd mmsegmentation
8370
pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
84-
pip install -r requirements/build.txt
85-
pip install -e .
71+
pip install git+https://github.com/open-mmlab/mmsegmentation.git
8672

8773
mkdir data
8874
ln -s $DATA_ROOT data

docs/model_zoo.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ Please refer to [PSPNet](https://github.com/open-mmlab/mmsegmentation/blob/maste
3535

3636
### DeepLabV3
3737

38-
Please refer to [DeepLabV3](https://github.com/open-mmlab/mmsegmentatio/blob/master/configs/deeplabv3) for details.
38+
Please refer to [DeepLabV3](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3) for details.
3939

4040
### PSANet
4141

4242
Please refer to [PSANet](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/psanet) for details.
4343

4444
### DeepLabV3+
4545

46-
Please refer to [DeepLabV3+](https://github.com/open-mmlab/mmsegmentatio/blob/master/configs/deeplabv3plus) for details.
46+
Please refer to [DeepLabV3+](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/deeplabv3plus) for details.
4747

4848
### UPerNet
4949

5050
Please refer to [UPerNet](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/upernet) for details.
5151

5252
### NonLocal Net
5353

54-
Please refer to [NonLocal Net](https://github.com/open-mmlab/mmsegmentatio/blob/master/configs/nlnet) for details.
54+
Please refer to [NonLocal Net](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/nlnet) for details.
5555

5656
### EncNet
5757

58-
Please refer to [NonLocal Net](https://github.com/open-mmlab/mmsegmentatio/blob/master/configs/encnet) for details.
58+
Please refer to [NonLocal Net](https://github.com/open-mmlab/mmsegmentation/blob/master/configs/encnet) for details.
5959

6060
### CCNet
6161

mmseg/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .version import __version__, short_version
1+
from .version import __version__, short_version, version_info
22

3-
__all__ = ['__version__', 'short_version']
3+
__all__ = ['__version__', 'short_version', 'version_info']

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
-r requirements/build.txt
21
-r requirements/optional.txt
32
-r requirements/runtime.txt
43
-r requirements/tests.txt

requirements/build.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)