Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

test: drop version guards that the torch>=2.5.1 floor made dead (#4327)

Dmytro Mishkinfc58f0fda32e
diff --git a/pixi.toml b/pixi.toml
index 972b29e37..29827664b 100644
--- a/pixi.toml
+++ b/pixi.toml
@@ -75,8 +75,8 @@ platforms = ["linux-64", "linux-aarch64", "win-64"]
# ------------------------------------------------------------------------------
[feature.cuda.tasks]
-install = { cmd = "uv sync --extra dev && uv pip install --reinstall torch torchvision --index pytorch-cu121", description = "Install dev dependencies (CUDA PyTorch)" }
-install-docs = { cmd = "uv sync --extra dev --extra docs && uv pip install --reinstall torch torchvision --index pytorch-cu121", description = "Install dev + docs (CUDA PyTorch)" }
+install = { cmd = "uv sync --extra dev && uv pip install --reinstall torch --index pytorch-cu121", description = "Install dev dependencies (CUDA PyTorch)" }
+install-docs = { cmd = "uv sync --extra dev --extra docs && uv pip install --reinstall torch --index pytorch-cu121", description = "Install dev + docs (CUDA PyTorch)" }
# CUDA test tasks
test-cuda = { cmd = "uv run pytest tests/", env = { KORNIA_TEST_DEVICE = "cuda" }, description = "Run tests on CUDA" }
test-cuda-f32 = { cmd = "uv run pytest tests/", env = { KORNIA_TEST_DEVICE = "cuda", KORNIA_TEST_DTYPE = "float32" } }
diff --git a/tests/augmentation/test_augmentation.py b/tests/augmentation/test_augmentation.py
index 4b0e47216..0b7e3a69f 100644
--- a/tests/augmentation/test_augmentation.py
+++ b/tests/augmentation/test_augmentation.py
@@ -77,7 +77,7 @@ from kornia.augmentation import (
)
from kornia.augmentation._2d.base import AugmentationBase2D
from kornia.constants import Resample, pi
-from kornia.core._compat import torch_version, torch_version_le
+from kornia.core._compat import torch_version
from kornia.core.utils import _torch_inverse_cast
from kornia.geometry import create_meshgrid, transform_points
@@ -5414,10 +5414,6 @@ class TestRandomJPEG(BaseTester):
@pytest.mark.slow
- torch_version_le(2, 0, 1),
- reason="Test requires distributed tensor support introduced in PyTorch > 2.0.1 for transformers clip model.",
-)
class TestRandomDissolving(BaseTester):
torch.manual_seed(0) # for random reproductibility
diff --git a/tests/filters/test_dissolving.py b/tests/filters/test_dissolving.py
index 425df0267..708590d8a 100644
--- a/tests/filters/test_dissolving.py
+++ b/tests/filters/test_dissolving.py
@@ -18,7 +18,6 @@
import pytest
import torch
-from kornia.core._compat import torch_version_le
from kornia.filters.dissolving import StableDiffusionDissolving
from testing.base import BaseTester
@@ -31,10 +30,6 @@ WEIGHTS_CACHE_DIR = "weights/"
@pytest.mark.slow
- torch_version_le(2, 0, 1),
- reason="Skipped for torch versions <= 2.0.1: transformers clip model needs distributed tensor.",
-)
class TestStableDiffusionDissolving(BaseTester):
@pytest.fixture(scope="class")
def sdm_2_1(self):
diff --git a/tests/io/test_io_image.py b/tests/io/test_io_image.py
index d2c903542..96208d74e 100644
--- a/tests/io/test_io_image.py
+++ b/tests/io/test_io_image.py
@@ -16,26 +16,16 @@
#
import io
-import sys
from pathlib import Path
from urllib.request import urlopen
+import kornia_rs
import numpy as np
import pytest
import torch
-from kornia.core._compat import torch_version_ge
from kornia.io import ImageLoadType, load_image, write_image
-try:
- import kornia_rs
-except ImportError:
- kornia_rs = None
-
-
-def available_package() -> bool:
- return sys.version_info >= (3, 7, 0) and torch_version_ge(1, 10, 0) and kornia_rs is not None
-
def create_random_img8(height: int, width: int, channels: int) -> np.ndarray:
return (np.random.rand(height, width, channels) * 255).astype(np.uint8) # noqa: NPY002
@@ -90,7 +80,6 @@ def images_fn(png_image, jpg_image):
return {"png": png_image, "jpg": jpg_image}
[email protected](not available_package(), reason="kornia_rs only supports python >=3.7 and pt >= 1.10.0")
class TestIoImage:
def test_smoke(self, tmp_path: Path) -> None:
height, width = 4, 5