Skip to content

Commit e5d3db2

Browse files
authored
Bump timm from 0.6.13 to 0.9.2 (#768)
* Create Makefile, simplify checks run * Fix new timm configs API * Add timm table generation step * Update timm table in docs * Update timm version to 0.9.2 * Bump smp version 0.3.3 * Update ubuntu runner
1 parent e7cbea0 commit e5d3db2

File tree

12 files changed

+323
-323
lines changed

12 files changed

+323
-323
lines changed

.github/workflows/tests.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111
branches: [ master ]
1212

1313
jobs:
14-
test:
15-
runs-on: ubuntu-18.04
14+
15+
lint:
16+
runs-on: ubuntu-latest
1617
steps:
1718
- uses: actions/checkout@v2
1819
- name: Set up Python ${{ matrix.python-version }}
@@ -23,28 +24,27 @@ jobs:
2324
run: |
2425
python -m pip install --upgrade pip
2526
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
26-
pip install .[test]
27-
- name: Run Tests
28-
run: python -m pytest -s tests
27+
make install_dev
2928
- name: Run Flake8
30-
run: flake8 --config=.flake8
29+
run: make flake8
30+
- name: Run Black
31+
run: make black
3132

32-
check_code_formatting:
33-
name: Check code formatting with Black
33+
test:
3434
runs-on: ubuntu-latest
35-
strategy:
36-
matrix:
37-
python-version: [3.8]
35+
needs: [lint]
3836
steps:
39-
- name: Checkout
40-
uses: actions/checkout@v2
41-
- name: Set up Python
37+
- uses: actions/checkout@v2
38+
- name: Set up Python ${{ matrix.python-version }}
4239
uses: actions/setup-python@v2
4340
with:
44-
python-version: ${{ matrix.python-version }}
45-
- name: Update pip
46-
run: python -m pip install --upgrade pip
47-
- name: Install Black
48-
run: pip install black==22.3.0
49-
- name: Run Black
50-
run: black --config=pyproject.toml --check .
41+
python-version: 3.7
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
46+
make install_dev
47+
- name: Run Flake8
48+
run: make flake8
49+
- name: Run Tests
50+
run: make test

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
hooks:
55
- id: black
66
args: [ --config=pyproject.toml ]
7-
- repo: https://gitlab.com/pycqa/flake8
7+
- repo: https://github.com/pycqa/flake8.git
88
rev: 4.0.1
99
hooks:
1010
- id: flake8

Makefile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.PHONY: test
2+
3+
.venv:
4+
python3 -m venv .venv
5+
6+
install_dev: .venv
7+
.venv/bin/pip install -e .[test]
8+
.venv/bin/pre-commit install
9+
10+
test: .venv
11+
.venv/bin/pytest -p no:cacheprovider tests/
12+
13+
table:
14+
.venv/bin/python misc/generate_table.py
15+
16+
table_timm:
17+
.venv/bin/python misc/generate_table_timm.py
18+
19+
black: .venv
20+
.venv/bin/black ./segmentation_models_pytorch --config=pyproject.toml --check
21+
22+
flake8: .venv
23+
.venv/bin/flake8 ./segmentation_models_pytorch --config=.flake8
24+
25+
all: black flake8 test

README.md

+8-11
Original file line numberDiff line numberDiff line change
@@ -469,25 +469,22 @@ $ pip install git+https://github.com/qubvel/segmentation_models.pytorch
469469
470470
### 🤝 Contributing
471471
472-
##### Install linting and formatting pre-commit hooks
473-
```bash
474-
pip install pre-commit black==22.3.0 flake8==4.0.1
475-
pre-commit install
476-
```
472+
#### Install SMP
477473
478-
##### Run tests
479474
```bash
480-
pytest -p no:cacheprovider
475+
make install_dev # create .venv, install SMP in dev mode
481476
```
482477

483-
##### Run tests in docker
478+
#### Run tests and code checks
479+
484480
```bash
485-
$ docker build -f docker/Dockerfile.dev -t smp:dev . && docker run --rm smp:dev pytest -p no:cacheprovider
481+
make all # run flake8, black, tests
486482
```
487483

488-
##### Generate table with encoders (in case you add a new encoder)
484+
#### Update table with encoders
485+
489486
```bash
490-
$ docker build -f docker/Dockerfile.dev -t smp:dev . && docker run --rm smp:dev python misc/generate_table.py
487+
make table # generate table with encoders and print to stdout
491488
```
492489

493490
### 📝 Citing

docs/conf.py

+38-29
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@
1818
import re
1919
import sys
2020
import datetime
21-
sys.path.append('..')
21+
22+
sys.path.append("..")
2223

2324
# -- Project information -----------------------------------------------------
2425

25-
project = 'Segmentation Models'
26-
copyright = '{}, Pavel Iakubovskii'.format(datetime.datetime.now().year)
27-
author = 'Pavel Iakubovskii'
26+
project = "Segmentation Models"
27+
copyright = "{}, Pavel Iakubovskii".format(datetime.datetime.now().year)
28+
author = "Pavel Iakubovskii"
29+
2830

2931
def get_version():
30-
sys.path.append('../segmentation_models_pytorch')
32+
sys.path.append("../segmentation_models_pytorch")
3133
from __version__ import __version__ as version
34+
3235
sys.path.pop(-1)
3336
return version
3437

38+
3539
version = get_version()
3640

3741
# -- General configuration ---------------------------------------------------
@@ -41,16 +45,16 @@ def get_version():
4145
# ones.
4246

4347
extensions = [
44-
'sphinx.ext.autodoc',
45-
'sphinx.ext.coverage',
46-
'sphinx.ext.napoleon',
47-
'sphinx.ext.viewcode',
48-
'sphinx.ext.mathjax',
49-
'autodocsumm',
48+
"sphinx.ext.autodoc",
49+
"sphinx.ext.coverage",
50+
"sphinx.ext.napoleon",
51+
"sphinx.ext.viewcode",
52+
"sphinx.ext.mathjax",
53+
"autodocsumm",
5054
]
5155

5256
# Add any paths that contain templates here, relative to this directory.
53-
templates_path = ['_templates']
57+
templates_path = ["_templates"]
5458

5559
# List of patterns, relative to source directory, that match files and
5660
# directories to ignore when looking for source files.
@@ -65,12 +69,14 @@ def get_version():
6569
#
6670

6771
import sphinx_rtd_theme
72+
6873
html_theme = "sphinx_rtd_theme"
6974
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
7075

7176
# import karma_sphinx_theme
7277
# html_theme = "karma_sphinx_theme"
7378
import faculty_sphinx_theme
79+
7480
html_theme = "faculty_sphinx_theme"
7581

7682
# import catalyst_sphinx_theme
@@ -82,7 +88,7 @@ def get_version():
8288
# Add any paths that contain custom static files (such as style sheets) here,
8389
# relative to this directory. They are copied after the builtin static files,
8490
# so a file named "default.css" will overwrite the builtin "default.css".
85-
html_static_path = ['_static']
91+
html_static_path = ["_static"]
8692

8793
# -- Extension configuration -------------------------------------------------
8894

@@ -92,37 +98,40 @@ def get_version():
9298
napoleon_numpy_docstring = False
9399

94100
autodoc_mock_imports = [
95-
'torch',
96-
'tqdm',
97-
'numpy',
98-
'timm',
99-
'cv2',
100-
'PIL',
101-
'pretrainedmodels',
102-
'torchvision',
103-
'efficientnet-pytorch',
104-
'segmentation_models_pytorch.encoders',
105-
'segmentation_models_pytorch.utils',
101+
"torch",
102+
"tqdm",
103+
"numpy",
104+
"timm",
105+
"cv2",
106+
"PIL",
107+
"pretrainedmodels",
108+
"torchvision",
109+
"efficientnet-pytorch",
110+
"segmentation_models_pytorch.encoders",
111+
"segmentation_models_pytorch.utils",
106112
# 'segmentation_models_pytorch.base',
107113
]
108114

109-
autoclass_content = 'both'
110-
autodoc_typehints = 'description'
115+
autoclass_content = "both"
116+
autodoc_typehints = "description"
111117

112118
# --- Work around to make autoclass signatures not (*args, **kwargs) ----------
113119

114-
class FakeSignature():
120+
121+
class FakeSignature:
115122
def __getattribute__(self, *args):
116123
raise ValueError
117124

125+
118126
def f(app, obj, bound_method):
119127
if "__new__" in obj.__name__:
120128
obj.__signature__ = FakeSignature()
121129

130+
122131
def setup(app):
123-
app.connect('autodoc-before-process-signature', f)
132+
app.connect("autodoc-before-process-signature", f)
124133

125134

126135
# Custom configuration --------------------------------------------------------
127136

128-
autodoc_member_order = 'bysource'
137+
autodoc_member_order = "bysource"

docs/encoders.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ EfficientNet
249249
+------------------------+--------------------------------------+-------------+
250250
| timm-efficientnet-b8 | imagenet / advprop | 84M |
251251
+------------------------+--------------------------------------+-------------+
252-
| timm-efficientnet-l2 | noisy-student | 474M |
252+
| timm-efficientnet-l2 | noisy-student / noisy-student-475 | 474M |
253253
+------------------------+--------------------------------------+-------------+
254254
| timm-efficientnet-lite0| imagenet | 4M |
255255
+------------------------+--------------------------------------+-------------+

0 commit comments

Comments
 (0)