Skip to content

Commit 7156dd6

Browse files
authored
Merge branch 'open-mmlab:main' into main
2 parents 5670883 + bce1c24 commit 7156dd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+299
-288
lines changed

.github/workflows/deploy.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: deploy
22

3-
on: push
3+
on:
4+
- push
5+
- workflow_dispatch
46

57
concurrency:
68
group: ${{ github.workflow }}-${{ github.ref }}
@@ -9,13 +11,14 @@ concurrency:
911
jobs:
1012
build-n-publish:
1113
runs-on: ubuntu-latest
12-
if: startsWith(github.event.ref, 'refs/tags')
14+
if: |
15+
startsWith(github.event.ref, 'refs/tags') || github.event_name == 'workflow_dispatch'
1316
steps:
14-
- uses: actions/checkout@v2
15-
- name: Set up Python 3.7
16-
uses: actions/setup-python@v2
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.10.13
19+
uses: actions/setup-python@v4
1720
with:
18-
python-version: 3.7
21+
python-version: 3.10.13
1922
- name: Install wheel
2023
run: pip install wheel
2124
- name: Build MMEngine
@@ -27,13 +30,14 @@ jobs:
2730
2831
build-n-publish-lite:
2932
runs-on: ubuntu-latest
30-
if: startsWith(github.event.ref, 'refs/tags')
33+
if: |
34+
startsWith(github.event.ref, 'refs/tags') || github.event_name == 'workflow_dispatch'
3135
steps:
32-
- uses: actions/checkout@v2
33-
- name: Set up Python 3.7
34-
uses: actions/setup-python@v2
36+
- uses: actions/checkout@v4
37+
- name: Set up Python 3.10.13
38+
uses: actions/setup-python@v4
3539
with:
36-
python-version: 3.7
40+
python-version: 3.10.13
3741
- name: Install wheel
3842
run: pip install wheel
3943
- name: Build MMEngine-lite

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- name: Set up Python 3.7
14+
- name: Set up Python 3.10.15
1515
uses: actions/setup-python@v2
1616
with:
17-
python-version: 3.7
17+
python-version: '3.10.15'
1818
- name: Install pre-commit hook
1919
run: |
2020
pip install pre-commit
Lines changed: 95 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: pr_stage_test
22

3+
env:
4+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
5+
6+
37
on:
48
pull_request:
59
paths-ignore:
@@ -21,152 +25,114 @@ concurrency:
2125
jobs:
2226
build_cpu:
2327
runs-on: ubuntu-22.04
28+
defaults:
29+
run:
30+
shell: bash -l {0}
2431
strategy:
2532
matrix:
26-
python-version: [3.7]
27-
include:
28-
- torch: 1.8.1
29-
torchvision: 0.9.1
33+
python-version: ['3.9']
34+
torch: ['2.0.0']
3035
steps:
31-
- uses: actions/checkout@v3
32-
- name: Set up Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v4
36+
- name: Check out repo
37+
uses: actions/checkout@v3
38+
- name: Setup conda env
39+
uses: conda-incubator/setup-miniconda@v2
3440
with:
41+
auto-update-conda: true
42+
miniconda-version: "latest"
43+
use-only-tar-bz2: true
44+
activate-environment: test
3545
python-version: ${{ matrix.python-version }}
36-
- name: Upgrade pip
37-
run: python -m pip install pip --upgrade
38-
- name: Upgrade wheel
39-
run: python -m pip install wheel --upgrade
40-
- name: Install PyTorch
41-
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
42-
- name: Build MMEngine from source
43-
run: pip install -e . -v
44-
- name: Install unit tests dependencies
46+
- name: Update pip
4547
run: |
46-
pip install -r requirements/tests.txt
47-
pip install openmim
48-
mim install mmcv
49-
- name: Run unittests and generate coverage report
48+
python -m pip install --upgrade pip wheel
49+
- name: Install dependencies
5050
run: |
51-
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
52-
coverage xml
53-
coverage report -m
54-
# Upload coverage report for python3.7 && pytorch1.8.1 cpu
55-
- name: Upload coverage to Codecov
51+
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
52+
python -m pip install torch==${{matrix.torch}}
53+
python -m pip install -e . -v
54+
python -m pip install -r requirements/tests.txt
55+
python -m pip install openmim
56+
mim install mmcv coverage
57+
- name: Run unit tests with coverage
58+
run: coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
59+
- name: Upload Coverage to Codecov
5660
uses: codecov/codecov-action@v3
57-
with:
58-
file: ./coverage.xml
59-
flags: unittests
60-
env_vars: OS,PYTHON
61-
name: codecov-umbrella
62-
fail_ci_if_error: false
6361

64-
build_cu102:
62+
build_gpu:
6563
runs-on: ubuntu-22.04
66-
container:
67-
image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
64+
defaults:
65+
run:
66+
shell: bash -l {0}
6867
env:
6968
MKL_THREADING_LAYER: GNU
7069
strategy:
7170
matrix:
72-
python-version: [3.7]
71+
python-version: ['3.9','3.10']
72+
torch: ['2.0.0','2.3.1','2.5.1']
73+
cuda: ['cu118']
7374
steps:
74-
- uses: actions/checkout@v3
75-
- name: Set up Python ${{ matrix.python-version }}
76-
uses: actions/setup-python@v4
75+
- name: Check out repo
76+
uses: actions/checkout@v3
77+
- name: Setup conda env
78+
uses: conda-incubator/setup-miniconda@v2
7779
with:
80+
auto-update-conda: true
81+
miniconda-version: "latest"
82+
use-only-tar-bz2: true
83+
activate-environment: test
7884
python-version: ${{ matrix.python-version }}
79-
- name: Upgrade pip
80-
run: pip install pip --upgrade
81-
- name: Fetch GPG keys
85+
- name: Update pip
8286
run: |
83-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
84-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
85-
- name: Install system dependencies
86-
run: apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
87-
- name: Build MMEngine from source
88-
run: pip install -e . -v
89-
- name: Install unit tests dependencies
87+
python -m pip install --upgrade pip wheel
88+
- name: Install dependencies
9089
run: |
91-
pip install -r requirements/tests.txt
92-
pip install openmim
93-
mim install mmcv
94-
- name: Run unittests and generate coverage report
95-
run: |
96-
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
97-
coverage xml
98-
coverage report -m
99-
100-
build_cu117:
101-
runs-on: ubuntu-22.04
102-
container:
103-
image: pytorch/pytorch:2.0.0-cuda11.7-cudnn8-devel
104-
strategy:
105-
matrix:
106-
python-version: [3.9]
107-
steps:
108-
- uses: actions/checkout@v3
109-
- name: Set up Python ${{ matrix.python-version }}
110-
uses: actions/setup-python@v4
111-
with:
112-
python-version: ${{ matrix.python-version }}
113-
- name: Upgrade pip
114-
run: pip install pip --upgrade
115-
- name: Fetch GPG keys
116-
run: |
117-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
118-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
119-
- name: Install system dependencies
120-
run: apt-get update && apt-get install -y git ffmpeg libturbojpeg
121-
- name: Build MMEngine from source
122-
run: pip install -e . -v
123-
- name: Install unit tests dependencies
124-
run: |
125-
pip install -r requirements/tests.txt
126-
pip install openmim
127-
mim install mmcv
128-
# Distributed related unit test may randomly error in PyTorch 1.13.0
129-
- name: Run unittests and generate coverage report
130-
run: |
131-
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/
132-
coverage xml
133-
coverage report -m
90+
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
91+
python -m pip install torch==${{matrix.torch}} --index-url https://download.pytorch.org/whl/${{matrix.cuda}}
92+
python -m pip install -e . -v
93+
python -m pip install -r requirements/tests.txt
94+
python -m pip install openmim
95+
mim install mmcv coverage
96+
- name: Run unit tests with coverage
97+
run: coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
98+
- name: Upload Coverage to Codecov
99+
uses: codecov/codecov-action@v3
134100

135-
build_windows:
136-
runs-on: windows-2022
137-
strategy:
138-
matrix:
139-
python-version: [3.7]
140-
platform: [cpu, cu111]
141-
torch: [1.8.1]
142-
torchvision: [0.9.1]
143-
include:
144-
- python-version: 3.8
145-
platform: cu118
146-
torch: 2.1.0
147-
torchvision: 0.16.0
148-
steps:
149-
- uses: actions/checkout@v3
150-
- name: Set up Python ${{ matrix.python-version }}
151-
uses: actions/setup-python@v4
152-
with:
153-
python-version: ${{ matrix.python-version }}
154-
- name: Upgrade pip
155-
# Windows CI could fail If we call `pip install pip --upgrade` directly.
156-
run: python -m pip install pip --upgrade
157-
- name: Install PyTorch
158-
run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
159-
- name: Build MMEngine from source
160-
run: pip install -e . -v
161-
- name: Install unit tests dependencies
162-
run: |
163-
pip install -r requirements/tests.txt
164-
pip install openmim
165-
mim install mmcv
166-
- name: Run CPU unittests
167-
run: pytest tests/ --ignore tests/test_dist
168-
if: ${{ matrix.platform == 'cpu' }}
169-
- name: Run GPU unittests
170-
# Skip testing distributed related unit tests since the memory of windows CI is limited
171-
run: pytest tests/ --ignore tests/test_dist --ignore tests/test_optim/test_optimizer/test_optimizer_wrapper.py --ignore tests/test_model/test_wrappers/test_model_wrapper.py --ignore tests/test_hooks/test_sync_buffers_hook.py
172-
if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}
101+
# build_windows:
102+
# runs-on: windows-2022
103+
# strategy:
104+
# matrix:
105+
# python-version: [3.9]
106+
# platform: [cpu, cu111]
107+
# torch: [1.8.1]
108+
# torchvision: [0.9.1]
109+
# include:
110+
# - python-version: 3.8
111+
# platform: cu118
112+
# torch: 2.1.0
113+
# torchvision: 0.16.0
114+
# steps:
115+
# - uses: actions/checkout@v3
116+
# - name: Set up Python ${{ matrix.python-version }}
117+
# uses: actions/setup-python@v4
118+
# with:
119+
# python-version: ${{ matrix.python-version }}
120+
# - name: Upgrade pip
121+
# # Windows CI could fail If we call `pip install pip --upgrade` directly.
122+
# run: python -m pip install pip wheel --upgrade
123+
# - name: Install PyTorch
124+
# run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
125+
# - name: Build MMEngine from source
126+
# run: pip install -e . -v
127+
# - name: Install unit tests dependencies
128+
# run: |
129+
# pip install -r requirements/tests.txt
130+
# pip install openmim
131+
# mim install mmcv
132+
# - name: Run CPU unittests
133+
# run: pytest tests/ --ignore tests/test_dist
134+
# if: ${{ matrix.platform == 'cpu' }}
135+
# - name: Run GPU unittests
136+
# # Skip testing distributed related unit tests since the memory of windows CI is limited
137+
# run: pytest tests/ --ignore tests/test_dist --ignore tests/test_optim/test_optimizer/test_optimizer_wrapper.py --ignore tests/test_model/test_wrappers/test_model_wrapper.py --ignore tests/test_hooks/test_sync_buffers_hook.py
138+
# if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}

.pre-commit-config-zh-cn.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
exclude: ^tests/data/
22
repos:
3-
- repo: https://gitee.com/openmmlab/mirrors-flake8
4-
rev: 5.0.4
3+
- repo: https://github.com/pre-commit/pre-commit
4+
rev: v4.0.0
5+
hooks:
6+
- id: validate_manifest
7+
- repo: https://github.com/PyCQA/flake8
8+
rev: 7.1.1
59
hooks:
610
- id: flake8
711
- repo: https://gitee.com/openmmlab/mirrors-isort
@@ -13,7 +17,7 @@ repos:
1317
hooks:
1418
- id: yapf
1519
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
16-
rev: v4.3.0
20+
rev: v5.0.0
1721
hooks:
1822
- id: trailing-whitespace
1923
- id: check-yaml
@@ -55,11 +59,12 @@ repos:
5559
args: ["mmengine", "tests"]
5660
- id: remove-improper-eol-in-cn-docs
5761
- repo: https://gitee.com/openmmlab/mirrors-mypy
58-
rev: v0.812
62+
rev: v1.2.0
5963
hooks:
6064
- id: mypy
6165
exclude: |-
6266
(?x)(
6367
^examples
6468
| ^docs
6569
)
70+
additional_dependencies: ["types-setuptools", "types-requests", "types-PyYAML"]

0 commit comments

Comments
 (0)