rescore the lattices using rnnlm's trained with PyTorch

368 views
Skip to first unread message

Siva Reddy Gangireddy

unread,
Feb 28, 2019, 8:57:19 AM2/28/19
to kaldi-help
Hi All,

I wonder are there any scripts to rescore the lattices using rnnlm's trained with PyTorch. OR if you know any other recipe please let me know.

Thanks in advance!

---
Siva

Daniel Povey

unread,
Feb 28, 2019, 12:06:59 PM2/28/19
to kaldi-help

We don't have any examples.   We did build a setup that enabled the use of TensorFlow RNNLMs with Kaldi-- this worked at the C++ level, using Kaldi binaries that linked against TensorFlow, using TensorFlow's C++ API.  But it proved complicated to maintain, compile and use; for instance, TensorFlow's C++ API wasn't that consistent across versions.

I don't know what it would be like to do the same kind of thing with PyTorch; I suspect that by calling PyTorch from C++ you would be kind of going against the grain.

However, there is another possibility: to use PyKaldi (https://github.com/pykaldi) which provides Python bindings for Kaldi types and OpenFst types.  It appears to go sufficiently deeply inside objects like kaldi's CompactLattice, that it should be possible to do what you want with it  (e.g..  (OpenFst has some official Python bindings but they don't seem to go deep enough inside the objects, and anyway wouldn't support Kaldi's lattice arc types directly without modification).  I would be very interested to see what your experiences are with PyKaldi are.  I still haven't made a decision about which direction to go in terms of supporting some more modern neural network toolkit.  

Dan

--
Go to http://kaldi-asr.org/forums.html find out how to join
---
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+...@googlegroups.com.
To post to this group, send email to kaldi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kaldi-help/7c914051-f780-4fa6-8dc1-df96dc58782c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Siva Reddy Gangireddy

unread,
Mar 1, 2019, 4:55:28 AM3/1/19
to kaldi-help
Hi Dan,

seems like PyKaldi is a good point to start. Sure will let you know my experience.

Thank you.

---
Siva

Rémi Francis

unread,
Mar 1, 2019, 6:05:06 AM3/1/19
to kaldi-help
I've used PyKaldi a bit to deal with lattices in Python.
It's quite convenient, the API is relatively transparent, and the documentation is good for most functionalities, though it's not very fast when doing operations on lattices and fsts.


On Thursday, 28 February 2019 17:06:59 UTC, Dan Povey wrote:

Dogan Can

unread,
Mar 4, 2019, 2:32:22 PM3/4/19
to kaldi-help
Hi Remi

Do you mean it is not fast for high level operations, such as composition, shortest-path, etc. or low level operations, such as state/arc mutation, iteration, etc. If the former, then we must have a performance issue in pykaldi and I should look into it. High level operations should be almost as fast as their pure C++ counterparts. If the latter, then I guess there is not much we can do because the most likely cause is the slowness of python. My experience has been that tight loops of low level fst operations are significantly slower in Python than in C++ simply because Python loops are slow. If your code was doing lots of arc creation in python, it might also have been affected by a performance issue that we recently fixed (https://github.com/pykaldi/pykaldi/issues/78).

Cheers
Dogan

Rémi Francis

unread,
Mar 5, 2019, 7:44:35 AM3/5/19
to kaldi-help
Yes the high level operations seemed fine, it was looping on the states and arcs, and creating or modifying them, that was slow.
I didn't check if it was the looping or the actions that were slow.
Reply all
Reply to author
Forward
0 new messages