exclude spans that are out of valid window #128
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When doing inference with a
TransformerTokenClassificationTaskModule
that was trained with windowing and an overlap, it will also produce spans from the output of the model that is just the additional context, i.e. the part that overlaps. However, this is not recommended since the model was not trained to produce correct predictions for this part (just the non-overlapping part was taken into account to use every part of the input only "once" for training).This PR excludes spans that are completely out of the valid window (the not overlapping part). However, we still take predicted spans into account, that are only partly in the valid window because they would get lost otherwise. But this has to be taken into account for further post-processing steps since it may produce the same span multiple times (i.e. from the end of one window and from the beginning of the next one). Any de-duplication is not handled here.