You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to implement the LSTM method on the Itrust SWAT datasets using Merlion. However, I am running into a chunking issue for LSTM. LSTM is the only model where I encounter this issue. I resampled the training_data for every second to have a consistent interval. However, the issue remains. I wonder whether this is a bug or a problem in my code.
Lastly, do you have an example notebook with an LSTM example? So far, I wasn't able to identify any LSTM example configs. Making it hard to try something out quickly.
RuntimeError Traceback (most recent call last)
/tmp/ipykernel_62686/1285329270.py in <module>
62
63 lstm = LSTM(lstm_config)
---> 64 lstm.train(training_data,train_config=training_config_lstm)
65 #len(test_data)
~/.local/lib/python3.9/site-packages/merlion/models/forecast/lstm.py in train(self, train_data, train_config)
303 batch = batch.cuda()
304 self.optimizer.zero_grad()
--> 305 out = self.model(batch[:, : -(self.max_forecast_steps + 1)], future=self.max_forecast_steps)
306 loss = F.l1_loss(out, batch[:, 1:])
307 loss.backward()
~/.local/lib/python3.9/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1108 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1109 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1110 return forward_call(*input, **kwargs)
1111 # Do not call functions when jit is used
1112 full_backward_hooks, non_full_backward_hooks = [], []
~/.local/lib/python3.9/site-packages/merlion/models/forecast/lstm.py in forward(self, input, future)
198 :return: the predicted values including both 1-step predictions and the future step predictions
199 """
--> 200 outputs = [rnn(input[:, ::stride]) for stride, rnn in zip(self.strides, self.rnns)]
201 batch_sz, dim = outputs[0].shape
202 preds = [
~/.local/lib/python3.9/site-packages/merlion/models/forecast/lstm.py in <listcomp>(.0)
198 :return: the predicted values including both 1-step predictions and the future step predictions
199 """
--> 200 outputs = [rnn(input[:, ::stride]) for stride, rnn in zip(self.strides, self.rnns)]
201 batch_sz, dim = outputs[0].shape
202 preds = [
~/.local/lib/python3.9/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1108 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1109 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1110 return forward_call(*input, **kwargs)
1111 # Do not call functions when jit is used
1112 full_backward_hooks, non_full_backward_hooks = [], []
~/.local/lib/python3.9/site-packages/merlion/models/forecast/lstm.py in forward(self, input)
146 self.reset(bsz=input.size(0))
147
--> 148 for i, input_t in enumerate(input.chunk(input.size(1), dim=1)):
149 self.h_t, self.c_t = self.lstm1(input_t, (self.h_t, self.c_t))
150 self.h_t2, self.c_t2 = self.lstm2(self.h_t, (self.h_t2, self.c_t2))
RuntimeError: chunk expects `chunks` to be greater than 0, got: 0
Desktop (please complete the following information):
OS: [e.g. Ubuntu 21.10 LTS]
Merlion Version [e.g. 1.0.0]
Additional context
Thank you for considering my issue.
If any more information is required please let me know.
The text was updated successfully, but these errors were encountered:
RabbITCybErSeC
changed the title
[BUG] Chucking issue for LSTM forecasting
[BUG] Chunking issue for LSTM forecasting
Apr 19, 2022
Describe the bug
Hi, I am trying to implement the LSTM method on the Itrust SWAT datasets using Merlion. However, I am running into a chunking issue for LSTM. LSTM is the only model where I encounter this issue. I resampled the training_data for every second to have a consistent interval. However, the issue remains. I wonder whether this is a bug or a problem in my code.
Lastly, do you have an example
notebook
with an LSTM example? So far, I wasn't able to identify any LSTM example configs. Making it hard to try something out quickly.To Reproduce
Below I have the code for my LSTM model.
Expected behavior
No, chunking problem.
Screenshots
Desktop (please complete the following information):
Additional context
Thank you for considering my issue.
If any more information is required please let me know.
The text was updated successfully, but these errors were encountered: