From bc23e21009fec065e477e85947fe6f519f1f50ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 16:39:10 -0700 Subject: [PATCH] Bump pytorch-lightning from 1.6.5 to 1.7.0 in /requirements (#697) * Bump pytorch-lightning from 1.6.5 to 1.7.0 in /requirements Bumps [pytorch-lightning](https://github.com/Lightning-AI/lightning) from 1.6.5 to 1.7.0. - [Release notes](https://github.com/Lightning-AI/lightning/releases) - [Commits](https://github.com/Lightning-AI/lightning/compare/1.6.5...pl/1.7.0) --- updated-dependencies: - dependency-name: pytorch-lightning dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Remove protobuf restrictions * LightningModule was moved * Mypy fixes * Ensure same behavior * Fix docs * Silence warnings * Change error message location Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adam J. Stewart --- .github/dependabot.yml | 2 -- docs/conf.py | 1 + experiments/test_chesapeakecvpr_models.py | 4 ++-- pyproject.toml | 2 ++ requirements/required.old | 1 - requirements/required.txt | 3 +-- torchgeo/datamodules/bigearthnet.py | 2 +- torchgeo/datamodules/chesapeake.py | 2 +- torchgeo/datamodules/cowc.py | 2 +- torchgeo/datamodules/cyclone.py | 2 +- torchgeo/datamodules/deepglobelandcover.py | 2 +- torchgeo/datamodules/etci2021.py | 2 +- torchgeo/datamodules/eurosat.py | 2 +- torchgeo/datamodules/fair1m.py | 2 +- torchgeo/datamodules/inria.py | 2 +- torchgeo/datamodules/landcoverai.py | 2 +- torchgeo/datamodules/loveda.py | 2 +- torchgeo/datamodules/naip.py | 2 +- torchgeo/datamodules/nasa_marine_debris.py | 2 +- torchgeo/datamodules/oscd.py | 2 +- torchgeo/datamodules/potsdam.py | 2 +- torchgeo/datamodules/resisc45.py | 2 +- torchgeo/datamodules/sen12ms.py | 2 +- torchgeo/datamodules/so2sat.py | 2 +- torchgeo/datamodules/ucmerced.py | 2 +- torchgeo/datamodules/vaihingen.py | 2 +- torchgeo/datamodules/xview.py | 2 +- torchgeo/trainers/byol.py | 4 ++-- torchgeo/trainers/classification.py | 4 ++-- torchgeo/trainers/regression.py | 2 +- torchgeo/trainers/segmentation.py | 6 +++--- 31 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fd7657e43..d85c86128 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,5 @@ updates: # Allow up to 2 open pull requests at a time open-pull-requests-limit: 2 ignore: - # torch, tensorboard require protobuf < 4 - - dependency-name: "protobuf" # segmentation-models-pytorch requires older timm, can't update - dependency-name: "timm" diff --git a/docs/conf.py b/docs/conf.py index 558bf9b71..11df4f7ef 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,6 +60,7 @@ nitpick_ignore = [ ("py:class", ".."), # TODO: can't figure out why this isn't found ("py:class", "LightningDataModule"), + ("py:class", "pytorch_lightning.core.module.LightningModule"), # Undocumented class ("py:class", "torchvision.models.resnet.ResNet"), ("py:class", "segmentation_models_pytorch.base.model.SegmentationModel"), diff --git a/experiments/test_chesapeakecvpr_models.py b/experiments/test_chesapeakecvpr_models.py index 38ab24fa8..492eb4af9 100755 --- a/experiments/test_chesapeakecvpr_models.py +++ b/experiments/test_chesapeakecvpr_models.py @@ -89,8 +89,8 @@ def main(args: argparse.Namespace) -> None: trainer = pl.Trainer( gpus=[args.device] if torch.cuda.is_available() else None, logger=False, - progress_bar_refresh_rate=0, - checkpoint_callback=False, + enable_progress_bar=False, + enable_checkpointing=False, ) for experiment_dir in os.listdir(args.input_dir): diff --git a/pyproject.toml b/pyproject.toml index 7fb0324c0..baf144d9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,6 +71,8 @@ filterwarnings = [ # https://github.com/PyTorchLightning/pytorch-lightning/issues/13256 # https://github.com/PyTorchLightning/pytorch-lightning/pull/13261 "ignore:torch.distributed._sharded_tensor will be deprecated:DeprecationWarning:torch.distributed._sharded_tensor", + # https://github.com/Lightning-AI/lightning/issues/13989 + "ignore:SelectableGroups dict interface is deprecated. Use select.:DeprecationWarning:pytorch_lightning.trainer.connectors.callback_connector", # https://github.com/rasterio/rasterio/issues/1742 # https://github.com/rasterio/rasterio/pull/1753 "ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated:DeprecationWarning:rasterio.crs", diff --git a/requirements/required.old b/requirements/required.old index e76122f86..cca8a364b 100644 --- a/requirements/required.old +++ b/requirements/required.old @@ -11,7 +11,6 @@ numpy==1.21.6;python_version=='3.7' omegaconf==2.2.2 packaging==21.3 pillow==9.2.0 -protobuf==3.20.1 pyproj==3.3.1;python_version>='3.8' pyproj==3.2.0;python_version=='3.7' pytorch-lightning==1.6.4 diff --git a/requirements/required.txt b/requirements/required.txt index 171b0487f..d3a08df44 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -10,9 +10,8 @@ numpy==1.23.0;python_version>='3.8' omegaconf==2.2.2 packaging==21.3 pillow==9.2.0 -protobuf==3.20.1 pyproj==3.3.1;python_version>='3.8' -pytorch-lightning==1.6.4 +pytorch-lightning==1.7.0 rasterio==1.3.0;python_version>='3.8' rtree==1.0.0 scikit-learn==1.1.1;python_version>='3.8' diff --git a/torchgeo/datamodules/bigearthnet.py b/torchgeo/datamodules/bigearthnet.py index aca9834fe..67ea60f98 100644 --- a/torchgeo/datamodules/bigearthnet.py +++ b/torchgeo/datamodules/bigearthnet.py @@ -90,7 +90,7 @@ class BigEarthNetDataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.bands = bands self.num_classes = num_classes diff --git a/torchgeo/datamodules/chesapeake.py b/torchgeo/datamodules/chesapeake.py index 74eded7e0..2eff5fb0d 100644 --- a/torchgeo/datamodules/chesapeake.py +++ b/torchgeo/datamodules/chesapeake.py @@ -64,7 +64,7 @@ class ChesapeakeCVPRDataModule(LightningDataModule): Raises: ValueError: if ``use_prior_labels`` is used with ``class_set==7`` """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() for state in train_splits + val_splits + test_splits: assert state in ChesapeakeCVPR.splits assert class_set in [5, 7] diff --git a/torchgeo/datamodules/cowc.py b/torchgeo/datamodules/cowc.py index 736c13a35..4db43f7dc 100644 --- a/torchgeo/datamodules/cowc.py +++ b/torchgeo/datamodules/cowc.py @@ -36,7 +36,7 @@ class COWCCountingDataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.seed = seed self.batch_size = batch_size diff --git a/torchgeo/datamodules/cyclone.py b/torchgeo/datamodules/cyclone.py index 9a9724234..792e4027d 100644 --- a/torchgeo/datamodules/cyclone.py +++ b/torchgeo/datamodules/cyclone.py @@ -44,7 +44,7 @@ class CycloneDataModule(pl.LightningDataModule): api_key: The RadiantEarth MLHub API key to use if the dataset needs to be downloaded """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.seed = seed self.batch_size = batch_size diff --git a/torchgeo/datamodules/deepglobelandcover.py b/torchgeo/datamodules/deepglobelandcover.py index 632add64a..086c70e6e 100644 --- a/torchgeo/datamodules/deepglobelandcover.py +++ b/torchgeo/datamodules/deepglobelandcover.py @@ -36,7 +36,7 @@ class DeepGlobeLandCoverDataModule(pl.LightningDataModule): num_workers: The number of workers to use in all created DataLoaders val_split_pct: What percentage of the dataset to use as a validation set """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/etci2021.py b/torchgeo/datamodules/etci2021.py index 0477c1f40..562032472 100644 --- a/torchgeo/datamodules/etci2021.py +++ b/torchgeo/datamodules/etci2021.py @@ -48,7 +48,7 @@ class ETCI2021DataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.seed = seed self.batch_size = batch_size diff --git a/torchgeo/datamodules/eurosat.py b/torchgeo/datamodules/eurosat.py index 2f6d990e8..47d0057a9 100644 --- a/torchgeo/datamodules/eurosat.py +++ b/torchgeo/datamodules/eurosat.py @@ -68,7 +68,7 @@ class EuroSATDataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/fair1m.py b/torchgeo/datamodules/fair1m.py index a8459c7ba..037337bd9 100644 --- a/torchgeo/datamodules/fair1m.py +++ b/torchgeo/datamodules/fair1m.py @@ -56,7 +56,7 @@ class FAIR1MDataModule(pl.LightningDataModule): val_split_pct: What percentage of the dataset to use as a validation set test_split_pct: What percentage of the dataset to use as a test set """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/inria.py b/torchgeo/datamodules/inria.py index adea872cb..312a5d82d 100644 --- a/torchgeo/datamodules/inria.py +++ b/torchgeo/datamodules/inria.py @@ -65,7 +65,7 @@ class InriaAerialImageLabelingDataModule(pl.LightningDataModule): num_patches_per_tile: Number of random patches per sample predict_on: Directory/Dataset of images to run inference on """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/landcoverai.py b/torchgeo/datamodules/landcoverai.py index b74f649fe..b5a9675eb 100644 --- a/torchgeo/datamodules/landcoverai.py +++ b/torchgeo/datamodules/landcoverai.py @@ -33,7 +33,7 @@ class LandCoverAIDataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/loveda.py b/torchgeo/datamodules/loveda.py index 2bfddd953..05e346ab8 100644 --- a/torchgeo/datamodules/loveda.py +++ b/torchgeo/datamodules/loveda.py @@ -39,7 +39,7 @@ class LoveDADataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.scene = scene self.batch_size = batch_size diff --git a/torchgeo/datamodules/naip.py b/torchgeo/datamodules/naip.py index acd8cdcbe..b2076f2b8 100644 --- a/torchgeo/datamodules/naip.py +++ b/torchgeo/datamodules/naip.py @@ -46,7 +46,7 @@ class NAIPChesapeakeDataModule(pl.LightningDataModule): num_workers: The number of workers to use in all created DataLoaders patch_size: size of patches to sample """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.naip_root_dir = naip_root_dir self.chesapeake_root_dir = chesapeake_root_dir self.batch_size = batch_size diff --git a/torchgeo/datamodules/nasa_marine_debris.py b/torchgeo/datamodules/nasa_marine_debris.py index 989deeb81..9c0221d18 100644 --- a/torchgeo/datamodules/nasa_marine_debris.py +++ b/torchgeo/datamodules/nasa_marine_debris.py @@ -57,7 +57,7 @@ class NASAMarineDebrisDataModule(pl.LightningDataModule): val_split_pct: What percentage of the dataset to use as a validation set test_split_pct: What percentage of the dataset to use as a test set """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/oscd.py b/torchgeo/datamodules/oscd.py index d11649a8a..779566baa 100644 --- a/torchgeo/datamodules/oscd.py +++ b/torchgeo/datamodules/oscd.py @@ -87,7 +87,7 @@ class OSCDDataModule(pl.LightningDataModule): num_patches_per_tile: number of random patches per sample pad_size: size to pad images to during val/test steps """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.bands = bands self.train_batch_size = train_batch_size diff --git a/torchgeo/datamodules/potsdam.py b/torchgeo/datamodules/potsdam.py index 776d999cb..6d5a7bb27 100644 --- a/torchgeo/datamodules/potsdam.py +++ b/torchgeo/datamodules/potsdam.py @@ -37,7 +37,7 @@ class Potsdam2DDataModule(pl.LightningDataModule): num_workers: The number of workers to use in all created DataLoaders val_split_pct: What percentage of the dataset to use as a validation set """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/resisc45.py b/torchgeo/datamodules/resisc45.py index 2c111b043..993f8c97e 100644 --- a/torchgeo/datamodules/resisc45.py +++ b/torchgeo/datamodules/resisc45.py @@ -38,7 +38,7 @@ class RESISC45DataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/sen12ms.py b/torchgeo/datamodules/sen12ms.py index e248d718e..45754424f 100644 --- a/torchgeo/datamodules/sen12ms.py +++ b/torchgeo/datamodules/sen12ms.py @@ -72,7 +72,7 @@ class SEN12MSDataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() assert band_set in SEN12MS.BAND_SETS.keys() self.root_dir = root_dir diff --git a/torchgeo/datamodules/so2sat.py b/torchgeo/datamodules/so2sat.py index 968e81828..8f312e3cc 100644 --- a/torchgeo/datamodules/so2sat.py +++ b/torchgeo/datamodules/so2sat.py @@ -75,7 +75,7 @@ class So2SatDataModule(pl.LightningDataModule): unsupervised_mode: Makes the train dataloader return imagery from the train, val, and test sets """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/ucmerced.py b/torchgeo/datamodules/ucmerced.py index f95f75cf4..2fc08d397 100644 --- a/torchgeo/datamodules/ucmerced.py +++ b/torchgeo/datamodules/ucmerced.py @@ -34,7 +34,7 @@ class UCMercedDataModule(pl.LightningDataModule): batch_size: The batch size to use in all created DataLoaders num_workers: The number of workers to use in all created DataLoaders """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/vaihingen.py b/torchgeo/datamodules/vaihingen.py index cced8a3ff..493087329 100644 --- a/torchgeo/datamodules/vaihingen.py +++ b/torchgeo/datamodules/vaihingen.py @@ -37,7 +37,7 @@ class Vaihingen2DDataModule(pl.LightningDataModule): num_workers: The number of workers to use in all created DataLoaders val_split_pct: What percentage of the dataset to use as a validation set """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/datamodules/xview.py b/torchgeo/datamodules/xview.py index 2548c2485..95868c8c3 100644 --- a/torchgeo/datamodules/xview.py +++ b/torchgeo/datamodules/xview.py @@ -37,7 +37,7 @@ class XView2DataModule(pl.LightningDataModule): num_workers: The number of workers to use in all created DataLoaders val_split_pct: What percentage of the dataset to use as a validation set """ - super().__init__() # type: ignore[no-untyped-call] + super().__init__() self.root_dir = root_dir self.batch_size = batch_size self.num_workers = num_workers diff --git a/torchgeo/trainers/byol.py b/torchgeo/trainers/byol.py index 395a1caef..3fc67278c 100644 --- a/torchgeo/trainers/byol.py +++ b/torchgeo/trainers/byol.py @@ -6,6 +6,7 @@ import random from typing import Any, Callable, Dict, Optional, Tuple, cast +import pytorch_lightning as pl import torch import torch.nn.functional as F import torchvision @@ -13,7 +14,6 @@ from kornia import augmentation as K from kornia import filters from kornia.geometry import transform as KorniaTransform from packaging.version import parse -from pytorch_lightning.core.lightning import LightningModule from torch import Tensor, optim from torch.autograd import Variable from torch.nn.modules import BatchNorm1d, Conv2d, Linear, Module, ReLU, Sequential @@ -304,7 +304,7 @@ class BYOL(Module): pt.data = self.beta * pt.data + (1 - self.beta) * p.data -class BYOLTask(LightningModule): +class BYOLTask(pl.LightningModule): """Class for pre-training any PyTorch model using BYOL.""" def config_task(self) -> None: diff --git a/torchgeo/trainers/classification.py b/torchgeo/trainers/classification.py index 804453b31..790b648d1 100644 --- a/torchgeo/trainers/classification.py +++ b/torchgeo/trainers/classification.py @@ -189,7 +189,7 @@ class ClassificationTask(pl.LightningModule): if batch_idx < 10: try: - datamodule = self.trainer.datamodule # type: ignore[union-attr] + datamodule = self.trainer.datamodule # type: ignore[attr-defined] batch["prediction"] = y_hat_hard for key in ["image", "label", "prediction"]: batch[key] = batch[key].cpu() @@ -358,7 +358,7 @@ class MultiLabelClassificationTask(ClassificationTask): if batch_idx < 10: try: - datamodule = self.trainer.datamodule # type: ignore[union-attr] + datamodule = self.trainer.datamodule # type: ignore[attr-defined] batch["prediction"] = y_hat_hard for key in ["image", "label", "prediction"]: batch[key] = batch[key].cpu() diff --git a/torchgeo/trainers/regression.py b/torchgeo/trainers/regression.py index 7f98de7fc..869ac1e16 100644 --- a/torchgeo/trainers/regression.py +++ b/torchgeo/trainers/regression.py @@ -127,7 +127,7 @@ class RegressionTask(pl.LightningModule): if batch_idx < 10: try: - datamodule = self.trainer.datamodule # type: ignore[union-attr] + datamodule = self.trainer.datamodule # type: ignore[attr-defined] batch["prediction"] = y_hat for key in ["image", "label", "prediction"]: batch[key] = batch[key].cpu() diff --git a/torchgeo/trainers/segmentation.py b/torchgeo/trainers/segmentation.py index 375f5207b..f55e08cab 100644 --- a/torchgeo/trainers/segmentation.py +++ b/torchgeo/trainers/segmentation.py @@ -6,10 +6,10 @@ import warnings from typing import Any, Dict, cast +import pytorch_lightning as pl import segmentation_models_pytorch as smp import torch import torch.nn as nn -from pytorch_lightning.core.lightning import LightningModule from torch import Tensor from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.utils.data import DataLoader @@ -23,7 +23,7 @@ from ..models import FCN DataLoader.__module__ = "torch.utils.data" -class SemanticSegmentationTask(LightningModule): +class SemanticSegmentationTask(pl.LightningModule): """LightningModule for semantic segmentation of images.""" def config_task(self) -> None: @@ -184,7 +184,7 @@ class SemanticSegmentationTask(LightningModule): if batch_idx < 10: try: - datamodule = self.trainer.datamodule # type: ignore[union-attr] + datamodule = self.trainer.datamodule # type: ignore[attr-defined] batch["prediction"] = y_hat_hard for key in ["image", "mask", "prediction"]: batch[key] = batch[key].cpu()