昇腾CANN环境下Whisper.cpp安装指南

前置检查

确认昇腾AI处理器已经安装妥当

bash 复制代码
lspci | grep 'Processing accelerators'

❕务必确认操作系统架构及版本、Python版本满足要求

|--------|------------------------------------------|
| 软件 | 版本 |
| 操作系统 | openEuler20.03/22.03, Ubuntu 20.04/22.04 |
| Python | 3.8, 3.9, 3.10 |

bash 复制代码
uname -m && cat /etc/*release 
bash 复制代码
 python --version

确认驱动是否安装

bash 复制代码
npu-smi info

确认固件是否安装成功

bash 复制代码
#软件包默认安装路径:/usr/local/Ascend
#装详细日志路径:/var/log/ascend_seclog/ascend_install.log
cat /var/log/ascend_seclog/ascend_install.log
#安装后软件包的安装路径、安装命令以及运行用户信息记录路径:/etc/ascend_install.info
cat /etc/ascend_install.info

确认CANN是否安装成功

bash 复制代码
cat /usr/local/Ascend/ascend-toolkit/latest/arm64-linux/ascend_toolkit_install.info
cat /usr/local/Ascend/ascend-toolkit/latest/aarch64-linux/ascend_toolkit_install.info

一、Whisper.cpp 安装

1.1编译安装

bash 复制代码
cd /usr/local
#下载 Whisper.cpp 项目到本地
git clone https://github.com/ggerganov/whisper.cpp.git
#在 Whisper.cpp 项目目录下,创建构建目录并进入该目录
cd whisper.cpp 
mkdir build
cd build
source /usr/local/Ascend/ascend-toolkit/set_env.sh
#编译安装 CANN 版本的 Whisper.cpp
cmake .. -D GGML_CANN=on
make -j

1.2安装校验

编译完毕后,无任何报错信息,并输出以下关键回显即说明安装成功:

[ 90%] Built target quantize

[ 95%] Linking CXX executable ../../bin/main

[ 95%] Built target main

[100%] Linking CXX executable ../../bin/server

[100%] Built target server

二、使用脚本下载Whisper 模型

使用 Whisper.cpp 项目中的 download-ggml-model.sh 脚本下载预先转换为 gguf 格式的 Whisper 模型:

bash 复制代码
cd /usr/local/whisper.cpp/models
#如果无法下载模型,打开download-ggml-model.sh 脚本,更换默认的网址https://huggingface.co
#vi download-ggml-model.sh
./download-ggml-model.sh base.en

三、语音文件预处理

使用 ffmpeg 转换所需处理的语音文件为 16 bit wav 语音文件,此处以 samples/jfk.mp3 为例:

bash 复制代码
cd ..
apt-get upgrade
apt-get install ffmpeg
ffmpeg -loglevel -0 -y -i samples/jfk.mp3 -ar 16000 -ac 1 -c:a pcm_s16le samples/jfk-test.wav

四、自动语音识别

bash 复制代码
./build/bin/main -f samples/jfk-test.wav -m models/ggml-base.en.bin -t 8
相关推荐
不喝可乐_2 天前
在win11 中 whisper-large-v3-turbo 的简单使用
whisper
毛毛的毛毛6 天前
如何使用OPENAI的Whisper功能进行音频字母提取功能
whisper
Secede.9 天前
Whisper+T5-translate实现python实时语音翻译
开发语言·python·whisper
烤鸭的世界我们不懂9 天前
Python + WhisperX:解锁语音识别的高效新姿势
python·whisper·语音识别
落杉丶25 天前
[ASR]faster-whisper报错Could not locate cudnn_ops64_9.dll
python·whisper
drebander1 个月前
Whisper-Medium 模型:音频转文本的原理、实践与硬件推荐
whisper·音视频
drebander1 个月前
Whisper-Tiny 模型:音频转文本的原理与实践
whisper·音视频
大模型之路1 个月前
OpenAI Whisper:语音识别技术的革新者—深入架构与参数
人工智能·whisper·语音识别
南棱笑笑生1 个月前
20250109使用M6000显卡在Ubuntu20.04.6下跑whisper来识别中英文字幕
whisper
飘逸高铁侠2 个月前
使用 whisper和ffmpeg 烧录视频的中英文双语字幕
ffmpeg·whisper·音视频