Save embedding model in pretrained Glove-styles

I have a trained nn.Embedding model. I would like to extract its parameter, then save as text file like Glove, so other guy can reuse a trained word representation for other problem.

I have no idea how to do it yet. Please help me. Some code example might helpful.

1 Like
m = nn.Embedding(...)
# m.weight contains the embedding weights.
parameters = m.weight.numpy()
# save it as you wish
3 Likes