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

Remove use_square_size after loading #30567

Merged
merged 2 commits into from Apr 30, 2024
Merged

Remove use_square_size after loading #30567

merged 2 commits into from Apr 30, 2024

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Apr 30, 2024

Remove use_square_size after loading.

#27690 removed use_square_size but keep a backward compatibility for Kosmos-2's image processor.
However, once we load it with a image processor config file, we could and we should remove that no longer used attribute.

Fix #30522

Copy link
Contributor

@NielsRogge NielsRogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we could remove use_square_size at some point?

I'd like to avoid a deprecation warning since the number of CLIP users is huge (and use_square_size is only related to KOSMOS-2).

@ydshieh ydshieh marked this pull request as ready for review April 30, 2024 09:46
@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 30, 2024

Wondering if we could remove use_square_size at some point?

You mean remove them from Hub repositories first, then at the end from our code?

@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.

@NielsRogge
Copy link
Contributor

Yes, although people may have already fine-tuned KOSMOS-2 (e.g. https://huggingface.co/Mit1208/kosmos-finetuned-DocLayNet), both locally and on the hub.

Copy link
Collaborator

@amyeroberts amyeroberts 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 fixing!

Can you add a test for kosmos to make sure that the correct image sizes are selected?

@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 30, 2024

Yes, although people may have already fine-tuned KOSMOS-2 (e.g. https://huggingface.co/Mit1208/kosmos-finetuned-DocLayNet), both locally and on the hub.

I will check what I can do (regarding the Hub repositories part)

@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 30, 2024

Thanks for fixing!

Can you add a test for kosmos to make sure that the correct image sizes are selected?

@amyeroberts This PR doesn't change (directly) any logic regarding the size, although it does remove a attribute and this might change something.

What test you have in mind? Like

  • load an image processor with use_square_size, save it, and reload it again (locally) and see if it works and the results are matched?

@amyeroberts
Copy link
Collaborator

@ydshieh OK, if image size isn't affected then we don't need to cover that, but something like what you suggest: saving and reloading the processor to make sure it can be done. Anything which fails on main and passes with this PR :)

@ydshieh ydshieh self-assigned this Apr 30, 2024
@ydshieh ydshieh merged commit 78fdd64 into main Apr 30, 2024
18 checks passed
@ydshieh ydshieh deleted the fix_kosmos2_processor branch April 30, 2024 19:11
itazap pushed a commit that referenced this pull request May 14, 2024
* fix

* add test

---------

Co-authored-by: ydshieh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyError: 'shortest_edge' when loading Kosmos-2 model from local files
4 participants