nqg icon indicating copy to clipboard operation
nqg copied to clipboard

IndexError: list index out of range

Open SundeepPidugu opened this issue 5 years ago • 2 comments

Traceback (most recent call last):
  File "./eval.py", line 101, in <module>
    eval(args.out_file, args.src_file, args.tgt_file)
  File "./eval.py", line 72, in eval
    pair['prediction'] = output[idx]
IndexError: list index out of range

How do i fix this when iam running eval.py with an output file

SundeepPidugu avatar Jun 05 '19 07:06 SundeepPidugu

Please check the source file, predicted text, output file you are passing as arguments. It might happen that you are passing the pred.txt file generated using src-dev.txt but the default source file for eval.py is src-test.txt. This might be the reason for index mismatch. Also, check where you saved the pred.txt generated using the previous command and pass the correct path. I ran the command as follows: python2 eval.py -out ../sentence/pred.txt -src ../data/processed/src-dev.txt -tgt ../data/processed/tgt-dev.txt

It worked for me

Binathi avatar Jul 03 '19 06:07 Binathi

I met the same error when I run preprocess_embedding.sh, how can I fix it. Traceback (most recent call last):
File "preprocess_embedding.py", line 76, in
main()
File "preprocess_embedding.py", line 49, in main
word2embedding[line[0]] = np.asarray(map(float, line[1 : ]))
IndexError: list index out of range
Traceback (most recent call last):
File "preprocess_embedding.py", line 76, in
main()
File "preprocess_embedding.py", line 49, in main
word2embedding[line[0]] = np.asarray(map(float, line[1 : ]))
IndexError: list index out of range
Traceback (most recent call last):
File "preprocess_embedding.py", line 76, in
main()
File "preprocess_embedding.py", line 49, in main
word2embedding[line[0]] = np.asarray(map(float, line[1 : ]))
IndexError: list index out of range

ant28 avatar Jul 17 '19 10:07 ant28