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

IndexError: list index out of range #37

Open
SundeepPidugu opened this issue Jun 5, 2019 · 2 comments
Open

IndexError: list index out of range #37

SundeepPidugu opened this issue Jun 5, 2019 · 2 comments

Comments

@SundeepPidugu
Copy link

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

@Binathi
Copy link

Binathi commented Jul 3, 2019

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

@ant28
Copy link

ant28 commented Jul 17, 2019

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

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

3 participants