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
a947386c
Unverified
Commit
a947386c
authored
Dec 01, 2020
by
Lysandre Debut
Committed by
GitHub
Dec 01, 2020
Browse files
Better warning when loading a tokenizer with AutoTokenizer w/o SnetencePiece (#8881)
parent
9c18f156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
src/transformers/models/auto/tokenization_auto.py
src/transformers/models/auto/tokenization_auto.py
+7
-1
No files found.
src/transformers/models/auto/tokenization_auto.py
View file @
a947386c
...
...
@@ -369,7 +369,13 @@ class AutoTokenizer:
if
tokenizer_class_fast
and
(
use_fast
or
tokenizer_class_py
is
None
):
return
tokenizer_class_fast
.
from_pretrained
(
pretrained_model_name_or_path
,
*
inputs
,
**
kwargs
)
else
:
return
tokenizer_class_py
.
from_pretrained
(
pretrained_model_name_or_path
,
*
inputs
,
**
kwargs
)
if
tokenizer_class_py
is
not
None
:
return
tokenizer_class_py
.
from_pretrained
(
pretrained_model_name_or_path
,
*
inputs
,
**
kwargs
)
else
:
raise
ValueError
(
"This tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed "
"in order to use this tokenizer."
)
raise
ValueError
(
"Unrecognized configuration class {} to build an AutoTokenizer.
\n
"
...
...
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