Skip to content

Commit

Permalink
style: Token type
Browse files Browse the repository at this point in the history
  • Loading branch information
LutingWang committed Dec 15, 2024
1 parent 7aa979e commit f1aed7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions todd/tasks/natural_language_processing/tokenizers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class BaseTokenizer:
def __init__(
self,
*args,
text2token: Mapping[str, int],
special_text2token: Mapping[str, int],
text2token: Mapping[str, Token],
special_text2token: Mapping[str, Token],
**kwargs,
) -> None:
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -75,7 +75,7 @@ def encodes(
tokens[i, :len(token_sequence)] = torch.tensor(token_sequence)
return tokens

def _token_to_text(self, token: int) -> str:
def _token_to_text(self, token: Token) -> str:
if token in self._special_token2text:
return self._special_token2text[token]
return self._token2text[token]
Expand Down

0 comments on commit f1aed7c

Please sign in to comment.