k2-fsa / k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.
https://k2-fsa.github.io/k2
Apache License 2.0
1.1k stars 214 forks source link

Allow partial for intersect_dense_pruned #1218

Closed pkufool closed 11 months ago

geoph9 commented 1 year ago

Is there any plan to add the allow_partial option on intersect and intersect_device? I am doing whole lattice rescoring with a 4-gram LM, and for some reason the lattice for some of the utterances does not have any final states and hence k2.connect(lattice) outputs an empty Fsa.

I have tried increasing the beam size to no avail. I think a workaround would be to allow partial paths, i.e. if not final states are encountered in a lattice then we assume that all states on the last frames are final.

pkufool commented 1 year ago

Is there any plan to add the allow_partial option on intersect and intersect_device? I am doing whole lattice rescoring with a 4-gram LM, and for some reason the lattice for some of the utterances does not have any final states and hence k2.connect(lattice) outputs an empty Fsa.

I have tried increasing the beam size to no avail. I think a workaround would be to allow partial paths, i.e. if not final states are encountered in a lattice then we assume that all states on the last frames are final.

Yes, I think it is doable, @danpovey what do you think?

pkufool commented 11 months ago

Merging now, I found the failed tests (mainly windows build) existed for several months, we should fix it in a separate PR.