項目地址
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