-
Notifications
You must be signed in to change notification settings - Fork 449
Keras v3 Support #1116
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
base: main
Are you sure you want to change the base?
Keras v3 Support #1116
Conversation
This PR will be rebased after its prerequisites are merged to resolve the conflicts. |
if keras.__version__ > '3.0': | ||
layer_list, *_ = hls4ml.converters.parse_keras_v3_model(model) | ||
else: | ||
model_arch = json.loads(model.to_json()) |
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.
I don't know if the case was used in practice, but the old logic allows model to be a dict, and only if it's not not a dict, only then model_arch = json.loads(model.to_json())
. Does the logic here work if model is a dict?
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.
dict is a representation of a json. we work with a dict that was a json of a model whether made by us or, in the old days, by the user.
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.
model.get_config
has slightly different behavior, where objects may be passed as-is (not serialized). v2 converter assumes a dict of fully serialized model config, so serialize+deserialize is used here.
A# Description
Add keras v3 specific object-based parser and some layer handlers (no h5 or json loading supported). The current keras parser doesn't work with v3 functional models in general.
Type of change
Tests
test/pytest/test_keras_v3_api.py
Test Configuration:
Requires
keras>=3.0
. Skips the whole module if this requirement is not sufficed.Checklist
pre-commit
on the files I edited or added.