From e267fedfb91ef638891e658661e459350fb1ce6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:20:45 +0000 Subject: [PATCH 1/4] Update torch requirement from <1.14.0,>=1.7.0 to >=1.7.0,<2.1.0 Updates the requirements on [torch](https://github.com/pytorch/pytorch) to permit the latest version. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/master/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v1.7.0...v2.0.0) --- updated-dependencies: - dependency-name: torch dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index c0798db25..41f96a9a0 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): "prophet>=1.1.0, <2.0.0", ], "torch": [ - "torch>=1.7.0, <1.14.0" + "torch>=1.7.0, <2.1.0" ], # https://github.com/SeldonIO/alibi-detect/issues/375 and 387 "tensorflow": [ @@ -23,14 +23,14 @@ def readme(): ], "keops": [ "pykeops>=2.0.0, <2.2.0", - "torch>=1.7.0, <1.14.0" + "torch>=1.7.0, <2.1.0" ], "all": [ "prophet>=1.1.0, <2.0.0", "tensorflow_probability>=0.8.0, <0.20.0", "tensorflow>=2.2.0, !=2.6.0, !=2.6.1, <2.12.0", # https://github.com/SeldonIO/alibi-detect/issues/375 and 387 "pykeops>=2.0.0, <2.2.0", - "torch>=1.7.0, <1.14.0" + "torch>=1.7.0, <2.1.0" ], } From 068e351c814f5be15de2e849288f50423cb23924 Mon Sep 17 00:00:00 2001 From: Alex Athorne Date: Mon, 17 Apr 2023 16:51:39 +0100 Subject: [PATCH 2/4] Remove no_grad decorator on knn methods --- alibi_detect/od/pytorch/knn.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/alibi_detect/od/pytorch/knn.py b/alibi_detect/od/pytorch/knn.py index b01ad5304..b860f278c 100644 --- a/alibi_detect/od/pytorch/knn.py +++ b/alibi_detect/od/pytorch/knn.py @@ -42,7 +42,6 @@ def __init__( self.ks = torch.tensor(k) if self.ensemble else torch.tensor([k], device=self.device) self.ensembler = ensembler - @torch.no_grad() def forward(self, x: torch.Tensor) -> torch.Tensor: """Detect if `x` is an outlier. @@ -67,7 +66,6 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: preds = scores > self.threshold return preds - @torch.no_grad() def score(self, x: torch.Tensor) -> torch.Tensor: """Computes the score of `x` From fb80840cb0f171a5993e904b2fd404b7ae647993 Mon Sep 17 00:00:00 2001 From: Alex Athorne Date: Mon, 17 Apr 2023 16:53:49 +0100 Subject: [PATCH 3/4] Remove no_grad decorators from torch mahalanobis methods --- alibi_detect/od/pytorch/mahalanobis.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/alibi_detect/od/pytorch/mahalanobis.py b/alibi_detect/od/pytorch/mahalanobis.py index bcd17af26..7754f008c 100644 --- a/alibi_detect/od/pytorch/mahalanobis.py +++ b/alibi_detect/od/pytorch/mahalanobis.py @@ -26,7 +26,6 @@ def __init__( super().__init__(device=device) self.min_eigenvalue = min_eigenvalue - @torch.no_grad() def forward(self, x: torch.Tensor) -> torch.Tensor: """Detect if `x` is an outlier. @@ -50,7 +49,6 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: preds = scores > self.threshold return preds - @torch.no_grad() def score(self, x: torch.Tensor) -> torch.Tensor: """Computes the score of `x` From 5a8e2edb8e16b75b30629e5b09526de2c9bae0d0 Mon Sep 17 00:00:00 2001 From: Alex Athorne Date: Tue, 18 Apr 2023 09:55:55 +0100 Subject: [PATCH 4/4] Increase torch upper bound to 3.0.0 --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 42653a3f5..14558bf01 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): "prophet>=1.1.0, <2.0.0", ], "torch": [ - "torch>=1.7.0, <2.1.0" + "torch>=1.7.0, <3.0.0" ], # https://github.com/SeldonIO/alibi-detect/issues/375 and 387 "tensorflow": [ @@ -23,14 +23,14 @@ def readme(): ], "keops": [ "pykeops>=2.0.0, <2.2.0", - "torch>=1.7.0, <2.1.0" + "torch>=1.7.0, <3.0.0" ], "all": [ "prophet>=1.1.0, <2.0.0", "tensorflow_probability>=0.8.0, <0.20.0", "tensorflow>=2.2.0, !=2.6.0, !=2.6.1, <2.13.0", # https://github.com/SeldonIO/alibi-detect/issues/375 and 387 "pykeops>=2.0.0, <2.2.0", - "torch>=1.7.0, <2.1.0" + "torch>=1.7.0, <3.0.0" ], }