Whisper-Finetune使用心得

项目地址

https://github.com/shuaijiang/Whisper-Finetune

huggingface国内镜像

https://hf-mirror.com

使用huggingface国内镜像

当python文件中需要在线下载whisper模型时,在执行python文件时,需要运行设置临时环境变量的命令。

windows系统

set HF_ENDPOINT=https://hf-mirror.com

linux系统

export HF_ENDPOINT=https://hf-mirror.com

whisper模型的使用

  • whisper模型在github及huggingface上均有存放。
  • 使用github上的模型需要借助openai-whisper包,下载的模型是.pt格式,存放在C:\Users\王.cache\whisper文件夹下;
  • 使用huggingface上的模型需要借助transformers包,下载的模型是.safetensors格式,存放在C:\Users\王.cache\huggingface\hub文件夹下。

pip install -U

-U是--upgrade的简写形式,它的主要功能是升级已安装的包到最新可用版本。

报错:

  • Failed to find C compiler
  • 解决办法:
sudo apt update
sudo apt install gcc g++ build-essential
gcc --version
export CC=gcc

安装PyTorch

项目中安装命令是:

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia

但是该命令中针对CUDA11.6版本的,因为我的电脑上CUDA版本为12.6,在PyTorch上查看了安装方法

https://pytorch.org/get-started/locally/

重新执行以下安装语句

pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126
pip install -U bitsandbytes -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install numpy=1.26.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install transformers==4.36.0 accelerate==0.27.2 -i  https://pypi.tuna.tsinghua.edu.cn/simple
pip install peft==0.4.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

参考文献

【亲测免费】 Whisper-Finetune 项目使用教程-CSDN博客

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容