Skip to content

Commit

Permalink
Fix boundary condition in token_block_utils_fast.pyx (facebookresearc…
Browse files Browse the repository at this point in the history
…h#1445)

Summary:
In cases where the item size in the underlying dataset is 0, it's possible that `remaining` is initialized to 0. We can update the assert to reflect this.

Pull Request resolved: fairinternal/fairseq-py#1445

Reviewed By: alexeib

Differential Revision: D25054723

Pulled By: myleott

fbshipit-source-id: 1bb73cce34e973f407436c442b698ce706d97359
  • Loading branch information
myleott authored and facebook-github-bot committed Nov 18, 2020
1 parent 265791b commit e931009
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fairseq/data/token_block_utils_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ cdef class DatasetSearcher(object):
self.current_offset += to_consume
self.current_i += to_consume
else:
assert remaining > 0
assert remaining >= 0
self.current_i += remaining
self.current_index += 1
self.current_offset = 0
Expand Down

0 comments on commit e931009

Please sign in to comment.