awslabs / gluonts

Probabilistic time series modeling in Python
https://ts.gluon.ai
Apache License 2.0
4.61k stars 752 forks source link

"MXNetError: vector<T> too long" occurred in the official tutorial #495

Closed nyanko-box closed 4 years ago

nyanko-box commented 4 years ago

Hi, there.

I newly installed MXNet and GluonTS in Python 3.6.8 environment. My PC and Python configrations are the followings.

OS: Windows 10 pro 10.0.17763 build 17763 CPU: Intel(R) Core(TM) i7-8700 RAM: 64GB GPU: NVIDIA GeForce GTX 1080Ti
CUDA: v10.0.130 CuDNN: v7.4.1

Python: 3.6.8 pandas: 0.25.3 numpy: 1.16.5 mxnet: cu100-1.5.0 gluonts: 0.4.2 jupyter: 1.0.0 jupyterlab: 1.2.3 notebook: 6.0.2

I downloaded the notebook of Extended Forecasting Tutorial and run on jupyterlab. Then, MXNetError: vector<T> too long occurred when converting generator to list.

forecast_it, ts_it = make_evaluation_predictions(
    dataset=dataset.test,  # test dataset
    predictor=predictor,  # predictor
    num_samples=100,  # number of sample paths we want for evaluation
)

forecasts = list(forecast_it) # <- the error occurred here
tss = list(ts_it)

Does anyone have the insight about this? Thanks in advance.

Full sentence of error is the following.

---------------------------------------------------------------------------
MXNetError                                Traceback (most recent call last)
<ipython-input-16-19e7d512cf80> in <module>
----> 1 forecasts = list(forecast_it)
      2 tss = list(ts_it)

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\model\predictor.py in predict(self, dataset, num_samples)
    307             freq=self.freq,
    308             output_transform=self.output_transform,
--> 309             num_samples=num_samples,
    310         )
    311 

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\model\forecast_generator.py in __call__(self, inference_data_loader, prediction_net, input_names, freq, output_transform, num_samples, **kwargs)
    195         for batch in inference_data_loader:
    196             inputs = [batch[k] for k in input_names]
--> 197             outputs = prediction_net(*inputs).asnumpy()
    198             if output_transform is not None:
    199                 outputs = output_transform(batch, outputs)

~\appdata\local\programs\python\python36\lib\site-packages\mxnet\gluon\block.py in __call__(self, *args)
    546             hook(self, args)
    547 
--> 548         out = self.forward(*args)
    549 
    550         for hook in self._forward_hooks.values():

~\appdata\local\programs\python\python36\lib\site-packages\mxnet\gluon\block.py in forward(self, x, *args)
    923                     params = {i: j.data(ctx) for i, j in self._reg_params.items()}
    924 
--> 925                 return self.hybrid_forward(ndarray, x, *args, **params)
    926 
    927         assert isinstance(x, Symbol), \

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\model\simple_feedforward\_network.py in hybrid_forward(self, F, past_target)
    185 
    186         # (num_samples, batch_size, prediction_length)
--> 187         samples = distr.sample(self.num_parallel_samples)
    188 
    189         # (batch_size, num_samples, prediction_length)

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\distribution\transformed_distribution.py in sample(self, num_samples, dtype)
     87         with autograd.pause():
     88             s = self.base_distribution.sample(
---> 89                 num_samples=num_samples, dtype=dtype
     90             )
     91             for t in self.transforms:

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\distribution\student_t.py in sample(self, num_samples, dtype)
    116             sigma=self.sigma,
    117             nu=self.nu,
--> 118             num_samples=num_samples,
    119         )
    120 

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\distribution\distribution.py in _sample_multiple(sample_func, num_samples, *args, **kwargs)
    300         k: _expand_param(v, num_samples) for k, v in kwargs.items()
    301     }
--> 302     samples = sample_func(*args_expanded, **kwargs_expanded)
    303     return samples

~\appdata\local\programs\python\python36\lib\site-packages\gluonts\distribution\student_t.py in s(mu, sigma, nu)
    104             F = self.F
    105             gammas = F.sample_gamma(
--> 106                 alpha=nu / 2.0, beta=2.0 / (nu * F.square(sigma)), dtype=dtype
    107             )
    108             normal = F.sample_normal(

~\appdata\local\programs\python\python36\lib\site-packages\mxnet\ndarray\register.py in sample_gamma(alpha, beta, shape, dtype, out, name, **kwargs)

~\appdata\local\programs\python\python36\lib\site-packages\mxnet\_ctypes\ndarray.py in _imperative_invoke(handle, ndargs, keys, vals, out)
     90         c_str_array(keys),
     91         c_str_array([str(s) for s in vals]),
---> 92         ctypes.byref(out_stypes)))
     93 
     94     if original_output is not None:

~\appdata\local\programs\python\python36\lib\site-packages\mxnet\base.py in check_call(ret)
    251     """
    252     if ret != 0:
--> 253         raise MXNetError(py_str(_LIB.MXGetLastError()))
    254 
    255 

MXNetError: vector<T> too long
mbohlkeschneider commented 4 years ago

Hi @nyanko-box ,

thank you for using GluonTS.

GluonTS is currently incompatible with mxnet 1.5.0. Try downgrading to the recommended mxnet 1.4.1 and try again.

nyanko-box commented 4 years ago

@mbohlkeschneider

Thank you for replying my question.

GluonTS is currently incompatible with mxnet 1.5.0. Try downgrading to the recommended mxnet 1.4.1 and try again.

Sorry, I missed the Installation info and installed latest version... pip install --upgrade mxnet==1.4.1 gluonts

It was confirmed that the conversion process successfully done from generator to list by downgrading mxnet-cu100 from 1.5.0 to 1.4.1.

Thank you for spending your time to my tiny question.