1.下載 ffmpeg,挑一個自己電腦系統(tǒng)的版本,下載,如我win64:
地址:
Releases · BtbN/FFmpeg-Builds · GitHub
下載壓縮包zip,到·本地
解壓安裝,其實無需安裝,只需把對應的目錄下的bin,
編輯環(huán)境變量的path,添加到環(huán)境變量即可!?。?/p>
不能科學的同學,可以到網(wǎng)盤地址,下載壓縮包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里下載了...
例如,依次從小到大...配置要求如下:
地址:::
?"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.根據(jù) tree/main分支下,進行環(huán)境的配置::
地址:
GitHub - openai/whisper: Robust Speech Recognition via Large-Scale Weak Supervision
下滑到底下,即可看到
安裝好后,直接是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 模型規(guī)格?
--model_dir?模型路徑
--language 語言選擇/可不選....提前選好可加速..
產(chǎn)生報錯:::
transcribe.py:115: UserWarning: FP16 is not supported on CPU; using FP32 instead
5.詳情代碼::文章來源:http://www.zghlxwxcb.cn/news/detail-830901.html
可作為參考....文章來源地址http://www.zghlxwxcb.cn/news/detail-830901.html
import whisper
# 有下載到本地,直接加載 base.pt也可以,不然會直接網(wǎng)絡下載
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'])
到了這里,關于AI語音識別模塊--whisper模塊的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!