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

show probability score in beam mode #157

Open
huangruizhe opened this issue Oct 25, 2018 · 1 comment
Open

show probability score in beam mode #157

huangruizhe opened this issue Oct 25, 2018 · 1 comment

Comments

@huangruizhe
Copy link

When we list top N (N>1) variants of decoding in the --return_beams mode, can we have a probability score for each variant? It seems there is no such an option.
Thanks!

@jubang0219
Copy link

I want it too.
But, I could not find that option.

So, I added the following variable in line 448 of g2p_seq2seq/g2p.py.

output_scores = np.split(result["scores"], self.decode_hp.beam_size,
axis=0)

And then, print the score of each candidate.

print("%s %s (%.4f)%s" % (decoded_inputs, decoded_outputs,
np.exp(output_scores[k]), self.decode_hp.delimiter))

I think the output scores are logprob, so I used the np.exp() function.
(It is not clear whether the logprob is correct. )

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants