k2-fsa / snowfall

Moved to https://github.com/k2-fsa/icefall
Apache License 2.0
143 stars 42 forks source link

How to built ctc_topo with blankid != 0 #249

Open Slyne opened 1 year ago

Slyne commented 1 year ago

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!!

csukuangfj commented 1 year ago

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.