Closed STARK1117 closed 1 year ago
Please help, great Thanks!!!!
I tried to solve the problem mentioned above by simply adding one line
past_is_pad = np.repeat(past_is_pad.expand_dims(2),future_observed_values.shape[2], axis=2)
before
is_padded_indicator = F.concat(
past_is_pad.slice_axis(
axis=1,
begin=self.history_length - self.context_length,
end=None,
),
F.zeros_like(future_observed_values),
dim=1,
)
so that their dimension match, but then another error occurs
0%| | 0/50 [00:00<?, ?it/s]
Traceback (most recent call last):
File "F:\baigao\Tutorial\MyTest2.py", line 29, in
it happens on Line 768
#This is a dummy computation to avoid deferred initialization error
#when past_is_pad is not used in the computation graph in default
#unrolling mode.
state = [
F.where(
is_padded_indicator.slice_axis(axis=1, begin=0, end=1).repeat(
repeats=self.num_cells, axis=1
),
bs,
s,
)
for bs, s in zip(begin_state, state)
]
I see it's a dummy computation, so I commented them out and everything solved. Where I had the following outputs:
C:\Users\NPU.conda\envs\GPU_gluon\python.exe F:/baigao/Tutorial/MyTest2.py 100%|██████████| 100/100 [00:17<00:00, 5.57it/s, epoch=1/10, avg_epoch_loss=4.75] 100%|██████████| 100/100 [00:18<00:00, 5.35it/s, epoch=2/10, avg_epoch_loss=4.51] 100%|██████████| 100/100 [00:18<00:00, 5.30it/s, epoch=3/10, avg_epoch_loss=4.48] 100%|██████████| 100/100 [00:19<00:00, 5.20it/s, epoch=4/10, avg_epoch_loss=4.48] 100%|██████████| 100/100 [00:19<00:00, 5.07it/s, epoch=5/10, avg_epoch_loss=4.44] 100%|██████████| 100/100 [00:18<00:00, 5.31it/s, epoch=6/10, avg_epoch_loss=4.43] 100%|██████████| 100/100 [00:19<00:00, 5.25it/s, epoch=7/10, avg_epoch_loss=4.44] 100%|██████████| 100/100 [00:18<00:00, 5.27it/s, epoch=8/10, avg_epoch_loss=4.41] 100%|██████████| 100/100 [00:19<00:00, 5.24it/s, epoch=9/10, avg_epoch_loss=4.41] 100%|██████████| 100/100 [00:18<00:00, 5.28it/s, epoch=10/10, avg_epoch_loss=4.41]
But I am not quite sure if it's appropriate to do so. Looking forward to further assistance.
dim = 2 # dimension of the observations
Hi! It looks like you're using a multivariate dataset with DeepAR. DeepAR is a univariate model. It only supports one-dimensional inputs. You might want to try a multivariate model instead. The list of available models can be found here. If you want something similar to DeepAR in the multivariate setting, use the DeepVAR model.
Description
unroll_encoder_default doesn't match the dimension!!!
To Reproduce
win10 mxnet-1.7.0.post2 gluonts-0.12.6 numpy-1.20.0
C:\Users\NPU.conda\envs\GPU_gluon\python.exe F:/baigao/Tutorial/MyTest2.py 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "F:\baigao\Tutorial\MyTest2.py", line 57, in
predictor = estimator.train(train_ds)
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\model\estimator.py", line 237, in train
return self.train_model(
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\model\estimator.py", line 214, in train_model
self.trainer(
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\trainer_base.py", line 420, in call
epoch_loss = loop(
File "C:\Users\NPU.conda\envs\GPUgluon\lib\site-packages\gluonts\mx\trainer_base.py", line 286, in loop
= net(batch.values())
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\mxnet\gluon\block.py", line 682, in call
out = self.forward(args)
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\mxnet\gluon\block.py", line 1254, in forward
return self.hybrid_forward(ndarray, x, *args, *params)
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\model\deepar_network.py", line 908, in hybrid_forward
outputs = self.distribution(
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\model\deepar_network.py", line 847, in distribution
rnnoutputs, , scale, , = self.unroll_encoder(
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\model\deepar_network.py", line 684, in unroll_encoder_default
is_padded_indicator = F.concat(
File "", line 70, in concat
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\mxnet_ctypes\ndarray.py", line 82, in _imperative_invoke
check_call(_LIB.MXImperativeInvokeEx(
File "C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\mxnet\base.py", line 246, in check_call
raise get_last_ffi_error()
mxnet.base.MXNetError: Traceback (most recent call last):
File "C:\Jenkins\workspace\mxnet-tag\mxnet\src\operator\nn\concat.cc", line 67
MXNetError: Check failed: shape_assign(&( in_shape)[i], dshape): Incompatible input shape: expected [2,-1], got [2,50,2]
Process finished with exit code 1
it turns out to be the problem of here: In C:\Users\NPU.conda\envs\GPU_gluon\lib\site-packages\gluonts\mx\model\deepar_network.py Line 691
the dimension of past_is_pad.slice_axis( axis=1, begin=self.history_length - self.context_length, end=None, ) and F.zeros_like(future_observed_values) don't match
so I printed out their shape as
and get (3, 25) (3, 25, 2)
Environment
(Add as much information about your environment as possible, e.g. dependencies versions.)