Whisper——部署fast-whisper中文语音识别模型

Whisper——部署fast-whisper中文语音识别模型

    正在检查是否收录...

whisper:https://github.com/openai/whisper/tree/main
参考文章:Whisper OpenAI开源语音识别模型

环境配置

pip install faster-whisper transformers 

准备tiny模型

需要其他版本的可以自己下载:https://huggingface.co/openai

原始中文语音模型:
https://huggingface.co/openai/whisper-tiny 
微调后的中文语音模型:
git clone https://huggingface.co/xmzhu/whisper-tiny-zh 
补下一个:tokenizer.json
https://huggingface.co/openai/whisper-tiny/resolve/main/tokenizer.json?download=true 

模型转换

float16
ct2-transformers-converter --model whisper-tiny-zh/ --output_dir whisper-tiny-zh-ct2 --copy_files tokenizer.json preprocessor_config.json --quantization float16 
int8
ct2-transformers-converter --model whisper-tiny-zh/ --output_dir whisper-tiny-zh-ct2-int8 --copy_files tokenizer.json preprocessor_config.json --quantization int8 

代码

from faster_whisper import WhisperModel # model_size = "whisper-tiny-zh-ct2" # model_size = "whisper-tiny-zh-ct2-int8" # Run on GPU with FP16 # model = WhisperModel(model_size, device="cuda", compute_type="float16") model = WhisperModel(model_size, device="cpu", compute_type="int8") # or run on GPU with INT8 # model = WhisperModel(model_size, device="cuda", compute_type="int8_float16") # or run on CPU with INT8 # model = WhisperModel(model_size, device="cpu", compute_type="int8") segments, info = model.transcribe("output_file.wav", beam_size=5, language='zh') print("Detected language '%s' with probability %f" % (info.language, info.language_probability)) for segment in segments: print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text)) 

codewhisperjsonopenaihuggingfacetokencputransformertransformerstpugpugit语音模型clone语音识别githuburl

  • 本文作者:李琛
  • 本文链接: https://wapzz.net/post-7158.html
  • 版权声明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
本站部分内容来源于网络转载,仅供学习交流使用。如涉及版权问题,请及时联系我们,我们将第一时间处理。
文章很赞!支持一下吧 还没有人为TA充电
为TA充电
还没有人为TA充电
0
  • 支付宝打赏
    支付宝扫一扫
  • 微信打赏
    微信扫一扫
感谢支持
文章很赞!支持一下吧
关于作者
2.3W+
5
0
1
WAP站长官方

谷歌的Bard在聊天机器人排名中击败了GPT-4

上一篇

AI换脸工具有哪些 免费AI人脸互换软件app在线使用地址入口

下一篇
  • 复制图片
按住ctrl可打开默认菜单