Closed Junyoungpark closed 7 years ago
I've found a hacky solution. Keras cares and saves name of custom objects when loading custom objects. Therefore, by passing "nll" as a key rather than "GMMloss", I was able to solve the problem.
from keras.models import load_model
model.save('test1.h5')
model2 = load_model('test1.h5', custom_objects={"FeedForwardAttention":FeedForwardAttention,
"gaussianMixture":gaussianMixture,
"nll": GMMloss(kernelDim, numMixture)})
what is the kerneldim?
Hi!
I'm currently working on Mixture Density Networks. Consequently, I need to implement a custom negative log-likelihood loss function. To working within Keras training module, I slightly tricked my custom loss function as follows:
However, when it comes to save and LOAD model, I was not able to load the saved model properly.
with this error
ValueError: Unknown loss function:nll
. How can I pass the external parameters to the model properly?Thanks in advance Junyoung Park
ADD Stack trace