-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Refactor siglip2 fast image processor #36406
base: main
Are you sure you want to change the base?
Refactor siglip2 fast image processor #36406
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.
Thanks for refactoring! Lots of code removed 🔥
src/transformers/models/siglip2/image_processing_siglip2_fast.py
Outdated
Show resolved
Hide resolved
do_normalize: bool = True, | ||
image_mean: Optional[Union[float, List[float]]] = None, | ||
image_std: Optional[Union[float, List[float]]] = None, | ||
do_convert_rgb: Optional[bool] = None, |
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.
should we keep do_convert_rgb
?
Yes indeed, that's a problem with all fast processors really. I'm trying to strike a good balance between having meaningful and correct docs, and not having the same image processing kwargs docs duplicated in every processors. |
Sounds good, decorator might be a good approach! |
What does this PR do?
Refactor siglip2 fast image processor to be more consistent with others and reduce diffs.
Also introduce
unused_kwargs
inBaseImageProcessorFast
for processors that don't support all the default kwargs. Here SigLip doesn't support thesize
kwarg for example, which might be surprising for users considering it is supported by (almost) all other image processors. adding it inunused_kwargs
allows to show a warning instead of raising an error.Cc @qubvel