oswaldoludwig / Seq2seq-Chatbot-for-Keras

This repository contains a new generative model of chatbot based on seq2seq modeling.
Apache License 2.0
332 stars 98 forks source link

NameError: name 'embedding_matrix' is not defined #18

Open stajilov opened 6 years ago

stajilov commented 6 years ago

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?

oswaldoludwig commented 6 years ago

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

stajilov commented 6 years ago

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

oswaldoludwig commented 6 years ago

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