Master the essential skills needed to recognize and solve complex real-world problems with Machine Learning and Deep Learning by leveraging the highly popular Python Machine Learning Eco-system.
Apache License 2.0
2.28k
stars
1.65k
forks
source link
Error in Accessing Layers of Word Embedding model #20
In this code, in the "Get word embeddings" section of the "Skip-gram model", the code is as follows:
merge_layer = model.layers[0]
word_model = merge_layer.layers[0]
word_embed_layer = word_model.layers[0]
weights = word_embed_layer.get_weights()[0][1:]
The above code gives the error as
The following code should be inserted in place of the above code (it works perfectly):
word_embed_layer = model.layers[2]
weights = word_embed_layer.get_weights()[0][1:]