昇腾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
相关推荐
DARLING Zero two♡4 天前
浏览器里跑 AI 语音转写?Whisper Web + cpolar让本地服务跑遍全网
前端·人工智能·whisper
johnny2336 天前
OpenAI Whisper:生态
whisper
不解不惑14 天前
OpenAI whisper 语音识别服务器搭建
服务器·whisper·语音识别
许泽宇的技术分享15 天前
用 OpenAI Whisper + pyannote.audio 打造“谁在说什么”的全栈语音理解系统
macos·whisper·xcode
这儿有一堆花25 天前
使用 Whisper 转写语音的完整教学
人工智能·ai·whisper
数据饕餮1 个月前
Faster-Whisper命令和意图识别程序设计调优:上下文感知和领域词汇增强
whisper
落淼喵_G1 个月前
ubuntu部署whisper+speaker_large+qwen【一】
ubuntu·whisper
兔兔爱学习兔兔爱学习1 个月前
浏览器端实时语音采集 + WebSocket 传输 + 后端 Whisper + GPT 翻译 + 实时字幕返回
gpt·websocket·whisper
兔兔爱学习兔兔爱学习1 个月前
一个可本地运行的实时字幕翻译 Demo(Whisper + GPT + Streamlit),可以边说边出中英文字幕
gpt·whisper
数据饕餮1 个月前
Faster-Whisper唤醒词检测程序设计实战1
whisper