-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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 BUG in load_weights_from_hdf5_group_by_name" legacy_h5_format.py #20537
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #20537 +/- ##
==========================================
+ Coverage 82.15% 82.22% +0.07%
==========================================
Files 515 515
Lines 47859 48166 +307
Branches 7494 7527 +33
==========================================
+ Hits 39317 39604 +287
- Misses 6730 6744 +14
- Partials 1812 1818 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 good, thanks for the fix. Please add a unit test so we avoid breaking this in the future.
It looks like I need to create a mock H5 data structure to test this function. Is there any other option? e.g. split the function? |
Can you add a unit test that targets the user-facing case in which the issue appeared? |
Yes, I can, I will do this in next weekend keras/keras/src/legacy/saving/legacy_h5_format.py Lines 453 to 470 in 0078f24
but the issue appeared in the function A simple way to mock them is to create a mock model, save the weights in temporary files or memory, and then read them. However, I am not sure if this is a good practice for unit testing. A complex method for achieving that is to directly mock the model and HDF5 data structure. Additionally, another option is to split the keras/keras/src/legacy/saving/legacy_h5_format.py Lines 521 to 523 in 0078f24
Which one do you prefer? @fchollet |
This is fine. Create a very simple model that has the issue, save it to a temporary folder (see unit tests in |
I noticed that However, the test |
I just undisabled the tests, check it out. |
FIX #20536