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

Add asserts on doc_stride and max_seq_len to prevent issues with sliding window #538

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

brandenchan
Copy link
Contributor

In cases where the doc_stride is greater than the number of passage tokens in the sliding window, an index error may be thrown. See #536 and #510. This PR adds asserts to avoid these situations.

Note that the number of passage tokens is computed as follows:
max_seq_len - question_tokens - special tokens

@brandenchan brandenchan merged commit ce34cc2 into master Sep 14, 2020
Copy link
Contributor

@Timoeller Timoeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is good for merging, just made a comment to the caught exception.

farm/data_handler/samples.py Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants