snakeztc / NeuralDialog-CVAE

Tensorflow Implementation of Knowledge-Guided CVAE for dialog generation ACL 2017. It is released by Tiancheng Zhao (Tony) from Dialog Research Center, LTI, CMU

Home Page:https://www.cs.cmu.edu/~tianchez/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I ignore <unk> tokens while decoding?

dimeldo opened this issue · comments

Hi, how can I ignore unk tokens while decoding? It probably just means setting the weight to zero.

So I want to do something like this:

if ignore_unk:
    next_probs[:, self.unk_id] = 0

How can I do this in your code?

Thanks.

You can probably modify the decoding function inside:
NeuralDialog-CVAE/models/decoder_fn_lib.py

Is there a way you can implement that? I don't know how to do that myself.

?