There seems to be something wrong with your model code?
Opened this issue · 9 comments
Your model code seems to have a dimension mismatch.
Traceback (most recent call last):
File "E:\research\Experiment\CIKM23-HIEST-main\run_model.py", line 36, in
run_model(task=args.task, model_name=args.model, dataset_name=args.dataset,
File "E:\research\Experiment\CIKM23-HIEST-main\libcity\pipeline\pipeline.py", line 57, in run_model
executor.train(train_data, valid_data)
File "E:\research\Experiment\CIKM23-HIEST-main\libcity\executor\traffic_state_executor.py", line 297, in train
losses = self._train_epoch(train_dataloader, epoch_idx, self.loss_func)
File "E:\research\Experiment\CIKM23-HIEST-main\libcity\executor\traffic_state_executor.py", line 369, in _train_epoch
loss = loss_func(batch)
File "E:\research\Experiment\CIKM23-HIEST-main\libcity\model\traffic_speed_prediction\HIEST.py", line 393, in calculate_loss
y_predicted,xr,xg = self.predict(batch)
File "E:\research\Experiment\CIKM23-HIEST-main\libcity\model\traffic_speed_prediction\HIEST.py", line 427, in predict
return self.forward(batch)
File "E:\research\Experiment\CIKM23-HIEST-main\libcity\model\traffic_speed_prediction\HIEST.py", line 321, in forward
gate = self.gate_convsi
File "E:\miniconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "E:\miniconda\envs\pytorch\lib\site-packages\torch\nn\modules\conv.py", line 313, in forward
return self._conv_forward(input, self.weight, self.bias)
File "E:\miniconda\envs\pytorch\lib\site-packages\torch\nn\modules\conv.py", line 309, 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: [64, 32, 170, 13]
Our code is based on Python version 3.7 and Pytorch version 1.7.1, same as that of LibCity. If you are using another version of Pytorch you may get this kind of issue.
这个似乎和环境没有关系,我遇到了一样的问题,把HIEST的line 256的self.filter_convs.append(nn.Conv2d(in_channels=self.residual_channels,
out_channels=self.dilation_channels,
kernel_size=(1, self.kernel_size), dilation=new_dilation))中的Conv2d改成Conv1d似乎能解决这个问题,不知道是否可以这样解决?
这个似乎和环境没有关系,我遇到了一样的问题,把HIEST的line 256的self.filter_convs.append(nn.Conv2d(in_channels=self.residual_channels, out_channels=self.dilation_channels, kernel_size=(1, self.kernel_size), dilation=new_dilation))中的Conv2d改成Conv1d似乎能解决这个问题,不知道是否可以这样解决?
I also don't think it's the experimental environment
这个似乎和环境没有关系,我遇到了一样的问题,把HIEST的line 256的self.filter_convs.append(nn.Conv2d(in_channels=self.residual_channels, out_channels=self.dilation_channels, kernel_size=(1, self.kernel_size), dilation=new_dilation))中的Conv2d改成Conv1d似乎能解决这个问题,不知道是否可以这样解决?
I also don't think it's the experimental environment
How to explain the different running results? Or can you upload your running results?
这个似乎和环境没有关系,我遇到了一样的问题,把HIEST的line 256的self.filter_convs.append(nn.Conv2d(in_channels=self.residual_channels, out_channels=self.dilation_channels, kernel_size=(1, self.kernel_size), dilation=new_dilation))中的Conv2d改成Conv1d似乎能解决这个问题,不知道是否可以这样解决?
我也不认为这是实验环境
如何解释不同的运行结果?或者你能上传你的跑步结果吗?
我从2d改成1d似乎还是不能解决这个问题。我没有成功跑通过这个程序
这个似乎和环境没有关系,我遇到了一样的问题,把HIEST的line 256的self.filter_convs.append(nn.Conv2d(in_channels=self.residual_channels, out_channels=self.dilation_channels, kernel_size=(1, self.kernel_size), dilation=new_dilation))中的Conv2d改成Conv1d似乎能解决这个问题,不知道是否可以这样解决?
我也不认为这是实验环境
如何解释不同的运行结果?或者你能上传你的跑步结果吗?
我从2d改成1d似乎还是不能解决这个问题。我没有成功跑通过这个程序
It looks like you got a different Pytorch version.
The environment does matter. Please also check the section about setting environment of our doc
You can have a try on GWNet and I think you will get the same error message. I have tried libcity code with Pytorch1.9 before and got the same error message.
When I used torch1.7.1, it prompted me that the GPU was unavailable. Due to this compatibility issue, I modified the torch version to run, but I don’t think it was a version problem.
What is the CPU model and CUDA version you are using?