昇腾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
相关推荐
Luke Ewin9 天前
一个基于OpenAI Whisper开发的音视频字幕文件生成工具
人工智能·whisper·音视频·语音识别·asr·语音转写·视频字幕生成
Encarta199315 天前
【语音识别】vLLM 部署 Whisper 语音识别模型指南
人工智能·whisper·语音识别
JHC00000015 天前
ubuntu 下调用系统麦克风,以及faster-whisper-medium 处理音频转写文本
ubuntu·whisper·音视频
西西弗Sisyphus17 天前
whisper 语音识别
whisper·语音识别
JHC00000017 天前
docker 中跑faster-whisper 教程(1050显卡)
docker·容器·whisper·语音识别
engchina25 天前
vLLM 部署 openai whisper 模型实现语音转文字
人工智能·python·whisper
gs8014025 天前
Faster-Whisper —— 为语音识别加速的利器
人工智能·whisper·语音识别
charles_vaez1 个月前
开源模型应用落地-语音转文本-whisper模型-AIGC应用探索(五)
深度学习·whisper·aigc
Mark White1 个月前
开箱即用的whisper-service服务
whisper
Python数据分析与机器学习2 个月前
基于fast-whisper模型的语音识别工具的设计与实现
大数据·人工智能·python·搜索引擎·whisper·语音识别·课程设计