Repository navigation
[GPT2Tokenizer] Raise ValueError for Fast GPT2Tokenizer with bos token for now - #17498
Conversation
| **kwargs, | ||
| ) | ||
|
|
||
| if kwargs.pop("add_bos_token", False): |
There was a problem hiding this comment.
Gives:
Traceback (most recent call last):
File "/home/patrick/hf/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3369, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-8-69932b6461cf>", line 1, in <cell line: 1>
gpt2 = GPT2TokenizerFast.from_pretrained("facebook/opt-30b")
File "/home/patrick/python_bin/transformers/tokenization_utils_base.py", line 1783, in from_pretrained
return cls._from_pretrained(
File "/home/patrick/python_bin/transformers/tokenization_utils_base.py", line 1928, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
File "/home/patrick/python_bin/transformers/models/gpt2/tokenization_gpt2_fast.py", line 151, in __init__
raise ValueError(
ValueError: Currenty GPT2's fast tokenizer does NOT support adding a BOS token.Instead you should use GPT2's slow tokenizer class `GPT2Tokenizer` as follows:
`GPT2Tokenizer.from_pretrained('facebook/opt-incorrect')`
or
`AutoTokenizer.from_pretrained('facebook/opt-incorrect', use_fast=False)`
This issue will be fixed soon, see: https://github.com/huggingface/tokenizers/pull/1005. so that the fast tokenizer works correctly.
There was a problem hiding this comment.
Interesting so the error wasn't raised correctly when loading the tokenizer configuration?
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
left a comment
There was a problem hiding this comment.
LGTM as a temp fix, thanks!
|
Thanks @patrickvonplaten ! It seems really good to have this error raised while figuring out how to do the processor. |
We're likely going to release tomorrow or as soon as BLOOM is merged, so this will be included in it! |
|
Hello! when using the GPT2TokenizerFast for the OPT model, I get a warning that the fast version of the tokenizer is working incorrectly. I'm wondering what is the status of this problem, or is it okay to use the fast tokenizer now? |
|
I think the fast OPTTokenizer should work now after it has been merged to |
|
Actually no need for any modifications or But I am not sure about every single OPT model on the hub, I didn't make modifications there (nor am I sure how I should do that). |
What does this PR do?
@sgugger - As discussed offline the best fix here will be to make sure GPT2TokenizerFast works correctly which is however dependent on huggingface/tokenizers#1005 and will probs take some time. Think it's important that we raise a ValueError though as otherwise users will run into silently not adding BOS to OPT which I'd like to avoid.
The error message should be clear enough for the user to understand how to change.
@LysandreJik @sgugger also make it's worth doing a patch release here actually (not sure maybe not super important though)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.