File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -971,6 +971,12 @@ def add_tokens(
971
971
Add a list of new tokens to the tokenizer class. If the new tokens are not in the vocabulary, they are added to
972
972
it with indices starting from length of the current vocabulary.
973
973
974
+ .. Note::
975
+ When adding new tokens to the vocabulary, you should make sure to also resize the token embedding matrix of
976
+ the model so that its embedding matrix matches the tokenizer.
977
+
978
+ In order to do that, please use the :meth:`~transformers.PreTrainedModel.resize_token_embeddings` method.
979
+
974
980
Args:
975
981
new_tokens (:obj:`str`, :obj:`tokenizers.AddedToken` or a list of `str` or :obj:`tokenizers.AddedToken`):
976
982
Tokens are only added if they are not already in the vocabulary. :obj:`tokenizers.AddedToken` wraps a
You can’t perform that action at this time.
0 commit comments