WhisperKit: Android 端测试 Whisper -- Android手机(Qualcomm GPU)部署音频大模型

WhisperKit: Android 端测试 Whisper


原文:https://flowus.cn/xiaoj_share/share/8c721e89-680e-451c-8c93-52e435ebf1a2

1.环境需要

以下是经实验验证可行的环境参考,也可尝试其他版本。

(1)PC:Ubuntu 22.04.4

(2)硬件设备:Qualcomm 芯片的 Android 手机

(3)软件环境:如下表所示

工具 版本 安装
Anaconda 2021.05 参考《Anaconda3安装及使用》
Docker 27.4.0 参考《Docker在Ubuntu上安装》
expect 5.45.4 conda install -c anaconda expect
aria2 1.37.0 conda install -c conda-forge aria2
adb 1.0.41 conda install -c conda-forge adb
git 2.34.1 sudo apt-get update ; sudo apt-get install git
git-lfs 3.6.0 sudo apt-get install git-lfs

2.环境构建

(1)克隆项目:

shell 复制代码
git lfs install
git clone https://github.com/argmaxinc/WhisperKitAndroid.git
cd WhisperKitAndroid

(2)工具检查(make setup):

(1)环境安装:参考环境需要的表格里命令安装。

(2)环境检查:

shell 复制代码
# 没有报错即通过
make setup

(3)下载模型(make download-models)

修改download_models.sh中huggingface为镜像网站(因为不能访问到huggingface):

shell 复制代码
# 打开脚本
vi scripts/download_models.sh
# 修改以下内容
#HF_ARGMAX_URL="https://huggingface.co/argmaxinc/whisperkit-android/resolve/main"
HF_ARGMAX_URL="https://hf-mirror.com/argmaxinc/whisperkit-android/resolve/main"
#HF_QUALCOMM_URL="https://huggingface.co/qualcomm"
HF_QUALCOMM_URL="https://hf-mirror.com/qualcomm"

下载 Whisper 模型 (<1.5GB) 和辅助文件

shell 复制代码
# 没有报错即通过
make download-models

或手动 git clone模型文件:

shell 复制代码
# 或手动 git clone
git clone https://hf-mirror.com/argmaxinc/whisperkit-android
git clone https://hf-mirror.com/qualcomm/Whisper-Tiny-En
git clone https://hf-mirror.com/qualcomm/Whisper-Base-En
git clone https://hf-mirror.com/qualcomm/Whisper-Small-En

(4)Docker中构建环境(make env)

shell 复制代码
# 没有报错即通过
make env

3.项目构建

执行到 Docker 构建环境中:

shell 复制代码
make env

构建 CLI:

shell 复制代码
make build

4.Android测试

(1)设备连接:确认设备连接好了,使用以下命令查看是否有adb设备连接:

shell 复制代码
$ adb devices

(2)push文件到设备:

shell 复制代码
adb push ./build_android/whisperax_cli  /data/local/tmp/WhisperKit_test/
adb push ./build_android/libwhisperax.so  /data/local/tmp/WhisperKit_test/libs/android/
adb push ./libs/android/*  /data/local/tmp/WhisperKit_test/libs/android/
# 请将音频文件放在/path/to/WhisperKitAndroid/inputs文件夹中,一同push到设备中。
adb push ./inputs  /data/local/tmp/WhisperKit_test/
adb push ./models  /data/local/tmp/WhisperKit_test/

(3)设备上运行:

shell 复制代码
# 进入adb设备
make adb-shell
cd /data/local/tmp/WhisperKit_test

# 生成以下Run.sh脚本并运行
#!/bin/sh
basedir=$(dirname $0)
basedir=$(realpath $basedir)
export LD_LIBRARY_PATH=$basedir/lib/android
export ADSP_LIBRARY_PATH=$basedir/lib/android
#Usage: axie_tflite <audio input> <tiny | base | small>
./whisperax_cli inputs/test-en.mp3 tiny

.


声明:资源可能存在第三方来源,若有侵权请联系删除!

相关推荐
千里马学框架3 天前
一起学 Android 14:ShellTransition 屏幕旋转过程深度剖析
android·智能手机·性能优化·framework·性能·屏幕旋转·rotation
美狐美颜SDK开放平台3 天前
开发直播APP时如何接入视频美颜SDK?开发流程与注意事项
android·人工智能·计算机视觉·音视频·直播美颜sdk
AFinalStone3 天前
Android7 SystemUI源码解析(七)Keyguard锁屏模块深度解析
android·systemui
致远ccc3 天前
Google Play 上架前如何测试 App?多国家 Android 环境测试
android·app测试·googleplay·多国家应用测试
ttyyttemo3 天前
Kotlin 协程中的 Job 结构化并发与取消
android
sun0077003 天前
tbox 4g/5g切换,导致wan ip 改变,导致车机旧网络不可用。需要重启车机才行
android
其实防守也摸鱼3 天前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
AFinalStone3 天前
Android7 SystemUI 源码解析(四)NavigationBar 导航栏与 SystemBars
android·systemui
JMchen3 天前
属性动画原理与高级动画实现
android·kotlin·canvas
AFinalStone3 天前
Android7 SystemUI 源码解析(二)启动流程深度解析
android·systemui