Skip to content

Commit

Permalink
Merge branch 'main' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Pale-Blue-Dot-97 authored Oct 16, 2024
2 parents 44db2b6 + 85c7051 commit 2c00662
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test = [
"mypy",
"pytest",
"pytest-cov",
"pytest-lazy-fixture",
"pytest-lazy-fixtures",
"tox",
]

Expand Down
12 changes: 6 additions & 6 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
argcomplete==3.5.0
argcomplete==3.5.1
fastapi>=0.101.0
fiona>=1.9.1
geopy==2.4.1
git+https://github.com/qubvel-org/segmentation_models.pytorch
GitPython>=3.1.35
hydra-core==1.3.2
imagecodecs==2024.9.22
Expand All @@ -20,29 +21,28 @@ onnx==1.16.2
onnx2torch==1.5.15
opencv-python-headless==4.10.0.84
overload==1.1
pandas==2.2.2
pandas==2.2.3
patch-ng==1.18.0
protobuf>=3.19.5 # not directly required, pinned by Snyk to avoid a vulnerability.
psutil==6.0.0
pyyaml==6.0.2
rasterio>=1.3.6
requests==2.32.3
scikit-learn==1.5.1
segmentation-models-pytorch==0.3.4
setuptools==75.1.0
starlette==0.38.5 # not directly required, pinned by Dependabot to avoid a vulnerability.
starlette==0.40.0 # not directly required, pinned by Dependabot to avoid a vulnerability.
tabulate==0.9.0
tensorflow==2.17.0
tifffile==2024.1.30
timm==0.9.7
timm==1.0.9
torch==2.4.1
torcheval==0.0.7
torchgeo==0.6.1
torchinfo==1.8.0
torchvision==0.19.1
tornado>=6.3.3
tqdm==4.66.5
types-PyYAML==6.0.12.20240808
types-PyYAML==6.0.12.20240917
types-requests==2.32.0.20240712
types-tabulate==0.9.0.20240106
wandb==0.18.0
Expand Down
6 changes: 3 additions & 3 deletions requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ mypy==1.11.2
myst_parser==4.0.0
pre-commit==3.8.0
pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability.
pytest==7.4.4
pytest==8.3.3
pytest-cov==5.0.0
pytest-lazy-fixture==0.6.3
pytest-lazy-fixtures==1.1.1
sphinx==7.4.4
sphinx-rtd-theme==2.0.0
tox==4.18.0
tox==4.21.2
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test =
mypy
pytest
pytest-cov
pytest-lazy-fixture
pytest-lazy-fixtures
tox


Expand Down
14 changes: 7 additions & 7 deletions tests/test_models/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import packaging
import pytest
import torch
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf
from urllib3.exceptions import MaxRetryError, NewConnectionError

# Needed to avoid connection error when importing lightly.
Expand Down Expand Up @@ -194,8 +194,8 @@ def test_bilinear_init() -> None:
@pytest.mark.parametrize(
("model", "answer"),
[
(lazy_fixture("exp_fcn"), True),
(lazy_fixture("exp_cnn"), True),
(lf("exp_fcn"), True),
(lf("exp_cnn"), True),
(resnet18(), False),
],
)
Expand All @@ -214,9 +214,9 @@ def test_is_minerva_model(model: Module, compile_model: bool, answer: bool) -> N
@pytest.mark.parametrize(
("model", "subtype", "answer"),
[
(lazy_fixture("exp_fcn"), MinervaBackbone, True),
(lazy_fixture("exp_cnn"), MinervaSiamese, False),
(lazy_fixture("exp_simconv"), MinervaSiamese, True),
(lf("exp_fcn"), MinervaBackbone, True),
(lf("exp_cnn"), MinervaSiamese, False),
(lf("exp_simconv"), MinervaSiamese, True),
(resnet18(), MinervaBackbone, False),
],
)
Expand All @@ -236,7 +236,7 @@ def test_is_minerva_subtype(

@pytest.mark.parametrize(
"model",
(lazy_fixture("exp_fcn"), lazy_fixture("exp_cnn"), lazy_fixture("exp_simconv")),
(lf("exp_fcn"), lf("exp_cnn"), lf("exp_simconv")),
)
@pytest.mark.parametrize("compile_model", (True, False))
def test_extract_wrapped_model(model, compile_model: bool) -> None:
Expand Down
24 changes: 11 additions & 13 deletions tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import pytest
import torch
from numpy.testing import assert_array_equal
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf
from torch import FloatTensor, LongTensor
from torchgeo.datasets import RasterDataset
from torchvision.transforms import ColorJitter, RandomHorizontalFlip, RandomVerticalFlip
Expand Down Expand Up @@ -69,7 +69,7 @@
@pytest.mark.parametrize(
["input_mask", "output"],
[
(lazy_fixture("simple_mask"), torch.tensor([[1, 3, 0], [2, 0, 1], [1, 1, 1]])),
(lf("simple_mask"), torch.tensor([[1, 3, 0], [2, 0, 1], [1, 1, 1]])),
(
torch.tensor([[5, 3, 5], [4, 5, 1], [1, 3, 1]], dtype=torch.long),
torch.tensor([[0, 3, 0], [2, 0, 1], [1, 3, 1]]),
Expand All @@ -86,9 +86,7 @@ def test_class_transform(
assert repr(transform) == f"ClassTransform(transform={example_matrix})"


@pytest.mark.parametrize(
"sample", (42, lazy_fixture("simple_mask"), lazy_fixture("example_matrix"))
)
@pytest.mark.parametrize("sample", (42, lf("simple_mask"), lf("example_matrix")))
def test_pair_create(sample: Any) -> None:
transform = PairCreate()

Expand All @@ -100,7 +98,7 @@ def test_pair_create(sample: Any) -> None:
@pytest.mark.parametrize(
"mask",
(
lazy_fixture("simple_mask"),
lf("simple_mask"),
torch.tensor(
[[1023.0, 3.890, 557.0], [478.0, 5.788, 10009.0], [1.0, 10240.857, 1458.7]]
),
Expand Down Expand Up @@ -256,22 +254,22 @@ def test_dublicator(
Normalise,
None,
255,
lazy_fixture("simple_rgb_img"),
lazy_fixture("norm_simple_rgb_img"),
lf("simple_rgb_img"),
lf("norm_simple_rgb_img"),
),
(
Normalise,
["image"],
255,
lazy_fixture("simple_rgb_img"),
lazy_fixture("norm_simple_rgb_img"),
lf("simple_rgb_img"),
lf("norm_simple_rgb_img"),
),
(
RandomHorizontalFlip,
["image", "mask"],
1.0,
lazy_fixture("simple_sample"),
lazy_fixture("flipped_simple_sample"),
lf("simple_sample"),
lf("flipped_simple_sample"),
),
],
)
Expand Down Expand Up @@ -349,7 +347,7 @@ def test_swap_keys(random_rgbi_tensor, random_tensor_mask) -> None:

@pytest.mark.parametrize(
"dataset",
[lazy_fixture("default_image_dataset"), lazy_fixture("ssl4eo_s12_dataset")],
[lf("default_image_dataset"), lf("ssl4eo_s12_dataset")],
)
def test_auto_norm(dataset: RasterDataset, random_rgbi_tensor):
auto_norm = AutoNorm(dataset, 12)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from internet_sabotage import no_connection
from nptyping import Float, NDArray, Shape
from numpy.testing import assert_array_equal
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf
from rasterio.crs import CRS
from torchgeo.datasets.utils import BoundingBox, stack_samples
from torchvision.datasets import FakeData
Expand Down Expand Up @@ -241,7 +241,7 @@ def test_eliminate_classes(
[2, 1, 5, 1, 6, 3, 0, 1, 1, 5, 7],
[2, 4, 5, 1, 6, 3, 0, 2, 1, 5, 7],
[2, 1, 5, 1, 6, 3, 0, 1, 1, 5, 7],
lazy_fixture("exp_classes"),
lf("exp_classes"),
),
],
)
Expand Down

0 comments on commit 2c00662

Please sign in to comment.