sktime / pytorch-forecasting

Time series forecasting with PyTorch
https://pytorch-forecasting.readthedocs.io/
MIT License
4.01k stars 637 forks source link

Creating a tensor from a list of lumpy.ndarrays is extremely slow #714

Open DeastinY opened 3 years ago

DeastinY commented 3 years ago

lib/python3.9/site-packages/pytorch_forecasting/data/timeseries.py:1657: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at /opt/conda/conda-bld/pytorch_1634272164809/work/torch/csrc/utils/tensor_new.cpp:201.)

DeastinY commented 3 years ago

So this is the line: target_scale = torch.tensor([batch[0]["target_scale"] for batch in batches], dtype=torch.float) disabling add_target_scales does not affect it.

edcxan commented 3 years ago

Have you tried what it says in the warning? target_scale = torch.tensor(np.array([batch[0]["target_scale"] for batch in batches]), dtype=torch.float)

DeastinY commented 3 years ago

Have you tried what it says in the warning? target_scale = torch.tensor(np.array([batch[0]["target_scale"] for batch in batches]), dtype=torch.float)

did not touch the code yet, no

jomach commented 2 years ago

https://github.com/pytorch/pytorch/issues/13918

MaheshSQL commented 2 years ago

I am seeing same warning with pytorch-forecasting 0.9.2

The trainer.fit() call is listing plenty of these red warnings and there seems to be no way to workaround it. Would this be fixed in upcoming release?

Thanks.

jomach commented 2 years ago

Yes. Please checkout master and install it

DeastinY commented 2 years ago

Yes. Please checkout master and install it

Is that in general recommended? Is master always properly working?

jomach commented 2 years ago

I don't think so. I used it and it worked fine

DeastinY commented 2 years ago

I don't think so. I used it and it worked fine

did you by chance stumble upon the following: 437, in _parse_git_timestamp_iso_strict return dt.datetime.strptime(compat, "%Y-%m-%dT%H:%M:%S%z") File ".../anaconda3/envs/forecasting/lib/python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File ".../anaconda3/envs/forecasting/lib/python3.9/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '%cI' does not match format '%Y-%m-%dT%H:%M:%S%z'

jomach commented 2 years ago

I'm using python 3.8...

DeastinY commented 2 years ago

I'll try that later. What worked for now was checking out the master branch and manually setting the version number. Some package to magically change the 0.0.0 version to something else worked