Python doesn't find model in folder at Model(model_name="models/model-en-0.2) If Model(model_name="model-en-0.2)is writen then it works.How to fix it?

Question:

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?

Asked By: Alexei

||

Answers:

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

Answered By: Alexei
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.