Whisper-Finetune使用心得

項目地址

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

huggingface國內(nèi)鏡像

https://hf-mirror.com

使用huggingface國內(nèi)鏡像

當python文件中需要在線下載whisper模型時,在執(zhí)行python文件時,需要運行設置臨時環(huán)境變量的命令。

windows系統(tǒng)

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

linux系統(tǒng)

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/

重新執(zhí)行以下安裝語句

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博客

?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容