how to use pre-trained word embedding?
NonvolatileMemory opened this issue · comments
Cunxiao Du commented
your code is so awesome.
But if I want to use pre-trained embedding matrix to initialize gluon.nn.Embedding(),what should I do?
Xingyu commented
you can define a initial word embedding and then set the weight by yourself, such as
x = nn.Embedding(3, 5)
x.initialize()
x.weight.set_data(nd.ones(shape=(3, 5))
print(x.weight.data())
Cunxiao Du commented
yes,I got that.very thanks
https://zhuanlan.zhihu.com/p/31664048
Cunxiao Du commented
seems this method is wrong when use gpu?
apache/mxnet#8963
Cunxiao Du commented
figure out ,nd.ones() must init on gpu