-
Notifications
You must be signed in to change notification settings - Fork 27
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
how the make HCL and G graphs #1
Comments
Hi, Thanks for your interest. If you are able to compose HCLG statically, it is going to be faster than the dynamic composition, for sure. The latgen-lazylm-faster-mapped tool was created when composing it is unfeasible due to the huge graph that it would produce (think of very high order language models like 10-gram language models). If you are able to create HCLG statically, you should. The accuracy results should be very similar, at least I always obtained the same results in my experiments when comparing the static HCLG vs. on-the-fly HCL and G composition, which this tool does. You can check this script which creates the HCL and G transducers for a handwritten text recognition experiment: Your steps to create HCL seem correct. You follow some steps that I don't, but I guess that it is because you have to deal with triphones and other particularities of ASR. I could never make |
Hi there, You may relabel the whole HCL at the end of the graph creation fstconvert --fst_type=olabel_lookahead --save_relabel_opairs=$graph_dir/g.irelabel $graph_dir/HCL.fst >$graph_dir/left.fst Don't forget to relabel your fstrelabel --relabel_ipairs=$graph_dir/g.irelabel $graph_dir/G.fst | fstarcsort >$graph_dir/right.fst And by the way, OpenFST should be able to choose the best filters depending of the properties of the FST (see the end of this file : // Specializes for StdArc to allow weight and label pushing.
template <>
class DefaultLookAhead<StdArc, MATCH_OUTPUT> {
public:
using M = LookAheadMatcher<Fst<StdArc>>;
using SF = AltSequenceComposeFilter<M>;
using LF = LookAheadComposeFilter<SF, M>;
using WF = PushWeightsComposeFilter<LF, M>;
using ComposeFilter = PushLabelsComposeFilter<WF, M>;
using FstMatcher = M;
}; So Regarding the RTF, I had some issues too, and profiling it showed that it was mainly due to the weight pushing, but also to some extent to the on-demand composition that cannot come for free. |
Many thanks @jpuigcerver . Your response was very helpful. At the end, I managed to get Here is how I build and prepare the HCL and G. In fact, my final solution is very similar to what was suggested by @tbluche.
The composed HCLG for KALDI decoder is created as follows:
My observation is that when I want the same WER then I must lower pruning for OTF composed HCL and G. This results in about 20 % increase in RTF. If I fix RTF then my WER is about 20 % relatively worse for OTF composed HCL and G. So, there is some cost of OTF composition though it is not that bad. It is usable. Please note that preparation of the HCL and G is a bit different from the one in https://github.com/opendcd/opendcd/blob/master/script/makegraphotf.sh . For example, I could not determinize Ha.fst as it appeared to be non-functional. Also, the determinization of L is important, otherwise the final HCL graph will not be "small enough" and therefore the on the OTF composition that efficient. |
this is very good response! |
@jurcicek ,I have built the HaCL.fst. But ,the command "fstdeterminize --use-log=true HaCL.fst det.HaCL.fst" will be fail, because of the existence of loop, such as "self-loop". How can I solve it? |
I too get stuck with |
Hello all, Make sure that you have replaced the epsilons in the input of your LM fst (G.fst) with a disambiguation symbol (i.e. #0), as well as to have produce a deterministic lexicon, also by introducing the appropriate disambiguation symbols. Please, refer to Kaldi's documentation to understand how the WFST construction works: http://kaldi-asr.org/doc/graph.html |
@daanzu @jpuigcerver Unlike NFAs, which can always be determinized, not all WFST have |
Thanks for the info. I'm quite happy to have been able to get it to work if I skip the step to determinize |
@shakingWaves @daanzu It is true that, in general, not all WFST admit determinization. However, if you are using traditional models for G (n-grams) and L, and you have introduced the appropriate disambiguation symbols, the resulting WFST does admit determinization (please, refer to Kaldi's documentation). |
I am using a simple non-ngram G, but that shouldn't be able to affect the determinization of
Not a big deal, just curious. |
when I run the command "fstconvert --fst_type=olabel_lookahead --save_relabel_opairs=${dir}/g.irelabel ${dir}/HCL.fst > ${dir}/HCLr.fst", error "FATAL: IntervalReachVisitor: cyclic input" occurs. How can I solve it ? |
Hi!
thanks for sharing the code! I am wondering whether you could share how you make the HCL and G graphs. I guess the most important part is how you do determinization and when. I found that it affects the decoded results a lot. I made the on-the-fly composition working using your table compose; however, the RTF for the on-the-fly composition HCL and G vs. statistically composed HCLG is significantly worse on my graph, RTF of 0.48 vs RTF 0.28.
Here is how I prepare the HCL graph:
I am also wondering whether you tried to use
LabelLookAheadMatcher
instead ofArcLookAheadMatcher
atkaldi-decoders/bin/latgen-lazylm-faster-mapped.cc
Line 41 in af1efd2
I cannot make it work.
Thanks for any advice!
The text was updated successfully, but these errors were encountered: