timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
4.95k stars 625 forks source link

ImportError: cannot import name 'get_forecasting_splits' from 'tsai.data.validation' #721

Closed langslike closed 1 year ago

langslike commented 1 year ago

Hi, i am learning the tutotial on data preparation: https://timeseriesai.github.io/tsai/data.preparation.html#forecasting-data-preparation in this doc there is a line: from tsai.data.validation import get_forecasting_splits when i run this, i got error:

ImportError Traceback (most recent call last) Cell In[4], line 1 ----> 1 from tsai.data.validation import get_forecasting_splits 3 fcst_history = 10 4 fcst_horizon = 5

ImportError: cannot import name 'get_forecasting_splits' from 'tsai.data.validation' (d:\Anaconda\envs\py39\lib\site-packages\tsai\data\validation.py)

my configuration os : Windows-10-10.0.19041-SP0 python : 3.9.16 tsai : 0.3.4 fastai : 2.7.10 fastcore : 1.5.27 torch : 1.12.1+cu113 device : 1 gpu (['NVIDIA GeForce GTX 1650']) cpu cores : 4 threads per cpu : 2 RAM : 15.84 GB GPU memory : [4.0] GB

BTW, I am going through the doc and try to run the code line by line, I encounterd several other similar errors where 'ImportError: cannot import name ***', I go to check my installed tsai package and indeed didn`t found the function, the function only appears in tsai-main repository. What's wrong with my tsai installation? Do I need to replace my installed file with the corresponding one in tsai-main?

oguiza commented 1 year ago

Hi @langslike, You need to upgrade to tsai>=0.3.5. This is some new functionality only available as of release 0.3.5.

langslike commented 1 year ago

Thanks, Is it possible that users can choose to read the exact version of docs for his own installation, like: https://pytorch.org/docs/versions.html I think it might be helpful.

oguiza commented 1 year ago

Thanks for your suggestion @langslike. Unfortunately, nbdev, the library I use to create the code, tests, and documentation, doesn't allow doc versioning. I recommend users upgrade to the most recent stable version in pip/ conda.