AI语音识别模块--whisper模块

2024-03-11 1469阅读

温馨提示:这篇文章已超过376天没有更新,请注意相关的内容是否还可用!

1.下载 ffmpeg,挑一个自己电脑系统的版本,下载,如我win64:

地址:

Releases · BtbN/FFmpeg-Builds · GitHub

下载压缩包zip,到·本地

解压安装,其实无需安装,只需把对应的目录下的bin,

编辑环境变量的path,添加到环境变量即可!!!

不能科学的同学,可以到网盘地址,下载压缩包zip

链接:https://pan.baidu.com/s/1yBQBs-pUKOpUPeIJpPsURA?pwd=6543 

提取码:6543 

2.下载whisper:

查看模型的地址:              https://github.com/openai/whisper/blob/main/whisper/__init__.py      

查看初始化文件: __init__,内含各个模型的地址,就省得取hugging-face里下载了...

AI语音识别模块--whisper模块

例如,依次从小到大...配置要求如下:

AI语音识别模块--whisper模块

地址:::

 "tiny"最小化模型: "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt",

"base"基础款模型: "https://openaipublic.azureedge.net/main/whisper/models/ed3a0b6b1c0edf879ad9b11b1af5a0e6ab5db9205f891f668f8b0e6c6326e34e/base.pt",

 "small"小型化模型: "https://openaipublic.azureedge.net/main/whisper/models/9ecf779972d90ba49c06d968637d720dd632c55bbf19d441fb42bf17a411e794/small.pt",

3.根据 tree/main分支下,进行环境的配置::

地址:

GitHub - openai/whisper: Robust Speech Recognition via Large-Scale Weak Supervision

下滑到底下,即可看到

AI语音识别模块--whisper模块

安装好后,直接是cpu版本的pytorch,如若需要gpu版本,可自行安装....

pip uninstall torch,再 pip install 自己gpu版本的torch即可!!!...

4.运用命令:

whisper test.mp3 --model small --model_dir D:\qbroDownload\whisper-model --language Chinese

# whisper 音频文件 

--model 模型规格 

--model_dir 模型路径

--language 语言选择/可不选....提前选好可加速..

产生报错:::

transcribe.py:115: UserWarning: FP16 is not supported on CPU; using FP32 instead

5.详情代码::

可作为参考....

import whisper
# 有下载到本地,直接加载 base.pt也可以,不然会直接网络下载
model = whisper.load_model('base')
# 1.传入音频、fp16-cpu版本,gpu版本可以忽略,语言可选项...默认繁体字,用base模型,输出简体字...
result = model.transcribe('./op.wav',fp16=False,language='Chinese')
print(result['text'])
# 2.传入视频也可以...
result1 = model.result = model.transcribe('./video.mp4',fp16=False,language='Chinese')
print(result1['text'])
VPS购买请点击我

免责声明:我们致力于保护作者版权,注重分享,被刊用文章因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理! 部分文章是来自自研大数据AI进行生成,内容摘自(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供学习参考,不准确地方联系删除处理! 图片声明:本站部分配图来自人工智能系统AI生成,觅知网授权图片,PxHere摄影无版权图库和百度,360,搜狗等多加搜索引擎自动关键词搜索配图,如有侵权的图片,请第一时间联系我们,邮箱:ciyunidc@ciyunshuju.com。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!

目录[+]