Skip to content
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

[pull] main from kornia:main #22

Merged
merged 2 commits into from
Jun 19, 2024
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
20 changes: 11 additions & 9 deletions .github/workflows/pr_test_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,34 @@ jobs:
os: ['Ubuntu-latest', 'Windows-latest']
pytorch-dtype: ['float32', 'float64']

uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0
with:
os: ${{ matrix.os }}
python-version: '["3.8", "3.11"]'
python-version: '["3.8", "3.12"]'
pytorch-version: '["1.9.1", "2.3.1"]'
pytorch-dtype: ${{ matrix.pytorch-dtype }}

tests-cpu-macos:
uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0
uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0
with:
os: 'MacOS-latest'
python-version: '["3.8", "3.11"]'
python-version: '["3.8", "3.12"]'
pytorch-dtype: 'float32'


coverage:
uses: kornia/workflows/.github/workflows/coverage.yml@v1.9.1
uses: kornia/workflows/.github/workflows/coverage.yml@v1.10.0

typing:
uses: kornia/workflows/.github/workflows/mypy.yml@v1.9.1
uses: kornia/workflows/.github/workflows/mypy.yml@v1.10.0

tutorials:
uses: kornia/workflows/.github/workflows/tutorials.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tutorials.yml@v1.10.0

docs:
uses: kornia/workflows/.github/workflows/docs.yml@v1.9.1
uses: kornia/workflows/.github/workflows/docs.yml@v1.10.0
with:
python-version: "3.11"

collector:
needs: [coverage, tests-cpu, tutorials, typing, docs]
Expand All @@ -66,7 +68,7 @@ jobs:
os: ['Ubuntu-latest', 'Windows-latest'] #, 'MacOS-latest'] add it when https://github.com/pytorch/pytorch/pull/89262 be merged
pytorch-dtype: ['float32', 'float64']

uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0
with:
os: ${{ matrix.os }}
pytorch-version: '["nightly"]'
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/scheduled_test_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
# os: ['Ubuntu-latest', 'Windows-latest', 'MacOS-latest']
pytorch-dtype: ['float32', 'float64']

uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0
with:
os: 'Ubuntu-latest'
python-version: '["3.8", "3.9", "3.10", "3.11"]'
python-version: '["3.8", "3.9", "3.10", "3.11", "3.12"]'
pytorch-version: '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2", "2.3.1"]'
pytorch-dtype: ${{ matrix.pytorch-dtype }}
pytest-extra: '--runslow'
Expand All @@ -34,10 +34,10 @@ jobs:
matrix:
pytorch-dtype: ['float32', 'float64']

uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0
with:
os: 'Windows-latest'
python-version: '["3.11"]'
python-version: '["3.12"]'
pytorch-version: '["1.9.1", "2.3.1"]'
pytorch-dtype: ${{ matrix.pytorch-dtype }}

Expand All @@ -47,19 +47,21 @@ jobs:
matrix:
pytorch-dtype: ['float32', 'float64']

uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0
with:
os: 'MacOS-latest'
pytorch-dtype: ${{ matrix.pytorch-dtype }}

coverage:
uses: kornia/workflows/.github/workflows/coverage.yml@v1.9.1
uses: kornia/workflows/.github/workflows/coverage.yml@v1.10.0

typing:
uses: kornia/workflows/.github/workflows/mypy.yml@v1.9.1
uses: kornia/workflows/.github/workflows/mypy.yml@v1.10.0

tutorials:
uses: kornia/workflows/.github/workflows/tutorials.yml@v1.9.1
uses: kornia/workflows/.github/workflows/tutorials.yml@v1.10.0

docs:
uses: kornia/workflows/.github/workflows/docs.yml@v1.9.1
uses: kornia/workflows/.github/workflows/docs.yml@v1.10.0
with:
python-version: "3.11"
2 changes: 1 addition & 1 deletion .github/workflows/scheduled_test_pypi_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout kornia
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ repos:
exclude: ^$|.devcontainer

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.1.1"
rev: "2.1.3"
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
rev: v0.4.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args:
Expand Down
9 changes: 7 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def torch_optimizer(optimizer_backend):
return torch.jit.script

if hasattr(torch, "compile") and sys.platform == "linux":
if not (sys.version_info[:2] == (3, 11) and torch_version() in {"2.0.0", "2.0.1"}):
if (not (sys.version_info[:2] == (3, 11) and torch_version() in {"2.0.0", "2.0.1"})) and (
not sys.version_info[:2] == (3, 12)
):
# torch compile don't have support for python3.12 yet
torch._dynamo.reset()
# torch compile just have support for python 3.11 after torch 2.1.0
return partial(
Expand Down Expand Up @@ -182,7 +185,9 @@ def pytest_sessionstart(session):
try:
_setup_torch_compile()
except RuntimeError as ex:
if "not yet supported for torch.compile" not in str(ex):
if "not yet supported for torch.compile" not in str(
ex
) and "Dynamo is not supported on Python 3.12+" not in str(ex):
raise ex
# TODO: cache all torch.load weights/states here to not impact on test suite

Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ lint.select = [
# "TD", # flake8-todos
# "TRY", # tryceratops
]
lint.ignore = [
"PLR0915", # Allow condition check in list comprehension
"PLW2901", # Allow overwritten values on loops
"UP007", # Prefer Optional[], Union[] over | due to torch jit scripting
]

lint.per-file-ignores."*/__init__.py" = [
"F401",
"F403",
Expand Down Expand Up @@ -217,11 +223,6 @@ lint.pylint.max-args = 30 # Recommended: 5
lint.pylint.max-branches = 21 # Recommended: 12
lint.pylint.max-returns = 13 # Recommended: 6
lint.pylint.max-statements = 64 # Recommended: 50
lint.ignore = [
"PLR0915", # Allow condition check in list comprehension
"PLW2901", # Allow overwritten values on loops
"UP007", # Prefer Optional[], Union[] over | due to torch jit scripting
]

[tool.pytest.ini_options]
addopts = "--color=yes"
Expand Down