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

Why is the model outputting UNK tokens? Shouldn't it be able to point to unkown words from the input? #32

Open
Rhuax opened this issue Apr 2, 2019 · 3 comments

Comments

@Rhuax
Copy link

Rhuax commented Apr 2, 2019

From: https://github.com/abisee/pointer-generator/blob/master/beam_search.py#L111

In decoding words, we change the token id to the unkown id if t<vocab.size(). So if the decoder is pointing to that particular token it produces [UNK] in output. Is it correct? Following the paper it seems that the decoder should be able to point to that token and copy it, instead of copying the unknown token. I think it's the whole purpose of the pointer-generator model to handle oovs. But from some experiments in decoding I see that the models often outputs some unknown tokens.
I tried replacing the 50k vocabulary to the full vocabolary but I get cuda device asserted errors.

@Rhuax Rhuax changed the title Why is the model outputting UNK tokens? Should it be able to point to unkown words from the input? Why is the model outputting UNK tokens? Shouldn't it be able to point to unkown words from the input? Apr 2, 2019
@nefujiangping
Copy link

There is still a UNK token in the fixed vocab. Pointer-generator can reduce the UNK outputs, but cannot prevent model from outputting UNK. In some timesteps, if the p_gen is high and the probability of the UNK of the fixed vocab is large, the model will still output UNK.

@Rhuax
Copy link
Author

Rhuax commented Apr 28, 2019

Why did the authors include the UNK token in the vocab?

@nefujiangping
Copy link

Pointer-generator use the same vocab at encoder/decoder input and decoder target, and the vocab is constructed from train-data (no val/test-data). If the vocab can cover all words of corpus (train,val,test), the UNK token can be excluded.

By using two vocabs (source vocab and target vocab), UNK token may be excluded in target vocab.

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

2 participants