Skip to content

Bump timm from 0.6.13 to 0.9.2 #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ on:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-18.04

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -23,28 +24,27 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install .[test]
- name: Run Tests
run: python -m pytest -s tests
make install_dev
- name: Run Flake8
run: flake8 --config=.flake8
run: make flake8
- name: Run Black
run: make black

check_code_formatting:
name: Check code formatting with Black
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
needs: [lint]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install Black
run: pip install black==22.3.0
- name: Run Black
run: black --config=pyproject.toml --check .
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
make install_dev
- name: Run Flake8
run: make flake8
- name: Run Tests
run: make test
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: black
args: [ --config=pyproject.toml ]
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/pycqa/flake8.git
rev: 4.0.1
hooks:
- id: flake8
Expand Down
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.PHONY: test

.venv:
python3 -m venv .venv

install_dev: .venv
.venv/bin/pip install -e .[test]
.venv/bin/pre-commit install

test: .venv
.venv/bin/pytest -p no:cacheprovider tests/

table:
.venv/bin/python misc/generate_table.py

table_timm:
.venv/bin/python misc/generate_table_timm.py

black: .venv
.venv/bin/black ./segmentation_models_pytorch --config=pyproject.toml --check

flake8: .venv
.venv/bin/flake8 ./segmentation_models_pytorch --config=.flake8

all: black flake8 test
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,25 +469,22 @@ $ pip install git+https://github.com/qubvel/segmentation_models.pytorch

### 🤝 Contributing

##### Install linting and formatting pre-commit hooks
```bash
pip install pre-commit black==22.3.0 flake8==4.0.1
pre-commit install
```
#### Install SMP

##### Run tests
```bash
pytest -p no:cacheprovider
make install_dev # create .venv, install SMP in dev mode
```

##### Run tests in docker
#### Run tests and code checks

```bash
$ docker build -f docker/Dockerfile.dev -t smp:dev . && docker run --rm smp:dev pytest -p no:cacheprovider
make all # run flake8, black, tests
```

##### Generate table with encoders (in case you add a new encoder)
#### Update table with encoders

```bash
$ docker build -f docker/Dockerfile.dev -t smp:dev . && docker run --rm smp:dev python misc/generate_table.py
make table # generate table with encoders and print to stdout
```

### 📝 Citing
Expand Down
67 changes: 38 additions & 29 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@
import re
import sys
import datetime
sys.path.append('..')

sys.path.append("..")

# -- Project information -----------------------------------------------------

project = 'Segmentation Models'
copyright = '{}, Pavel Iakubovskii'.format(datetime.datetime.now().year)
author = 'Pavel Iakubovskii'
project = "Segmentation Models"
copyright = "{}, Pavel Iakubovskii".format(datetime.datetime.now().year)
author = "Pavel Iakubovskii"


def get_version():
sys.path.append('../segmentation_models_pytorch')
sys.path.append("../segmentation_models_pytorch")
from __version__ import __version__ as version

sys.path.pop(-1)
return version


version = get_version()

# -- General configuration ---------------------------------------------------
Expand All @@ -41,16 +45,16 @@ def get_version():
# ones.

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.mathjax',
'autodocsumm',
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"autodocsumm",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

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

import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# import karma_sphinx_theme
# html_theme = "karma_sphinx_theme"
import faculty_sphinx_theme

html_theme = "faculty_sphinx_theme"

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

# -- Extension configuration -------------------------------------------------

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

autodoc_mock_imports = [
'torch',
'tqdm',
'numpy',
'timm',
'cv2',
'PIL',
'pretrainedmodels',
'torchvision',
'efficientnet-pytorch',
'segmentation_models_pytorch.encoders',
'segmentation_models_pytorch.utils',
"torch",
"tqdm",
"numpy",
"timm",
"cv2",
"PIL",
"pretrainedmodels",
"torchvision",
"efficientnet-pytorch",
"segmentation_models_pytorch.encoders",
"segmentation_models_pytorch.utils",
# 'segmentation_models_pytorch.base',
]

autoclass_content = 'both'
autodoc_typehints = 'description'
autoclass_content = "both"
autodoc_typehints = "description"

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

class FakeSignature():

class FakeSignature:
def __getattribute__(self, *args):
raise ValueError


def f(app, obj, bound_method):
if "__new__" in obj.__name__:
obj.__signature__ = FakeSignature()


def setup(app):
app.connect('autodoc-before-process-signature', f)
app.connect("autodoc-before-process-signature", f)


# Custom configuration --------------------------------------------------------

autodoc_member_order = 'bysource'
autodoc_member_order = "bysource"
2 changes: 1 addition & 1 deletion docs/encoders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ EfficientNet
+------------------------+--------------------------------------+-------------+
| timm-efficientnet-b8 | imagenet / advprop | 84M |
+------------------------+--------------------------------------+-------------+
| timm-efficientnet-l2 | noisy-student | 474M |
| timm-efficientnet-l2 | noisy-student / noisy-student-475 | 474M |
+------------------------+--------------------------------------+-------------+
| timm-efficientnet-lite0| imagenet | 4M |
+------------------------+--------------------------------------+-------------+
Expand Down
Loading