From b7cdd00f150cc6f5489253810aa00cf34574e69c Mon Sep 17 00:00:00 2001 From: Lysandre Debut Date: Tue, 8 Dec 2020 12:04:01 -0500 Subject: [PATCH] Fix interaction of return_token_type_ids and add_special_tokens (#8854) --- src/transformers/tokenization_utils_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/tokenization_utils_base.py b/src/transformers/tokenization_utils_base.py index 289e373da5..77b0362c54 100644 --- a/src/transformers/tokenization_utils_base.py +++ b/src/transformers/tokenization_utils_base.py @@ -2814,7 +2814,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin): len_ids = len(ids) len_pair_ids = len(pair_ids) if pair else 0 - if return_token_type_ids is not None and not add_special_tokens: + if return_token_type_ids and not add_special_tokens: raise ValueError( "Asking to return token_type_ids while setting add_special_tokens to False " "results in an undefined behavior. Please set add_special_tokens to True or "