Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bert: Slow vs fast decoding inconsistency #1723

Open
pcuenca opened this issue Jan 17, 2025 · 0 comments
Open

Bert: Slow vs fast decoding inconsistency #1723

pcuenca opened this issue Jan 17, 2025 · 0 comments

Comments

@pcuenca
Copy link
Member

pcuenca commented Jan 17, 2025

Fast:

>>> from transformers import AutoTokenizer
>>> t = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
>>> t.decode(t.encode("l'eure"), skip_special_tokens=True)
"l ' eure"

Slow:

>>> t = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased", use_fast=False)
>>> t.decode(t.encode("l'eure"), skip_special_tokens=True)
"l'eure"

I believe the "slow" interpretation to be the correct one. I tried to check the reference implementation but saw no decoding code.

Maybe related (thanks @xenova for the pointer): huggingface/transformers#31938 (defaults Bert to clean_up_tokenization_spaces=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant