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

.


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

相关推荐
wanhengidc3 分钟前
云手机搬砖安全吗
大数据·运维·服务器·安全·游戏·智能手机
wanhengidc8 分钟前
服务器管理器的作用有哪些?
运维·服务器·网络·安全·游戏·智能手机
诸神黄昏EX12 分钟前
Android Safety 系列专题【篇七:Android AVF机制】
android
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.33 分钟前
MySQL 主从架构中的使用技巧及优化
android·mysql·架构
羊小蜜.34 分钟前
Mysql 11: 存储过程全解——从创建到使用
android·数据库·mysql·存储过程
zh_xuan41 分钟前
Android compose和传统view混用
android
大黄说说1 小时前
MySQL索引失效的常见场景有哪些?如何通过EXPLAIN分析查询性能?
android·adb
冰糖葫芦三剑客1 小时前
华为 Android APP 应用内生成合成内容的文件元数据中添加隐式标识的截图 开发要怎么生成?
android·华为
羊小蜜.1 小时前
Mysql 12: 视图全解——从创建到使用
android·数据库·mysql·视图
zh_xuan3 小时前
Android 传统view嵌入compose
android