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

Mysterious Error that comes and goes: IndexError: index 0 is out of bounds for axis 0 with size 0 #42

Open
abhishekgupte94 opened this issue Mar 16, 2019 · 3 comments

Comments

@abhishekgupte94
Copy link

Hi, I've combined all your python scripts into one jupyter file and am trying to run them. Sometimes i get this "IndexError: index 0 is out of bounds for axis 0 with size 0" error and at other times it trains the model successfully. What seems to be the problem?

@adeshpande3
Copy link
Owner

For what piece of code are you getting this error?

@abhishekgupte94
Copy link
Author

error1

It's occuring in the "getTrainingBatch()" function. I've added another argument to the function but I don't believe that has anything to do with the error as the error is occuring at np.argwhere()..I think it's np.argwhere(example==EOStokenIndex)[0] is returning an empty array for some reason

@adeshpande3
Copy link
Owner

So basically np.argwhere(example==EOStokenIndex) is returning you an empty array and you're seeing the error because we're trying to return the 0th index. So that line returning an empty array means that in at least one of the values (example is the name) inside the labels list does not have an end of sentence token. So you should check why that is the case. Normally this code should handle it since it adds an EOS token to the end, but there might be a possible issue in that you have a string of exactly maxLen length and then you can't really add an EOS token to the end of it. I'd start by printing out the example that is causing the error and then working from there.

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