Failed to convert object of type
mhamadli opened this issue · 3 comments
I'm trying to use this attention implementation to build a model for converting graphemes to phonemes, but I got this error:
TypeError: Failed to convert object of type <class 'list'> to Tensor. Contents: [1, Dimension(None)]. Consider casting elements to a supported type.
any help?
Same error
I've tried on nmt
model from examples
directory on TF 1.15 and 1.12
Have you figured out why is that and how to solve this?
I got the same error while using the attention_layer. Did you guys found the solution to it..??
I am using TF 2.0
please comment back the solution. Thanks..
I have found a solution for this problem, If you want to load a model that includes custom layers, custom classes or functions, you can pass them to the loading mechanism via the custom_objects.
I just added the following to my code and it worked:
custom_objects = {
'AttentionLayer': AttentionLayer
}
model = load_model(model_path, custom_objects=custom_objects)