Open lynochka opened 6 years ago
I had a similar error when I went to save and reload a model using NAC or NALU, however my error was "TypeError: init() got an unexpected keyword argument 'name'". By adding **kwargs as an argument at the end in init I was able to train a model, save it, reload it and predict with the loaded model.
Like so for NALU
def __init__(self, units, use_gating=True, kernel_W_initializer='glorot_uniform', kernel_M_initializer='glorot_uniform', gate_initializer='glorot_uniform', kernel_W_regularizer=None, kernel_M_regularizer=None, gate_regularizer=None, kernel_W_constraint=None, kernel_M_constraint=None, gate_constraint=None, epsilon=1e-7, **kwargs):
and for NAC
def __init__(self, units, kernel_W_initializer='glorot_uniform', kernel_M_initializer='glorot_uniform', kernel_W_regularizer=None, kernel_M_regularizer=None, kernel_W_constraint=None, kernel_M_constraint=None, **kwargs):
I also created a pull request to add this, hope this helps!
Hei, thanks for the implementation! Tried to load a trained model with
load_model(modelfile, custom_objects={'NALU': NALU}) but got the following error:
Should I have saved it with only weights or is there a way around? Thanks!