Closed ChineseDictionary closed 1 month ago
Hi, thanks a lot for pointing out, there were indeed a serialization issue in keras_efficient_kan package that occurs when using layer normalization, which were the case in the TKAN, but not with other models that used it ! I published a fixed new version of it and did as well for the TKAN package (to include the modification), so all you have to do is update your package version of TKAN to 0.4.2 (pip install tkan --upgrade OR pip install tkan==0.4.2) and it should be fixed !
Thank you!
The problem has not been completely solved. When I try to load the model in another file in the same environment, the problem still occurs. How do we fix this? Thank you.
The save and load steps are the same as above. I have updated TKAN and keras_efficient_kan to the latest version. The error message is
ValueError: A total of 2 objects could not be loaded. Example error message for object variable.assign(value)
must match. variable.shape=(1, 10), Received: value.shape=(1, 10). Target variable: <KerasVariable shape=(1, 65, 10), dtype=float32, path=tkan/tkan_cell/kan_linear/grid>
List of objects that could not be loaded:
[
ValueError: A total of 2 objects could not be loaded. Example error message for object variable.assign(value)
must match. variable.shape=(1, 10), Received: value.shape=(1, 10). Target variable: <KerasVariable shape=(1, 65, 10), dtype=float32, path=tkan/tkan_cell/kan_linear/grid>
List of objects that could not be loaded:[\
Hi, I have the same problem. It shows something like: The shape of the target variable and the shape of the target value in
variable.assign(value)` must match. variable.shape=(1, 10), Received: value.shape=(1, 10). Target variable: <KerasVariable shape=(1, 2, 10), dtype=float32, path=tkan_6/tkan_cell_6/kan_linear_6/grid>
List of objects that could not be loaded:
[
I first saved the model using model.save, with no errors. But when I used
from keras.models import load_model model = load_model('my_model.keras')
to load the model, I get an error ofValueError: A total of 4 objects could not be loaded. Example error message for object <KANLinear name=kan_linear, built=True>: The shape of the target variable and the shape of the target value in
variable.assign(value)must match. variable.shape=(1, 10), Received: value.shape=(1, 10). Target variable: <KerasVariable shape=(1, 3, 10), dtype=float32, path=tkan/tkan_cell/kan_linear/grid> List of objects that could not be loaded: [<KANLinear name=kan_linear, built=True>, <LayerNormalization name=layer_normalization, built=False>, <KANLinear name=kan_linear_1, built=True>, <LayerNormalization name=layer_normalization_1, built=False>]
There was no such error when I saved and loaded the LSTM model. How can I solve this?