Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about char pretrained embedding #12

Closed
ghost opened this issue Apr 26, 2018 · 2 comments
Closed

about char pretrained embedding #12

ghost opened this issue Apr 26, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 26, 2018

Thank you for this excellent open source code.
But I have one question about the pre-trained embedding for charaters,In the class "Data",we load the pre-trained embedding for characters,but i donot known where to use it,maybe I have to add one parameter called "pretrained_char_embedding",and pass it into the class CharBilstm(for example),and modify the code like below:
if pretrain_char_embedding is not None: self.char_embeddings.weight.data.copy_(torch.from_numpy(pretrain_char_embedding)) else: self.char_embeddings.weight.data.copy_( torch.from_numpy(self.random_embedding(alphabet_size, embedding_dim)))

@jiesutd
Copy link
Owner

jiesutd commented Apr 26, 2018

@fengxiachong thank you very much for your report.
Yes, the previous version only includes the interface of the pretrained character embeddings but not use it. I just implemented the usage of the pretrained char embedding, you may use the updated code.

Generally, the pretrained character embedding works for languages such as Chinese which includes a large character alphabet. Based on my experience, sometime the model is not stable by adding the pretrained char embedding in Chinese. In this case, you may try to normalize the embedding first.

Appreciate if you give me a feedback about whether the pretrained char embedding works well or not in your experiments.

@ghost
Copy link
Author

ghost commented Apr 26, 2018

Thank you very much~

@jiesutd jiesutd closed this as completed Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant