转载 

【本地开源】whisper-large-v3:速度快得令人难以置信的翻译模型,分享三种实用的调用方法

分类:    248人阅读    IT小君  2024-05-28 23:14

简 介


1、whisper-large-v3 是openai公司的模型,可使用Python代码调用;


2、whisper-large-v3基础上chenxwh 制作了开源库insanely-fast-whisper ,可本地指令运行,或 Google Colab T4 GPU 运行;


3、以上两个模型应用,如果觉得使用复杂难度大,国内软件工程师制作了更简单的版本fast-whisper3。


以下分三部分介绍:





开源库

insanely-fast-whisper

https://github.com/chenxwh/insanely-fast-whisper

使用 OpenAI 的 Whisper Large v3 在不到 98 秒的时间内转录 300 分钟(5 小时)的音频。

图片


在 Nvidia A100 - 80GB 上运行的一些基准测试

图片




insanely-fast-whisper

本地安装

1、pip install pipx

图片



2、pipx install insanely-fast-whisper

默认路径:

C:\Users\Administrator\AppData\Local\pipx\pipx\venvs\insanely-fast-whisper


图片

pipx install insanely-fast-whisper --force --pip-args="--ignore-requires-python"




3、运行(cmd)

- 路径:

C:\Users\Administrator\AppData\Local\pipx\pipx\venvs\insanely-fast-whisper\Scripts

- 指令:

insanely-fast-whisper --file-name e:\huang.mp3


usage: insanely-fast-whisper.exe [-h] 

[--file-name FILE_NAME ]

[--device-id DEVICE_ID]                                

[--transcript-path TRANSCRIPT_PATH] 

[--model-name MODEL_NAME]

[--task {transcribe,translate}]

[--language LANGUAGE]

[--batch-size BATCH_SIZE]                                 

[--flash FLASH] 

[--timestamp {chunk,word}] 

[--hf_token HF_TOKEN]                                 

[--diarization_model DIARIZATION_MODEL]

图片


图片







 Google Colab T4 GPU 运行


测试

insanely-fast-whisper

图片


运行时间:2s

图片







另一个分享


在开源whisper上加工,打包的翻译软件

更简单,更方便

large-v3

作者:万能君软件库

夸克网盘链接:https://pan.quark.cn/s/82b36b6adfa7提取码:JsyQ


图片


运行时间

识别+翻译:30s

图片









insanely-fast-whisper

源自

https://github.com/openai/whisper


Whisper 的性能因语言而异


下图显示了按语言large-v3和模型的性能细分,使用在 Common Voice 15 和 Fleurs 数据集上评估的large-v2WER(单词错误率)或 CER(字符错误率,以斜体显示)。

图片




Whisper

命令行使用


(例)


1、使用medium模型转录音频文件中的语音:

whisper audio.flac audio.mp3 audio.wav --model medium


2、指定语言--language

whisper japanese.wav --language Japanese(cantonese)


3、--task translate会将演讲翻译成英语

whisper japanese.wav --language Japanese --task translate


4、查看所有可用选项

whisper --help


5、python使用

import whisper

model = whisper.load_model("base")

result = model.transcribe("huang.mp3")

print(result["text"])

图片



6、python安装whisper

pip install -U openai-whisper

or

pip install git+https://github.com/openai/whisper.git 

图片



7、python 升级whisper

pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git

图片

图片






早期版本参考


Faster-whisper | 部署到 Google Colab, 输入网址,自动识别字幕保存。


Whisper 语音与文字互相转换 桌面简易版【非常好用,推荐】



转载于:https://mp.weixin.qq.com/s/pbY5yferZ9X_GBQUc82SmQ

支付宝打赏 微信打赏

如果文章对你有帮助,欢迎点击上方按钮打赏作者

 工具推荐 更多»