You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This fails with ValueError: Unknown layer: LMUCell.
The quick fix is to tell Keras about the LMUCell via custom_objects:
# Test serializationlmu_layer.from_config(
lmu_layer.get_config(),
custom_objects={"LMUCell":keras_lmu.LMUCell}, # <-- This is key
)
Although this allows the LMUCell to be properly (de)serialized, this requires direct access and may be challenging if using additional scripts on top of the RNN.
It seems like there is a way to register custom objects with Keras and that may be the proper general solution, just don't have time to test that out right now!
aside
For completeness/reference, using theLMU layer (instead of the LMUCell wrapped in an RNN, for example) serializes fine:
If the
LMUCell
is wrapped in another layer (e.g.RNN
) then it cannot be serialized sinceLMUCell
is a custom object unknown to Keras. For example:This fails with
ValueError: Unknown layer: LMUCell
.The quick fix is to tell Keras about the
LMUCell
viacustom_objects
:Although this allows the
LMUCell
to be properly (de)serialized, this requires direct access and may be challenging if using additional scripts on top of theRNN
.It seems like there is a way to register custom objects with Keras and that may be the proper general solution, just don't have time to test that out right now!
aside
For completeness/reference, using the
LMU
layer (instead of theLMUCell
wrapped in anRNN
, for example) serializes fine:The text was updated successfully, but these errors were encountered: