STEP icon indicating copy to clipboard operation
STEP copied to clipboard

复现出现张量维度不匹配

Open wml161518 opened this issue 1 year ago • 3 comments

你好师兄,我是一个TS小白,我在跑你的STEP代码一直出现这个张量维度不匹配的问题 Traceback (most recent call last): File "D:\Experiment\Pycode\STEP-github\step\run.py", line 33, in launch_training(args.cfg, args.gpus) File "D:\Experiment\Pycode\STEP-github\basicts\launcher.py", line 20, in launch_training easytorch.launch_training(cfg=cfg, devices=gpus, node_rank=node_rank) File "D:\APP\Anaconda\envs\TS\lib\site-packages\easytorch\launcher\launcher.py", line 86, in launch_training train_dist(cfg) File "D:\APP\Anaconda\envs\TS\lib\site-packages\easytorch\launcher\launcher.py", line 35, in training_func raise e File "D:\APP\Anaconda\envs\TS\lib\site-packages\easytorch\launcher\launcher.py", line 31, in training_func runner.train(cfg) File "D:\APP\Anaconda\envs\TS\lib\site-packages\easytorch\core\runner.py", line 339, in train loss = self.train_iters(epoch, iter_index, data) File "D:\Experiment\Pycode\STEP-github\basicts\runners\base_tsf_runner.py", line 238, in train_iters forward_return = list(self.forward(data=data, epoch=epoch, iter_num=iter_num, train=True)) File "D:\Experiment\Pycode\STEP-github\step\step_runner\step_runner.py", line 66, in forward prediction, pred_adj, prior_adj, gsl_coefficient = self.model(history_data=history_data, long_history_data=long_history_data, future_data=None, batch_seen=iter_num, epoch=epoch) File "D:\APP\Anaconda\envs\TS\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "D:\Experiment\Pycode\STEP-github\step\step_arch\step.py", line 65, in forward y_hat = self.backend(short_term_history, hidden_states=hidden_states, sampled_adj=sampled_adj).transpose(1, 2) File "D:\APP\Anaconda\envs\TS\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "D:\Experiment\Pycode\STEP-github\step\step_arch\graphwavenet\model.py", line 187, in forward gate = self.gate_convsi File "D:\APP\Anaconda\envs\TS\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "D:\APP\Anaconda\envs\TS\lib\site-packages\torch\nn\modules\conv.py", line 307, in forward return self._conv_forward(input, self.weight, self.bias) File "D:\APP\Anaconda\envs\TS\lib\site-packages\torch\nn\modules\conv.py", line 303, in _conv_forward return F.conv1d(input, weight, bias, self.stride, RuntimeError: Expected 2D (unbatched) or 3D (batched) input to conv1d, but got input of size: [4, 32, 207, 2017] 我询问GPT也调试了许久,没能解决这个问题,能向您请教以下解决方案么(我只修改了文件路径,模型里代码我没有进行任何操作,您的另外两个模型我都能跑通,只有这个出现了报错,所以我想跟你请教一下) 如果大佬您有空的话,希望可以得到你的回复

wml161518 avatar Oct 12 '23 05:10 wml161518

这是个兼容性引起的bug,已经在旧的issue中被提及过许多次了。你可以通过将PyTorch降级到1.10及以下来解决这个问题。

zezhishao avatar Oct 12 '23 06:10 zezhishao

好的,谢谢师兄

wml161518 avatar Oct 12 '23 06:10 wml161518

See issue #51 and #26.

zezhishao avatar Oct 12 '23 06:10 zezhishao