OpenNMT Forum

Error during train the model

opennmt-py
(sevilay) #1

Hi,

During train the model I got this error below, please can you point ho to deal with?

[2019-03-31 09:45:14,940 INFO] Loading dataset from data/demo.valid.0.pt, number of examples: 1000
Traceback (most recent call last):
File “train.py”, line 109, in
main(opt)
File “train.py”, line 41, in main
single_main(opt, -1)
File “/media/sevilay/SAMSUNG/openNmt/OpenNMT-py/onmt/train_single.py”, line 116, in main
valid_steps=opt.valid_steps)
File “/media/sevilay/SAMSUNG/openNmt/OpenNMT-py/onmt/trainer.py”, line 224, in train
valid_iter, moving_average=self.moving_average)
File “/media/sevilay/SAMSUNG/openNmt/OpenNMT-py/onmt/trainer.py”, line 274, in validate
outputs, attns = valid_model(src, tgt, src_lengths)
File “/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py”, line 489, in call
result = self.forward(*input, **kwargs)
File “/media/sevilay/SAMSUNG/openNmt/OpenNMT-py/onmt/models/model.py”, line 42, in forward
enc_state, memory_bank, lengths = self.encoder(src, lengths)
File “/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py”, line 489, in call
result = self.forward(*input, **kwargs)
File “/media/sevilay/SAMSUNG/openNmt/OpenNMT-py/onmt/encoders/rnn_encoder.py”, line 74, in forward
packed_emb = pack(emb, lengths_list)
File “/usr/local/lib/python2.7/dist-packages/torch/nn/utils/rnn.py”, line 148, in pack_padded_sequence
return PackedSequence(torch._C._VariableFunctions._pack_padded_sequence(input, lengths, batch_first))
RuntimeError: Length of all samples has to be greater than 0, but found an element in ‘lengths’ that is <= 0
Sevilay

0 Likes

(Guillaume Klein) #2

Hi,

See:

0 Likes

(Guillaume Klein) closed #3
0 Likes