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

.


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

相关推荐
Jeled10 小时前
Retrofit 与 OkHttp 全面解析与实战使用(含封装示例)
android·okhttp·android studio·retrofit
ii_best12 小时前
IOS/ 安卓开发工具按键精灵Sys.GetAppList 函数使用指南:轻松获取设备已安装 APP 列表
android·开发语言·ios·编辑器
2501_9159090612 小时前
iOS 26 文件管理实战,多工具组合下的 App 数据访问与系统日志调试方案
android·ios·小程序·https·uni-app·iphone·webview
limingade14 小时前
手机转SIP-手机做中继网关-落地线路对接软交换呼叫中心
android·智能手机·手机转sip·手机做sip中继网关·sip中继
RainbowC014 小时前
GapBuffer高效标记管理算法
android·算法
程序员码歌14 小时前
豆包Seedream4.0深度体验:p图美化与文生图创作
android·前端·后端
、花无将15 小时前
PHP:下载、安装、配置,与apache搭建
android·php·apache
shaominjin12316 小时前
Android 约束布局(ConstraintLayout)的权重机制:用法与对比解析
android·网络
我命由我1234517 小时前
Android 对话框 - 对话框全屏显示(设置 Window 属性、使用自定义样式、继承 DialogFragment 实现、继承 Dialog 实现)
android·java·java-ee·android studio·android jetpack·android-studio·android runtime
怪兽201418 小时前
请例举 Android 中常用布局类型,并简述其用法以及排版效率
android·面试