working with text data listing preparing he glove word-embeddings mat rix embedding_dim embedding_matrix np zeros((max_wordsembedding_dim)for wordi in word_index items()if max_wordsembedding_vector embeddings_index get(wordif embedding_vector is not noneembedding_matrix[iembedding_vector words not found in the embedding index will be all zeros defining model you'll use the same model architecture as before listing model definit ion from keras models import sequential from keras layers import embeddingflattendense model sequential(model add(embedding(max_wordsembedding_diminput_length=maxlen)model add(flatten()model add(dense( activation='relu')model add(dense( activation='sigmoid')model summary(loading the glove embeddings in the model the embedding layer has single weight matrixa float matrix where each entry is the word vector meant to be associated with index simple enough load the glove matrix you prepared into the embedding layerthe first layer in the model listing loading pret rained word embeddings int he embedding layer model layers[ set_weights([embedding_matrix]model layers[ trainable false additionallyyou'll freeze the embedding layer (set its trainable attribute to false)following the same rationale you're already familiar with in the context of pretrained convnet featureswhen parts of model are pretrained (like your embedding layerand parts are randomly initialized (like your classifier)the pretrained parts shouldn' be updated during trainingto avoid forgetting what they already know the large gradient updates triggered by the randomly initialized layers would be disruptive to the already-learned features licensed to