前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >[1306]whisper报错:UserWarning: FP16 is not supported on CPU; using FP32 instead

[1306]whisper报错:UserWarning: FP16 is not supported on CPU; using FP32 instead

作者头像
周小董
发布2024-11-24 08:07:15
发布2024-11-24 08:07:15
16900
代码可运行
举报
文章被收录于专栏:python前行者
运行总次数:0
代码可运行

报错:

代码语言:javascript
代码运行次数:0
复制
PS D:\> whisper.exe .\dz.wav --language en --model medium
C:\xxPython310\lib\site-packages\whisper\transcribe.py:114: UserWarning: FP16 is not supported on CPU; using FP32 instead
  warnings.warn("FP16 is not supported on CPU; using FP32 instead")

这个报错说的是whisper要使用cpu,而你音频是fp16的,cpu不支持。

要点在于如何解决为什么whisper没使用GPU

应该是搞别的时候把torch给搞成cpu版本的了。

解决方法1 WHISPER使用的时候出现的问题,因为并不想动之前的pytorch环境,解决办法在参数中加入fp16=False即可

代码语言:javascript
代码运行次数:0
复制
result = model.transcribe("segment1.wav", fp16=False) #language

解决方法2

代码语言:javascript
代码运行次数:0
复制
pip3 uninstall -y torch torchvision torchaudio
# following command was generated using https://pytorch.org/get-started/locally/#with-cuda-1
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
代码语言:javascript
代码运行次数:0
复制
import torch
device = 'cuda' if torch.cuda.is_available() else 'cpu'
whisper.load_model('medium').to(device)

解决方法3 打开:https://pytorch.org/

代码语言:javascript
代码运行次数:0
复制
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

按照这个方式在装一下就好了

参考:https://blog.csdn.net/shanchuan2012/article/details/131774957 https://blog.csdn.net/qq_42569234/article/details/134684721 https://blog.51cto.com/u_10632206/9912487 https://stackoverflow.com/questions/75908422/whisper-ai-error-fp16-is-not-supported-on-cpu-using-fp32-instead

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-09-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档