Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
f1c22dae
Unverified
Commit
f1c22dae
authored
Sep 13, 2021
by
Stas Bekman
Committed by
GitHub
Sep 13, 2021
Browse files
[tokenizer] use use_auth_token for config (#13523)
* [tokenizer] use use_auth_token for config * args order
parent
d2904264
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+14
-3
No files found.
src/transformers/tokenization_utils_base.py
View file @
f1c22dae
...
...
@@ -1741,12 +1741,23 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
logger
.
info
(
f
"loading file
{
file_path
}
from cache at
{
resolved_vocab_files
[
file_id
]
}
"
)
return
cls
.
_from_pretrained
(
resolved_vocab_files
,
pretrained_model_name_or_path
,
init_configuration
,
*
init_inputs
,
**
kwargs
resolved_vocab_files
,
pretrained_model_name_or_path
,
init_configuration
,
*
init_inputs
,
use_auth_token
=
use_auth_token
,
**
kwargs
,
)
@
classmethod
def
_from_pretrained
(
cls
,
resolved_vocab_files
,
pretrained_model_name_or_path
,
init_configuration
,
*
init_inputs
,
**
kwargs
cls
,
resolved_vocab_files
,
pretrained_model_name_or_path
,
init_configuration
,
*
init_inputs
,
use_auth_token
=
None
,
**
kwargs
):
# We instantiate fast tokenizers based on a slow tokenizer if we don't have access to the tokenizer.json
# file or if `from_slow` is set to True.
...
...
@@ -1784,7 +1795,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
# Second attempt. If we have not yet found tokenizer_class, let's try to use the config.
try
:
config
=
AutoConfig
.
from_pretrained
(
pretrained_model_name_or_path
)
config
=
AutoConfig
.
from_pretrained
(
pretrained_model_name_or_path
,
use_auth_token
=
use_auth_token
)
config_tokenizer_class
=
config
.
tokenizer_class
except
(
OSError
,
ValueError
,
KeyError
):
# skip if an error occurred.
...
...
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