-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Fix DETA save_pretrained #30326
Fix DETA save_pretrained #30326
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. |
cc @NielsRogge |
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 fixing!
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 fixing and adding a test!
Just a small comment on removing the exception
# Detect we get a hit for each key | ||
for key in tied_weight_keys: | ||
if not any(re.search(key, p) for group in tied_params for p in group): | ||
raise ValueError(f"{key} is not a tied weight key for {model_class}.") |
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.
We shouldn't really be raising exceptions in a test. Exceptions are for terminating out of code when there's an incorrect input / code behaviour which we can then choose to handle. In tests, we're really performing sanity checks, which should always be True given the test.
Either we should test this behaviour with an assert or just remove.
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, Amy, I fixed this test case and the original one too 👍 (replaced with assert)
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 fixing and iterating!
* Add class_embed to tied weights for DETA * Fix test_tied_weights_keys for DETA model * Replace error raise with assert statement
What does this PR do?
save_pretrained
is not working forDetaForObjectDetection
. This PR is supposed to fix this error.A simple script to reproduce:
or
The following error occurs:
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.