Add-warning-tokenizer (#20826)

* add fast not use warning

* update
This commit is contained in:
Arthur 2022-12-21 18:18:34 +01:00 committed by GitHub
parent 76d02feadb
commit 4a433e321f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -576,9 +576,14 @@ class AutoTokenizer:
tokenizer_class_name, tokenizer_fast_class_name = tokenizer_class_tuple
if use_fast and tokenizer_fast_class_name is not None:
tokenizer_class = tokenizer_class_from_name(tokenizer_fast_class_name)
if use_fast:
if tokenizer_fast_class_name is not None:
tokenizer_class = tokenizer_class_from_name(tokenizer_fast_class_name)
else:
logger.warning(
"`use_fast` is set to `True` but the tokenizer class does not have a fast version. "
" Falling back to the slow version."
)
if tokenizer_class is None:
tokenizer_class = tokenizer_class_from_name(tokenizer_class_name)