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

SigLIP tokenizer not enforcing use_fast=True #29925

Open
2 of 4 tasks
yxchng opened this issue Mar 28, 2024 · 5 comments · May be fixed by #29969
Open
2 of 4 tasks

SigLIP tokenizer not enforcing use_fast=True #29925

yxchng opened this issue Mar 28, 2024 · 5 comments · May be fixed by #29969
Labels

Comments

@yxchng
Copy link

yxchng commented Mar 28, 2024

System Info

  • transformers version: 4.38.2
  • Platform: Linux-4.18.0-477.27.1.el8_8.x86_64-x86_64-with-glibc2.28
  • Python version: 3.10.13
  • Huggingface_hub version: 0.21.4
  • Safetensors version: 0.4.2
  • Accelerate version: not installed
  • Accelerate config: not found
  • PyTorch version (GPU?): 2.2.1+cu121 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

from transformers import AutoTokenizer
t=AutoTokenizer.from_pretrained('google/siglip-so400m-patch14-384', use_fast=True)
assert t.is_fast, 'tokenizer is not fast'
print('Success')

Expected behavior

print 'Success' which indicates use_fast=True

@ArthurZucker
Copy link
Collaborator

Hey! Siglip does not have a fast tokenizer:

("siglip", ("SiglipTokenizer" if is_sentencepiece_available() else None, None)),

@yxchng
Copy link
Author

yxchng commented Mar 28, 2024

I don't quite understand the line you linked. Why this model is different from others and does not have fast tokenizer?

@ArthurZucker ArthurZucker added the Feature request Request for a new feature label Mar 30, 2024
@ArthurZucker
Copy link
Collaborator

That is because of

def canonicalize_text(self, text, *, keep_punctuation_exact_string=None):

basically the equivalent fast tokenizer is not implemented because it needed a bit more work. I'll see if I have time to add it but otherwise it's a good issue!

@NielsRogge NielsRogge linked a pull request Mar 30, 2024 that will close this issue
2 tasks
@yxchng
Copy link
Author

yxchng commented Apr 22, 2024

Is this going to get merged anytime soon?

@ArthurZucker
Copy link
Collaborator

I reviewed it, just need @NielsRogge 's updates

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

Successfully merging a pull request may close this issue.

2 participants