Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
27182812 opened this issue Apr 28, 2021 · 1 comment

Comments

@27182812
Copy link

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

您知道怎么解决吗?

@27182812
Copy link
Author

这是具体的执行结果:
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 ==========

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant