From 7a33d75a1928a2962d8680fda72ab65a9c3a1b6c Mon Sep 17 00:00:00 2001 From: Mourier Date: Fri, 12 Jan 2024 20:46:22 +0300 Subject: [PATCH 1/2] prevented input re-normalization by rin using .clone() inside `io_processor` --- darts/models/forecasting/pl_forecasting_module.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/darts/models/forecasting/pl_forecasting_module.py b/darts/models/forecasting/pl_forecasting_module.py index 7ade7eaac9..ab98ee59c2 100644 --- a/darts/models/forecasting/pl_forecasting_module.py +++ b/darts/models/forecasting/pl_forecasting_module.py @@ -50,7 +50,8 @@ def forward_wrapper(self, *args, **kwargs): # x is input batch tuple which by definition has the past features in the first element starting with the # first n target features - x: Tuple = args[0][0] + # assuming `args[0][0]` is torch.Tensor we could clone it to prevent target re-normalization + x: Tuple = args[0][0].clone() # apply reversible instance normalization x[:, :, : self.n_targets] = self.rin(x[:, :, : self.n_targets]) # run the forward pass From ffde571c9c1c240ca154039579380447b88c35f7 Mon Sep 17 00:00:00 2001 From: Dennis Bader Date: Sat, 13 Jan 2024 12:56:35 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f52f1a76..45fa2eb617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ but cannot always guarantee backwards compatibility. Changes that may **break co **Improved** **Fixed** - +- Fixed a bug when using a `TorchForecastingModel` with `use_reversible_instance_norm=True` and predicting with `n > output_chunk_length`. The input normalized multiple times. [#2160](https://github.com/unit8co/darts/pull/2160) by [FourierMourier](https://github.com/FourierMourier). ### For developers of the library: ## [0.27.1](https://github.com/unit8co/darts/tree/0.27.1) (2023-12-10)