Unverified Commit b28b5371 authored by Thomas Wolf's avatar Thomas Wolf Committed by GitHub
Browse files

More clear error message in the use-case of #5169 (#5184)

parent 11fdde02
...@@ -427,9 +427,14 @@ class PreTrainedTokenizer(PreTrainedTokenizerBase): ...@@ -427,9 +427,14 @@ class PreTrainedTokenizer(PreTrainedTokenizerBase):
elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int): elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int):
return text return text
else: else:
raise ValueError( if is_pretokenized:
f"Input {text} is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers." raise ValueError(
) f"Input {text} is not valid. Should be a string or a list/tuple of strings when `is_pretokenized=True`."
)
else:
raise ValueError(
f"Input {text} is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers."
)
if return_offsets_mapping: if return_offsets_mapping:
raise NotImplementedError( raise NotImplementedError(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment