alphacep / alphacep/vosk-api

Failure to create model

Đang mở
#1,510 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Jupyter Notebook
Star
15.1k
Fork
1.8k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

My pre-trained en-us model downloaded from the vosk website keeps failing to build. It was working and building perfectly fine with the same model, I am not sure what to change.

> This is my code.
```py
from vosk import Model, KaldiRecognizer
import wave
import json

def transcribe(file_path):
model = Model('src/vosk-model-en-us-0.22')
recognizer = KaldiRecognizer(model, 16000) # includes the path to the audiofile and the bitrate

file = wave.open(file_path, "rb")

transcribed_text_list = []

while True:
data = file.readframes(4000)
if len(data) == 0:
break
if recognizer.AcceptWaveform(data):
result = json.loads(recognizer.Result())
transcribed_text_list.append(result['text'])

final_result = json.loads(recognizer.FinalResult())
transcribed_text_list.append(final_result['text'])

complete_text = ' '.join(transcribed_text_list)

return complete_text

```

> This is the output.
```
LOG (VoskAPI:ReadDataFiles():model.cc:213) Decoding params beam=13 max-active=7000 lattice-beam=6
LOG (VoskAPI:ReadDataFiles():model.cc:216) Silence phones 1:2:3:4:5:11:12:13:14:15
LOG (VoskAPI:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 0 orphan nodes.
LOG (VoskAPI:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 0 orphan components.
LOG (VoskAPI:ReadDataFiles():model.cc:248) Loading i-vector extractor from src/vosk-model-en-us-0.22/ivector/final.ie
LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:204) Done.
LOG (VoskAPI:ReadDataFiles():model.cc:279) Loading HCLG from src/vosk-model-en-us-0.22/graph/HCLG.fst
LOG (VoskAPI:ReadDataFiles():model.cc:297) Loading words from src/vosk-model-en-us-0.22/graph/words.txt
LOG (VoskAPI:ReadDataFiles():model.cc:308) Loading winfo src/vosk-model-en-us-0.22/graph/phones/word_boundary.int
LOG (VoskAPI:ReadDataFiles():model.cc:315) Loading subtract G.fst model from src/vosk-model-en-us-0.22/rescore/G.fst
LOG (VoskAPI:ReadDataFiles():model.cc:317) Loading CARPA model from src/vosk-model-en-us-0.22/rescore/G.carpa
ERROR (VoskAPI:ReadInternal():const-arpa-lm.cc:610) ConstArpaLm section reading failed.
Traceback (most recent call last):
File "/workspaces/speech_recognition_libraries/src/vosk_demo.py", line 33, in
transcribe(file_path)
File "/workspaces/speech_recognition_libraries/src/vosk_demo.py", line 6, in transcribe
model = Model('src/vosk-model-en-us-0.22')
File "/usr/local/python/3.10.13/lib/python3.10/site-packages/vosk/__init__.py", line 57, in __init__
raise Exception("Failed to create a model")
Exception: Failed to create a model

```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.