-
Notifications
You must be signed in to change notification settings - Fork 19.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
Implement tool for saved Keras model files inspection, diff and patching #19768
base: master
Are you sure you want to change the base?
Conversation
It consists of three sub features, that allow: Visualization of the contents of .keras and .weights.h5 files, where you can further expand the contents up until the weights of the file. Diff of a model compared to a reference model, being presented side by side with the differences highlighted. Patching a model, where it is possible to change a layer's name and changing a specified weight of a model. Co-authored-by: Pedro Curto <[email protected]>
Thanks for the PR! Do you have a Colab notebook that demos the new features? |
Yes, here I couldn't implement the changes in the saved weights file, only in a .keras file. |
Great work! Here are some things we should do.
editor = KerasFileEditor(filepath)
editor.list_layer_paths() # Return all layer paths
editor.layer_info(layer_path) # Show weight structure for this layer
editor.edit_layer(layer_path, new_name=..., new_vars=...)
editor.write_out(filepath)
They aren't very different -- the weights file is one of the files present in the .keras file. You only need to implement these features for the weights file, then the same code will also work for the .keras file. |
Thank you very much for your feedback, we really appreciate it! We're currently on our degree's final two weeks, so everything is very intensive right now and we barely have any time because of the projects. We would really like to make those changes and get back to you because we enjoyed working on this feature and would like it to be as good as possible and according to your needs and the specification. We will get back to you and make the required changes starting next week, if that is ok with you. Again, thanks for your time, patience and feedback! |
Sure -- there's no rush! Thanks for working on this! |
Implemented the solicited changes: Changed inspect_file to differentiate between shell mode (with plain text with text color tags) and notebook mode (using HTML) Changed the diff functionality to match the solicited requirements (comparing model structure and weight structure according to specification in PR discussion) and have clearer and better output Reworked the edit tool to be a class and have the solicited methods (listing layer paths, showing weight structure, editing layers and writing out to a path) Co-authored-by: Pedro Curto <[email protected]>
Hello. Sorry for taking so long. |
It consists of three sub features, that allow:
Visualization of the contents of .keras and .weights.h5 files in a notebook, where you can further expand the contents up until the weights of the file. Diff of a model compared to a reference model, being presented side by side with the differences highlighted. Patching a model, where it is possible to change a layer's name and changing a specified weight of a model.
Please let us know if this is what you had in mind.
closes #19705