-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Add SiglipForImageClassification and CLIPForImageClassification #28952
Add SiglipForImageClassification and CLIPForImageClassification #28952
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - thanks for adding!
@amyeroberts I assume the "build PR documentation" check is failing but unrelated to this PR, so I can merge? |
@NielsRogge Yes, if you look on main you can see that the build is failing for lots of (unrelated) PRs at the moment. I'm happy for you to merge as all the other CIs are passing. |
Hi @NielsRogge and @amyeroberts, Thanks for your contribution to the community @NielsRogge! I am wondering if Also, did you encounter the same problem as in #28968? Thanks! Best, |
@zhjohnchan |
…ingface#28952) * First draft * Add CLIPForImageClassification * Remove scripts * Fix doctests
@amyeroberts Thank you so much! Just realized it should be rescaled for all Transformers' preprocessors. |
@zhjohnchan I haven't encountered the same problem, made a fine-tuning notebook for SigLIP here: https://github.com/NielsRogge/Transformers-Tutorials/blob/master/SigLIP/Fine_tuning_SigLIP_and_friends_for_multi_label_image_classification.ipynb. |
@NielsRogge Got it! Thank you so much! |
Hi, I am the one who proposed to add a CLIPForImageClassification. Now I am back to contributing with it. |
HI @Andron00e, thanks for suggesting it, it's now available here: https://huggingface.co/docs/transformers/en/model_doc/siglip#transformers.SiglipForImageClassification |
Thank you! I'll try to fix minor bugs with CLIPForImageClassification and place its code into SigLIP's directory. |
* First draft * Add CLIPForImageClassification * Remove scripts * Fix doctests
What does this PR do?
This PR adds 2 new classes to the library,
SiglipForImageClassification
andCLIPForImageClassification
.This makes it easier to fine-tune SigLIP/CLIP for image classification, as otherwise people had to manually write a class based on SiglipVisionModel/CLIPVisionModel with a head on top. Given that SigLIP and CLIP are among the best vision encoders out there, it makes sense to add them.