Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
43869808
Unverified
Commit
43869808
authored
Aug 23, 2022
by
SaulLu
Committed by
GitHub
Aug 23, 2022
Browse files
improve `add_tokens` docstring (#18687)
* improve add_tokens documentation * format
parent
891704b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+5
-3
No files found.
src/transformers/tokenization_utils_base.py
View file @
43869808
...
...
@@ -915,10 +915,12 @@ class SpecialTokensMixin:
)
->
int
:
"""
Add a list of new tokens to the tokenizer class. If the new tokens are not in the vocabulary, they are added to
it with indices starting from length of the current vocabulary.
it with indices starting from length of the current vocabulary and and will be isolated before the tokenization
algorithm is applied. Added tokens and tokens from the vocabulary of the tokenization algorithm are therefore
not treated in the same way.
Note,
None W
hen adding new tokens to the vocabulary, you should make sure to also resize the token embedding
matrix
of the model so that its embedding matrix matches the tokenizer.
Note,
w
hen adding new tokens to the vocabulary, you should make sure to also resize the token embedding
matrix
of the model so that its embedding matrix matches the tokenizer.
In order to do that, please use the [`~PreTrainedModel.resize_token_embeddings`] method.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment