alumae / gst-kaldi-nnet2-online

GStreamer plugin around Kaldi's online neural network decoder
Apache License 2.0
185 stars 100 forks source link

Switch models and graphs #13

Closed rikrd closed 9 years ago

rikrd commented 9 years ago

This pull requests attempts to resolve issue #4 Allow switching models and graphs, with simple property changes.

Set the default model, fst, word_syms to empty strings, since all these Kaldi objects get loaded as soon as they are set not in the allocate stage.

alumae commented 9 years ago

Your comment says that word_syms also gets loaded as soon as it set, but the PR does now seem to do that. Is there a reason?

alumae commented 9 years ago

Also, in gst_kaldinnet2onlinedecoder_load_model(), the old model (if already set) is not freed.

rikrd commented 9 years ago

I have added the loading of the word_syms.

The old model, does not get freed because if I understand correctly, the Kaldi object can be reused to load the new model.

The only shortcoming of this is that we don't control the state of the object after trying to load the new model we trust Kaldi will leave it as it previously was.

alumae commented 9 years ago

Oh I see, you are of course correct about freeing.

dimastro commented 4 years ago

@rikrd I was trying to change the fst dynamically with kaldi-gstreamer-server. decoder2.py:

self.asr.set_state(Gst.State.PAUSED)
self.asr.set_property('fst', 'path/HCLG.fst')
self.asr.set_state(Gst.State.PLAYING)

which causes a fault. Any ideas about that? (I tried the model too and it's working as expected)