0

Python doesn't find the vosk model in the folder at Model(model_name="libs/models/vosk-model-small-en-0.22").

from vosk import Model, KaldiRecognizer
FRAME_RATE = 16000
CHANNELS=1

model = Model(model_name="libs/models/vosk-model-small-en-0.22") #The model is in this folder.
rec = KaldiRecognizer(model, FRAME_RATE)
rec.SetWords(True)

this cell throws an error: "Exception: model name libs/models/vosk-model-small-en-0.22 does not exist"

If you put the "vosk-model-small-en-0.22" model folder on the same level as the python script and write:

FRAME_RATE = 16000
CHANNELS=1

model = Model(model_name="vosk-model-small-en-0.22")
rec = KaldiRecognizer(model, FRAME_RATE)
rec.SetWords(True)

then everything works.

I will use several models for different languages, it is convenient for me that they lie in the model / libs. How do I write the address in model_name so that everything works?

Alexei
  • 277
  • 1
  • 2
  • 9

2 Answers2

0

I found out that the model should be located at C:\Users \ User \ .cache\vosk\vosk-model-en-0.22

Alexei
  • 277
  • 1
  • 2
  • 9
0

Let me clarify the Alexei answer a little bit more.

Your model is getting stored in the .cache folder which you can find in the user folder of C:\ drive.

Model file path is created at C:\Users\User.cache\vosk\vosk-model-small-en-0.22

enter image description here

By default, it will store smaller version of your model which was trained on smaller dataset. But if you wish to use the model trained on the larger dataset you have to replace all the files inside the \vosk-model-small-en-0.22 folder with the files from the larger trained model. Before pasting the files, you have to unzip the larger model which you wish to replace with. You can have models of different languages and all can be found in the .cache folder of C:\ Drive.

enter image description here