0

I am new to speech recognition and I wish to build an end-to-end asr system using kaldi-asr. My laptop does not have Linux and neither does it have enough hardware to train models. So, I planned to install Kaldi on colab( to leverage Free GPU) by following https://colab.research.google.com/drive/1rp2eZRHW9OYnA1WpRGeblG6fDSyyH-my#scrollTo=46b62_fSurBK, but it takes too long to install Kaldi on colab and once the session gets over, I am afraid I will have to install it again. Is there any way I can install kaldi permanently on Colab,so that whenever I open it again, I don't have to go through the process all over again. PLease help. Thank you.

Jor_El
  • 187
  • 8

2 Answers2

3

I made it simple and fast (60 sec) to install kaldi in Colab.

!pip install kora -q
import kora.install.kaldi
korakot
  • 37,818
  • 16
  • 123
  • 144
  • I tried that; it ran for some time but how would I know if it was installed correctly? Like, following the notebook, I see a "kaldi" directory created and I follow the steps given in "install" to install the toolkit. – Jor_El Oct 17 '20 at 16:56
  • Also, is it "kaldi-asr" or "pykaldi" that is installed following your code? – Jor_El Oct 17 '20 at 16:57
  • It installs both. You can test them both. Kaldi is installed at /opt/kaldi which you can check. Many kaldi commands are added to the path too. – korakot Oct 17 '20 at 16:58
  • I saw the directory where all packages installed on colab are stored using "pip show", but in the kaldi directory, I couldn't find the folders like - egs,utils etc. that come with the usual installation like shown here -https://www.eleanorchodroff.com/tutorial/kaldi/familiarization.html . I am following this tutorial to build the asr; but on colab. – Jor_El Oct 17 '20 at 18:14
  • To show those directories, you can call `!ls /opt/kaldi`. Or `from kora.tree import path_tree; path_tree('/opt/kaldi')` – korakot Oct 18 '20 at 00:13
  • Thanks, I was able to find the necessary folders following your advice. However, I was wondering if it is possible to install it permanently like other python packages. I followed your other answer to install python libraries in google drive, but it gave me version error. – Jor_El Oct 18 '20 at 08:12
  • You can install permanently too. Copy the /opt/kaldi to anywhere in GDrive e.g. `/content/drive/My Drive/kaldi`. Then add path to those bin/ directories. – korakot Oct 18 '20 at 10:43
  • I tried !cp -r /opt/kaldi but it gives error : "Cannot create symbolic link....: operation not supported". – Jor_El Oct 18 '20 at 15:49
  • Tried !cp -l -r /opt/kaldi. Now it says "cp:cannot create hard link ... : Invalid cross-device link" – Jor_El Oct 18 '20 at 16:35
  • The symlinks are the problem then. Maybe search and replace them with a copy. I’ve never done it though. – korakot Oct 19 '20 at 00:36
  • I think, I've managed to copy 'opt/kaldi' to my gdrive. However, the tutorial requires making symlinks to other folders on my drive. I tried " !ln -s ", but it gives operation not supported error. Is there anything to be done after copying to gdrive to avoid such errors? – Jor_El Oct 20 '20 at 09:32
  • Do you create symlink correctly? It should be something like `!ln -s "/content/drive/My Drive/kaldi/to/path" /content/new_link` – korakot Oct 20 '20 at 11:39
  • Yes. I am trying to create a symlink inside a folder in gdrive to another folder in gdrive. – Jor_El Oct 20 '20 at 11:44
  • Gdrive does not support symlink. You can only copy instead. – korakot Oct 20 '20 at 17:12
0

Colab is not your only option here.

Kaldi is now integrated with Gitpod. Give it a try.

To make it work, simply click the Gitpod Ready-to-Code button on the heading of the README file or click this.

bekirbakar
  • 166
  • 2
  • 7