Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a typo in tokenizer documentation #28118

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transformers/models/jukebox/tokenization_jukebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _convert_token_to_id(self, list_artists, list_genres, list_lyrics):

def _tokenize(self, lyrics):
"""
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based
Converts a string into a sequence of tokens (string), using the tokenizer. Split in words for word-based
vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces).

Do NOT take care of added tokens. Only the lyrics are split into character for the character-based vocabulary.
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/wav2vec2/tokenization_wav2vec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _add_tokens(self, new_tokens: Union[List[str], List[AddedToken]], special_to

def _tokenize(self, text, **kwargs):
"""
Converts a string in a sequence of tokens (string), using the tokenizer.
Converts a string into a sequence of tokens (string), using the tokenizer.
"""
if self.do_lower_case:
text = text.upper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def prepare_for_tokenization(

def _tokenize(self, text, **kwargs):
"""
Converts a string in a sequence of tokens (string), using the tokenizer.
Converts a string into a sequence of tokens (string), using the tokenizer.
"""

# make sure whitespace is stripped to prevent <unk>
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/tokenization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def num_special_tokens_to_add(self, pair: bool = False) -> int:

def tokenize(self, text: TextInput, **kwargs) -> List[str]:
"""
Converts a string in a sequence of tokens, using the tokenizer.
Converts a string into a sequence of tokens, using the tokenizer.

Split in words for word-based vocabulary or sub-words for sub-word-based vocabularies
(BPE/SentencePieces/WordPieces). Takes care of added tokens.
Expand Down Expand Up @@ -620,7 +620,7 @@ def tokenize(self, text: TextInput, **kwargs) -> List[str]:

def _tokenize(self, text, **kwargs):
"""
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based
Converts a string into a sequence of tokens (string), using the tokenizer. Split in words for word-based
vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces).

Do NOT take care of added tokens.
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/tokenization_utils_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2515,7 +2515,7 @@ def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] =

def tokenize(self, text: str, pair: Optional[str] = None, add_special_tokens: bool = False, **kwargs) -> List[str]:
"""
Converts a string in a sequence of tokens, replacing unknown tokens with the `unk_token`.
Converts a string into a sequence of tokens, replacing unknown tokens with the `unk_token`.

Args:
text (`str`):
Expand Down
Loading