OpenNMT-py icon indicating copy to clipboard operation
OpenNMT-py copied to clipboard

StopIteration

Open tonytu16 opened this issue 4 years ago • 2 comments

I was trying to create glove embeddings using the following command ./tools/embeddings_to_torch.py -emb_file_both /OpenNMT-py/glove_dir/glove.6B.100d.txt -dict_file "data/data.vocab.pt" -output_file "data/embeddings"

but I'm getting: Saving embedding as: * enc: data/embeddings.enc.pt * dec: data/embeddings.dec.pt Traceback (most recent call last): File "./tools/embeddings_to_torch.py", line 160, in main() File "./tools/embeddings_to_torch.py", line 148, in main convert_to_torch_tensor(src_vectors, enc_vocab), File "./tools/embeddings_to_torch.py", line 57, in convert_to_torch_tensor dim = len(six.next(six.itervalues(word_to_float_list_dict))) StopIteration

Can someone help?

tonytu16 avatar Mar 02 '20 06:03 tonytu16

This StopIteration means that it reached the end of the iterator. This means your src_vectors is probably empty or in the wrong format.

francoishernandez avatar Mar 02 '20 20:03 francoishernandez

Thanks for the reply! What could be causing this error? I am using the same format as src-train-case.txt except that I am using two features.

tonytu16 avatar Mar 03 '20 09:03 tonytu16