mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-11-07 16:44:13 +01:00
5fdb27ff80
* ggml : 32-bit arm compat * ggml : add ggml_vqtbl1q_s8 impl * ggml : cont |
||
---|---|---|
.. | ||
.idea | ||
app | ||
gradle/wrapper | ||
lib | ||
.gitignore | ||
build.gradle | ||
gradle.properties | ||
gradlew | ||
gradlew.bat | ||
README.md | ||
settings.gradle |
A sample Android app using whisper.cpp to do voice-to-text transcriptions.
To use:
- Select a model from the whisper.cpp repository.1
- Copy the model to the "app/src/main/assets/models" folder.
- Select a sample audio file (for example, jfk.wav).
- Copy the sample to the "app/src/main/assets/samples" folder.
- Select the "release" active build variant, and use Android Studio to run and deploy to your device.
(PS: Do not move this android project folder individually to other folders, because this android project folder depends on the files of the whole project.)
CLBlast
Note
- OpenCL does not have the same level of support as CUDA or Metal.
- Turning on CLBlast may degrade OpenCL performance if your device isn't already tuned. See tuning.md for a list of devices that are already tuned and what to do if yours is missing.
Build CLBlast.
# In path/to/CLBlast (we assume OpenCL-Headers relative location)
$ANDROID_SDK_PATH/cmake/3.22.1/bin/cmake .. \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=33 \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=$ANDROID_NDK_PATH \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DOPENCL_ROOT=$(readlink -f ../../OpenCL-Headers) \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
# Build libclblast.so
make -j4
Pull libGLES_mali.so
to libOpenCL.so
.
# In path/to/whisper.android
mkdir lib/src/main/jniLibs/arm64-v8a
adb pull /system/vendor/lib64/egl/libGLES_mali.so lib/src/main/jniLibs/arm64-v8a/libOpenCL.so
In gradle.properties, set GGML_HOME
to the location of GGML, as well as
required options for turning on CLBlast.
GGML_HOME=/path/to/ggml
GGML_CLBLAST=ON
CLBLAST_HOME=/path/to/CLBlast
OPENCL_LIB=/path/to/libOpenCL.so
OPENCL_ROOT=/path/to/OpenCL-Headers
-
I recommend the tiny or base models for running on an Android device. ↩︎