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

no model错误 #23

Open
ashleyhyx opened this issue May 27, 2019 · 1 comment
Open

no model错误 #23

ashleyhyx opened this issue May 27, 2019 · 1 comment

Comments

@ashleyhyx
Copy link

C:\ProgramData\Anaconda3\envs\torch\python.exe E:/hyx/seq2seq-master/seq2seq.py train
C:\ProgramData\Anaconda3\envs\torch\lib\site-packages\torch\nn\modules\rnn.py:54: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.05 and num_layers=1
"num_layers={}".format(dropout, num_layers))
Error(s) in loading state_dict for seq2seq:
size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([600, 100]) from checkpoint, the shape in current model is torch.Size([14, 100]).
size mismatch for decoder.embedding.weight: copying a param with shape torch.Size([1600, 100]) from checkpoint, the shape in current model is torch.Size([15, 100]).
size mismatch for decoder.out.weight: copying a param with shape torch.Size([1600, 200]) from checkpoint, the shape in current model is torch.Size([15, 200]).
size mismatch for decoder.out.bias: copying a param with shape torch.Size([1600]) from checkpoint, the shape in current model is torch.Size([15]).
No model!
还有下面的报错
Traceback (most recent call last):
File "E:/hyx/seq2seq-master/seq2seq.py", line 436, in
seq.train()
File "E:/hyx/seq2seq-master/seq2seq.py", line 210, in train
loss, logits = self.step(inputs, targets, self.max_length)
File "E:/hyx/seq2seq-master/seq2seq.py", line 271, in step
return loss.data[0] / target_length, decoder_outputs
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
怎么调都不对,求指点~~

@yanwii
Copy link
Owner

yanwii commented Aug 26, 2019

从no model的错误来看,是模型文件和模型不匹配的问题,删掉模型文件重新训练。第二个错误是loss这个tensor为空,也就是对应的input为空,检查一下输入数据即可。

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

2 participants