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

Refactor siglip2 fast image processor #36406

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yonigozlan
Copy link
Member

What does this PR do?

Refactor siglip2 fast image processor to be more consistent with others and reduce diffs.
Also introduce unused_kwargs in BaseImageProcessorFast for processors that don't support all the default kwargs. Here SigLip doesn't support the size kwarg for example, which might be surprising for users considering it is supported by (almost) all other image processors. adding it in unused_kwargs allows to show a warning instead of raising an error.
Cc @qubvel

@HuggingFaceDocBuilderDev

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.

Copy link
Member

@qubvel qubvel left a 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 🔥

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,
Copy link
Member

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?

@qubvel
Copy link
Member

qubvel commented Feb 25, 2025

Can you please also check if we can make docs consistent for slow and fast image processors?

Screenshot 2025-02-25 at 19 13 44 Screenshot 2025-02-25 at 19 13 23

@yonigozlan
Copy link
Member Author

Can you please also check if we can make docs consistent for slow and fast image processors?

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.
Maybe we can have a decorator that allows to override the default description of a kwarg if we need to?
In any case, I'll try to come up with something better than the current situation, but I'll probably open another PR for that

@qubvel
Copy link
Member

qubvel commented Feb 26, 2025

Sounds good, decorator might be a good approach!

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

Successfully merging this pull request may close these issues.

3 participants