报错:
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
即可
result = model.transcribe("segment1.wav", fp16=False) #language
解决方法2
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
import torch
device = 'cuda' if torch.cuda.is_available() else 'cpu'
whisper.load_model('medium').to(device)
解决方法3 打开:https://pytorch.org/
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