Seq2seq-Chatbot-for-Keras icon indicating copy to clipboard operation
Seq2seq-Chatbot-for-Keras copied to clipboard

NameError: name 'embedding_matrix' is not defined

Open stajilov opened this issue 6 years ago • 3 comments

In conversation.py Shared_Embedding = Embedding(output_dim=word_embedding_size, input_dim=dictionary_size, weights=[embedding_matrix], input_length=maxlen_input, name='Shared') however it produces the error above, should we reimport embeddings?

stajilov avatar May 15 '18 11:05 stajilov

Hi Vladimir,

If this line has been processed, it's because you don't have the weights_file, see the code:

if os.path.isfile(weights_file): Shared_Embedding = Embedding(output_dim=word_embedding_size, input_dim=dictionary_size, input_length=maxlen_input, name='Shared') else: Shared_Embedding = Embedding(output_dim=word_embedding_size, input_dim=dictionary_size, weights=[embedding_matrix], input_length=maxlen_input, name='Shared') word_embedding_context = Shared_Embedding(input_context)

I suggest you download the net weights, "my_model_weights20.h5", which can be found here

oswaldoludwig avatar May 15 '18 11:05 oswaldoludwig

yes, thanks, I collected my own corpus and retrained it, the training failed, that's why I didn't have this file and the respective error

stajilov avatar May 16 '18 08:05 stajilov

Okay, so you have to download the Glove folder 'glove.6B' from here and include this folder in the directory of the chatbot.

oswaldoludwig avatar May 16 '18 09:05 oswaldoludwig