mozilla / DeepSpeech

DeepSpeech is an open source embedded (offline, on-device) speech-to-text engine which can run in real time on devices ranging from a Raspberry Pi 4 to high power GPU servers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: DLL load failed while importing _impl: A dynamic link library (DLL) initialization routine failed. (while importing deepspeech library)

Dynocoder opened this issue · comments

OS: Windows 10 build 19041
Python version: 3.9(also tested on 3.8 and 3.6)

I am using the pre-trained model of deepspeech

I am new to coding. I am getting a DLL load failed error I have asked on their forum but they also were not able to solve My problem. I want to convert speech to text in realtime

here is what I did in a step by step by step manner

  1. created a virtual environment
  2. installed deepspeech using pip
  3. downloaded the .pbmm and the .scorer file from github
  4. downloaded the deepspeech examples file from github
  5. then I used this code
import deepspeech
import wave
import numpy as np

modelPath = 'D:\Coding\jarvis\deepspeech-0.9.3-models.pbmm'

model = deepspeech.Model(modelPath)

scorerPath = 'D:\Coding\jarvis\deepspeech-0.9.3-models.scorer'

model.enableExternalScorer(scorerPath)

lm_alpha = 0.75
lm_beta = 1.85
model.setScorerAlphaBeta(lm_alpha, lm_beta)

beam_width = 500
model.setBeamWidth(beam_width)


filename = 'audio/8455-210777-0068.wav'
w = wave.open(filename, 'r')
rate = w.getframerate()
frames = w.getnframes()
buffer = w.readframes(frames)
print(rate)
print(model.sampleRate())
type(buffer)

data16 = np.frombuffer(buffer, dtype=np.int16)

text = model.stt(data16)
print(text)


but when I run this code I am getting this error:

Traceback (most recent call last):
  File "D:\Coding\jarvis\app.py", line 1, in <module>
    import deepspeech
  File "D:\Coding\jarvis\deepspeech\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
    from deepspeech.impl import Version as version
  File "D:\Coding\jarvis\deepspeech\lib\site-packages\deepspeech\impl.py", line 13, in <module>
    from . import _impl
ImportError: DLL load failed while importing _impl: A dynamic link library (DLL) initialization routine failed.

I have also tried doing this from the command prompt but the same error. its been days I am trying to fix this but nothing.

if you know the solution then kindly help. Also will clean reinstalling my windows fix this issue?