Add Fast Image Processor for LayoutLMv2#37203
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.
Looks great @rootonchair , very little left to change. Thanks for contributing!
| words, boxes = apply_tesseract( | ||
| image.cpu(), ocr_lang, tesseract_config, input_data_format=ChannelDimension.FIRST | ||
| ) |
There was a problem hiding this comment.
could you add a logger.warning_once if images are not on cpu, to warn that apply_ocr can only be performed on cpu
There was a problem hiding this comment.
Sure, I will add a check and make a warning here
Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com>
yonigozlan
left a comment
There was a problem hiding this comment.
Great! let's merge with main and fix conflicts then LGTM!
…_fast.py Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com>
…air/transformers into layoutlmv2_fast_image_processor
|
Hmm, the test fails due to long running time. @yonigozlan could you help me check? Maybe re-run the job may solve the problem |
|
Rerunning the jobs @rootonchair :) |
yonigozlan
left a comment
There was a problem hiding this comment.
Failing tests are unrelated, LGTM :)
* add support layoutlmv2 * make style * Apply suggestions from code review Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> * add warning and clean up * make style * Update src/transformers/models/layoutlmv2/image_processing_layoutlmv2_fast.py Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> --------- Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com>
* add support layoutlmv2 * make style * Apply suggestions from code review Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> * add warning and clean up * make style * Update src/transformers/models/layoutlmv2/image_processing_layoutlmv2_fast.py Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com> --------- Co-authored-by: Yoni Gozlan <74535834+yonigozlan@users.noreply.github.com>
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.