Get Embedding Vectors from StructuredModel

Just in case anyone else is struggling with getting the embeddings, below is what i did.

embs = list()
for param in learn.model.embs.parameters():
    embs.append(param)

then you can call the matrices from the list in the order of the cat variables.
embs[0], embs[1] etc.

If there is a more efficient way any suggestion would be appreciated.

2 Likes