Skip to content

Commit

Permalink
make value checking for span_indices explicit
Browse files Browse the repository at this point in the history
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
  • Loading branch information
garyhlai and sgugger committed Apr 20, 2022
1 parent f83dfc3 commit edc4e1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/tokenization_utils_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def token_to_chars(self, batch_or_token_index: int, token_index: Optional[int] =
token_index = batch_or_token_index
span_indices = self._encodings[batch_index].token_to_chars(token_index)

return CharSpan(*span_indices) if span_indices else None
return CharSpan(*span_indices) if span_indices is not None else None

def char_to_token(
self, batch_or_char_index: int, char_index: Optional[int] = None, sequence_index: int = 0
Expand Down

0 comments on commit edc4e1b

Please # to comment.