faster_whisper base模型
frameworks:
- Pytorch license: Apache License 2.0 tasks:
- auto-speech-recognition
SDK下载
#安装ModelScope
pip install modelscope
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('yuanjian/kry_faster_whisper')
Git下载
#Git模型下载
git clone https://www.modelscope.cn/yuanjian/kry_faster_whisper.git
使用模型
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('yuanjian/kry_faster_whisper')
from faster_whisper import WhisperModel
import time
def transcribe(model, audio_path):
st = time.time()
segments, info = model.transcribe(audio_path)
segments = list(segments)
print('识别文件: ', audio_path, ' 耗时:', time.time() - st)
for segment in segments:
print("识别结果:[%s]" % (segment.text))
def test():
st = time.time()
print("load model ...")
# Run on GPU with FP16
model = WhisperModel(model_dir, device="cuda", compute_type="float16")
# Run on GPU with INT8
# model = WhisperModel(model_dir, device="cuda", compute_type="int8_float16")
# Run on CPU with INT8
# model = WhisperModel(model_dir, device="cpu", compute_type="int8")
print('load model cost:', time.time() - st)
transcribe(model, "three_fangyan.m4a")
test()
如果您是本模型的贡献者,我们邀请您根据模型贡献文档,及时完善模型卡片内容。
评论