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

scheduled sampling OOV issue #32

Open
rajeev595 opened this issue Jun 13, 2019 · 0 comments
Open

scheduled sampling OOV issue #32

rajeev595 opened this issue Jun 13, 2019 · 0 comments

Comments

@rajeev595
Copy link

Hi @yaserkl ,

Thanks for publishing the code!

In line no. 525 of the attention_decoder.py file, embedding_lookup throws an error when there are OOV (greater than vocab size) id's in sample_ids_sampling. I think they should be replaced with [UNK] id number before looking up.

Maybe something like this:

    sample_ids_sampling = tf.add(
        tf.multiply(sample_ids_sampling, tf.cast(sample_ids_sampling < self._vocab.size(), dtype=tf.int32)),
        tf.multiply(self._vocab.word2id(params.UNKNOWN_TOKEN), tf.cast(sample_ids_sampling >= self._vocab.size(),
                                                                       dtype=tf.int32))
    )

Please let me know if I am missing something.

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