【问题标题】:How to use GPU when transcribing using deepspeech使用 deepspeech 转录时如何使用 GPU
【发布时间】:2021-12-06 23:27:05
【问题描述】:

我正在使用出色的 deepspeech 包在 Python 中转录音频文件。这是我的快速实现:

import wave
import deepspeech
import numpy as np

model_file_path = 'deepspeech-0.9.3-models.pbmm'
model = deepspeech.Model(model_file_path)
filename = 'podcast.wav'
w = wave.open(filename, 'r')
frames = w.getnframes()
buffer = w.readframes(frames)
data16 = np.frombuffer(buffer, dtype=np.int16)
text = model.stt(data16)

podcast.wav 是一个约 20 分钟的音频文件。运行text = model.stt(data16) 需要 10 多分钟(我在 10 分钟后中断了该过程),考虑到 GPU 的可用性(我正在使用 Google Colab),这出乎意料地慢。我怀疑脚本没有使用 GPU。 上面的代码还有其他实现方式来保证GPU的使用吗?我可以确认deepspeech-gpu已经安装了。

【问题讨论】:

    标签: python nlp data-science transcription mozilla-deepspeech


    【解决方案1】:

    安装 deepspeech-gpu 即可。

    pip install deepspeech-gpu

    尝试卸载您之前安装的 CPU 版本。

    pip uninstall deepspeech

    您可以通过监控您的 GPU 使用情况来验证这一点。 Display GPU Usage While Code is Running in Colab

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-15
      • 2018-12-20
      • 2013-08-19
      • 2020-09-26
      • 2017-02-10
      • 1970-01-01
      • 2020-06-14
      相关资源
      最近更新 更多