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

Can not use TSTPLUS with MVP #747

Open jiangye-git opened 1 year ago

jiangye-git commented 1 year ago

Unlabeled 100%

print("Unlabeled 100%") dsid = "transformer" learn = ts_learner(udls100, TSTPlus, cbs=[MVP(target_dir='./data/MVP', fname=f'{dsid}_200')]) learn.fit_one_cycle(40,1e-2) learn.plot_metrics() learn.MVP.show_preds(sharey=True) learn.feature_importance()

Traceback (most recent call last): File "H:\20221125\tasi\tsbert.py", line 106, in learn.fit_one_cycle(40,1e-2) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\callback\schedule.py", line 119, in fit_one_cycle self.fit(n_epoch, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd, start_epoch=start_epoch) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\learner.py", line 256, in fit self._with_events(self._do_fit, 'fit', CancelFitException, self._end_cleanup) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\learner.py", line 193, in _withevents try: self(f'before{event_type}'); f() File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\learner.py", line 171, in call def call(self, event_name): L(event_name).map(self._call_one) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastcore\foundation.py", line 156, in map def map(self, f, *args, gen=False, kwargs): return self._new(map_ex(self, f, *args, gen=gen, *kwargs)) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastcore\basics.py", line 840, in map_ex return list(res) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastcore\basics.py", line 825, in call return self.func(fargs, kwargs) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\learner.py", line 175, in _call_one for cb in self.cbs.sorted('order'): cb(event_name) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\callback\core.py", line 62, in call except Exception as e: raise modify_exception(e, f'Exception occured in {self.__class__.__name__} when calling event {event_name}:\n\t{e.args[0]}', replace=True) File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\fastai\callback\core.py", line 60, in call try: res = getcallable(self, event_name)() File "F:\ProgramData\Anaconda3\envs\pytorchjy\lib\site-packages\tsai\callback\MVP.py", line 183, in before_fit assert xb.shape == self.learn.model(xb).shape, 'the model cannot reproduce the input shape' AssertionError: Exception occured in MVP when calling event before_fit: the model cannot reproduce the input shape

HELP!!!!!

jiangye-git commented 1 year ago

udls100 = get_ts_dls(X, splits=splits, tfms=tfms, batch_tfms=batch_tfms) # used in pretraining

X.shape:(66, 4, 1800)

jiangye-git commented 1 year ago

I have no idea what's wrong TT I just replace the inceptiontimeplus in the TSBERT example.