How do I create a Keras Embedding layer from a pre-trained word embedding dataset?
问题 How do I load a pre-trained word-embedding into a Keras Embedding layer? I downloaded the glove.6B.50d.txt (glove.6B.zip file from https://nlp.stanford.edu/projects/glove/) and I'm not sure how to add it to a Keras Embedding layer. See: https://keras.io/layers/embeddings/ 回答1: You will need to pass an embeddingMatrix to the Embedding layer as follows: Embedding(vocabLen, embDim, weights=[embeddingMatrix], trainable=isTrainable) vocabLen : number of tokens in your vocabulary embDim : embedding