yuqinie98 / PatchTST

An offical implementation of PatchTST: "A Time Series is Worth 64 Words: Long-term Forecasting with Transformers." (ICLR 2023) https://arxiv.org/abs/2211.14730
Apache License 2.0
1.51k stars 262 forks source link

ValueError: __len__() should return >= 0 #32

Closed Xizhang-Yao closed 1 year ago

Xizhang-Yao commented 1 year ago

File "/public/yxz/TimeSeriesForecast/V2+TS-library/PatchTST/PatchTST_supervised/exp/exp_main.py", line 102, in train vali_data, vali_loader = self._get_data(flag='val') File "/public/yxz/TimeSeriesForecast/V2+TS-library/PatchTST/PatchTST_supervised/exp/exp_main.py", line 43, in _get_data data_set, data_loader = data_provider(self.args, flag) File "/public/yxz/TimeSeriesForecast/V2+TS-library/PatchTST/PatchTST_supervised/data_provider/data_factory.py", line 44, in data_provider print(flag, len(data_set)) ValueError: len() should return >= 0

为什么测试集是空的,???哪里出bug了?

yuqinie98 commented 1 year ago

你好,不好意思不清楚是哪里出现了问题,请问数据集是否下载在正确位置?

cdlkasdav commented 1 year ago

File "/public/yxz/TimeSeriesForecast/V2+TS-library/PatchTST/PatchTST_supervised/exp/exp_main.py", line 102, in train vali_data, vali_loader = self._get_data(flag='val') File "/public/yxz/TimeSeriesForecast/V2+TS-library/PatchTST/PatchTST_supervised/exp/exp_main.py", line 43, in _get_data data_set, data_loader = data_provider(self.args, flag) File "/public/yxz/TimeSeriesForecast/V2+TS-library/PatchTST/PatchTST_supervised/data_provider/data_factory.py", line 44, in data_provider print(flag, len(data_set)) ValueError: len() should return >= 0

为什么测试集是空的,???哪里出bug了?

我也遇到了同样的问题,请问你的问题解决了吗

yuqinie98 commented 1 year ago

您好,Create a seperate folder ./dataset and put all the csv files in the directory. 请问数据集是在这个位置吗?

yyk404 commented 1 year ago

The location of the dataset attempts to use an absolute path

Mrsong0502 commented 1 year ago

尝试使用绝对路径也没有用,请问还有其他解决办法吗

yuqinie98 commented 1 year ago

I am not sure about the problem here so maybe someone else could help if they solve this

way2geek commented 1 year ago

数据集数量太少,减少seq length 和 pred length试试

yuqinie98 commented 1 year ago

数据集数量太少,减少seq length 和 pred length试试

确实是可能的原因,感谢 def len(self): return len(self.data_x) - self.seq_len - self.pred_len + 1