-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Refactor siglip2 fast image processor #36406
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
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. |
qubvel
left a comment
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! |
ArthurZucker
left a comment
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.
I love seeing these go away! Thanks 🤗
| valid_preprocess_kwargs = DefaultFastImageProcessorPreprocessKwargs | ||
| # Child classes should try to support the base processing methods as much as possible. | ||
| # If they can't, the corresponding unused kwargs should be added to this list. | ||
| unused_kwargs = [] |
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.
| unused_kwargs = [] | |
| unused_kwargs = None |
list default are the worst!
|
Also let's use as much modular as possible! (will easy all futur refactoring) |
…/yonigozlan/transformers into refactor-fast-image-proc-siglip2


What does this PR do?
Refactor siglip2 fast image processor to be more consistent with others and reduce diffs.
Also introduce
unused_kwargsinBaseImageProcessorFastfor processors that don't support all the default kwargs. Here SigLip doesn't support thesizekwarg for example, which might be surprising for users considering it is supported by (almost) all other image processors. adding it inunused_kwargsallows to show a warning instead of raising an error.Cc @qubvel