gmftbyGMFTBY / MultiTurnDialogZoo

Multi-turn dialogue baselines written in PyTorch
MIT License
162 stars 23 forks source link

RuntimeError: The size of tensor a (31) must match the size of tensor b (30) at non-singleton dimension 0 #12

Open 27182812 opened 3 years ago

27182812 commented 3 years ago

您好,很棒的工作! 我在用您的代码跑评测数据,数据集用的是dailydialog,模型选择的是Transformer 但是报了这样的错“RuntimeError: The size of tensor a (31) must match the size of tensor b (30) at non-singleton dimension 0 ” 您知道怎么解决吗?

27182812 commented 3 years ago

这是具体的执行结果: Traceback (most recent call last): File "train.py", line 786, in main(*args_dict) File "train.py", line 624, in main kl_annealing_iter=kwargs['kl_annealing_iter']) File "train.py", line 76, in train output = net(sbatch, tbatch, turn_lengths) File "/home/tjucic/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(input, kwargs) File "/home/tjucic/bigdata/qys/MultiTurnDialogZoo-master/model/seq2seq_transformer.py", line 148, in forward src = self.pos_enc(self.embed_src(src) math.sqrt(self.d_model)) File "/home/tjucic/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(input, kwargs) File "/home/tjucic/bigdata/qys/MultiTurnDialogZoo-master/model/layers.py", line 188, in forward x = x + self.pe[:x.size(0), :] RuntimeError: The size of tensor a (31) must match the size of tensor b (30) at non-singleton dimension 0 ========== train done ==========