snowfall icon indicating copy to clipboard operation
snowfall copied to clipboard

How to built ctc_topo with blankid != 0

Open Slyne opened this issue 2 years ago • 1 comments

Hi experts, I was wondering if the build_ctc_topo interface can be used for blankid is not equal to 0? What's the correct way to build the ctc_topo in this situation? My model has a blankid=1024.

I believe the root cause of this question is I don't understand how we map the logits/probabilities of vocabulary to the arcs in T.fst. If you can help explain, I would be really grateful.

Thank you!!

Slyne avatar Oct 13 '22 07:10 Slyne

Can you use k2.ctc_topo() or k2.ctc_graph() for this?

Even if the doc says that token ID 0 is the blank, you can treat 0 as a normal token and use a non-zero ID for the blank by modifying the generated CTC graph to swap their IDs.

csukuangfj avatar Oct 13 '22 14:10 csukuangfj