Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

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

Merged
brandenchan merged 1 commit intomasterfrom
fix_sliding_window
Sep 14, 2020
Merged

Add asserts on doc_stride and max_seq_len to prevent issues with sliding window#538
brandenchan merged 1 commit intomasterfrom
fix_sliding_window

Conversation

@brandenchan
Copy link
Copy Markdown
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 requested a review from tholor September 14, 2020 10:02
@brandenchan brandenchan merged commit ce34cc2 into master Sep 14, 2020
Copy link
Copy Markdown
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants