-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Add Fast Image Processor for Donut #37081
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 Fast Image Processor for Donut #37081
Conversation
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
yonigozlan
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.
Hi @rootonchair, this one also looks great thanks a lot! Only some little changes to be made and tests to be modified. It would also be great to have an equivalence test between fast and slow with do_align_long_axis set to True
Co-authored-by: Parteek <[email protected]>
…ransformers into donut_fast_image_processor
|
@yonigozlan When adding test for |
yonigozlan
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.
Great thanks for fixing the issue with rot_axes! Overall LGTM after the last changes I suggested, and after running make style, make quality and make fix-copies as there are some formatting/styling issues
| if input_data_format == ChannelDimension.LAST: | ||
| rot_axes = (0, 1) | ||
| elif input_data_format == ChannelDimension.FIRST: | ||
| rot_axes = (1, 2) | ||
| else: | ||
| raise ValueError(f"Unsupported data format: {input_data_format}") | ||
|
|
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.
Great, thanks for fixing!
Co-authored-by: Yoni Gozlan <[email protected]>
yonigozlan
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.
Hey @rootonchair! Thanks for iterating , some tests are failing which need some little changes. Also you'll need to merge your branch with main and resolve some conflicts
| if input_data_format == ChannelDimension.LAST: | ||
| rot_axes = (0, 1) | ||
| elif input_data_format == ChannelDimension.FIRST: | ||
| rot_axes = (1, 2) | ||
| else: | ||
| raise ValueError(f"Unsupported data format: {input_data_format}") | ||
|
|
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 like this broke some tests. input_data_format can be None, so if it is, input_data_format should be inferred before this with: input_data_format = infer_channel_dimension_format(images[0]) (it's done after now).
Same for donut in the slow processor.
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.
Ah I see. Let me fix this part. Hope that it would pass this time
yonigozlan
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.
Great! Waiting to see if all tests pass then LGTM
|
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. |
* add donut fast image processor support * run make style * Update src/transformers/models/donut/image_processing_donut_fast.py Co-authored-by: Parteek <[email protected]> * update test, remove none default values * add do_align_axis = True test, fix bug in slow image processor * run make style * remove np usage * make style * Apply suggestions from code review * Update src/transformers/models/donut/image_processing_donut_fast.py Co-authored-by: Yoni Gozlan <[email protected]> * add size revert in preprocess * make style * fix copies * add test for preprocess with kwargs * make style * handle None input_data_format in align_long_axis --------- Co-authored-by: Parteek <[email protected]> Co-authored-by: Yoni Gozlan <[email protected]>
* add donut fast image processor support * run make style * Update src/transformers/models/donut/image_processing_donut_fast.py Co-authored-by: Parteek <[email protected]> * update test, remove none default values * add do_align_axis = True test, fix bug in slow image processor * run make style * remove np usage * make style * Apply suggestions from code review * Update src/transformers/models/donut/image_processing_donut_fast.py Co-authored-by: Yoni Gozlan <[email protected]> * add size revert in preprocess * make style * fix copies * add test for preprocess with kwargs * make style * handle None input_data_format in align_long_axis --------- Co-authored-by: Parteek <[email protected]> Co-authored-by: Yoni Gozlan <[email protected]>
What does this PR do?
Related #36978
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.