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

.


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

相关推荐
阿巴斯甜8 小时前
Android 报错:Zip file '/Users/lyy/develop/repoAndroidLapp/l-app-android-ble/app/bu
android
Kapaseker9 小时前
实战 Compose 中的 IntrinsicSize
android·kotlin
xq952710 小时前
Andorid Google 登录接入文档
android
黄林晴11 小时前
告别 Modifier 地狱,Compose 样式系统要变天了
android·android jetpack
冬奇Lab1 天前
Android触摸事件分发、手势识别与输入优化实战
android·源码阅读
城东米粉儿1 天前
Android MediaPlayer 笔记
android
Jony_1 天前
Android 启动优化方案
android
阿巴斯甜1 天前
Android studio 报错:Cause: error=86, Bad CPU type in executable
android
张小潇1 天前
AOSP15 Input专题InputReader源码分析
android
_小马快跑_1 天前
Kotlin | 协程调度器选择:何时用CoroutineScope配置,何时用launch指定?
android