whisper.rn 0.3.0-rc.6 → 0.3.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -8
- package/android/src/main/jni/whisper/Whisper.mk +11 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ React Native binding of [whisper.cpp](https://github.com/ggerganov/whisper.cpp).
|
|
|
13
13
|
| <img src="https://github.com/mybigday/whisper.rn/assets/3001525/2fea7b2d-c911-44fb-9afc-8efc7b594446" width="300" /> | <img src="https://github.com/mybigday/whisper.rn/assets/3001525/a5005a6c-44f7-4db9-95e8-0fd951a2e147" width="300" /> |
|
|
14
14
|
| :------------------------------------------: | :------------------------------------------: |
|
|
15
15
|
| iOS: Tested on iPhone 13 Pro Max | Android: Tested on Pixel 6 |
|
|
16
|
-
| (tiny.en, Core ML enabled) | (tiny.en, armv8.2-a+fp16) |
|
|
16
|
+
| (tiny.en, Core ML enabled, release mode + archive) | (tiny.en, armv8.2-a+fp16, release mode) |
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -129,9 +129,11 @@ To use Core ML on iOS, you will need to have the Core ML model files.
|
|
|
129
129
|
|
|
130
130
|
The `.mlmodelc` model files is load depend on the ggml model file path. For example, if your ggml model path is `ggml-tiny.en.bin`, the Core ML model path will be `ggml-tiny.en-encoder.mlmodelc`. Please note that the ggml model is still needed as decoder or encoder fallback.
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
The Core ML models are hosted here: https://huggingface.co/ggerganov/whisper.cpp/tree/main
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
If you want to download model at runtime, during the host file is archive, you will need to unzip the file to get the `.mlmodelc` directory, you can use library like [react-native-zip-archive](https://github.com/mockingbot/react-native-zip-archive), or host those individual files to download yourself.
|
|
135
|
+
|
|
136
|
+
The `.mlmodelc` is a directory, usually it includes 5 files (3 required):
|
|
135
137
|
|
|
136
138
|
```json5
|
|
137
139
|
[
|
|
@@ -168,13 +170,9 @@ In real world, we recommended to split the asset imports into another platform s
|
|
|
168
170
|
|
|
169
171
|
The example app provide a simple UI for testing the functions.
|
|
170
172
|
|
|
171
|
-
Used Whisper model: `tiny.en` in https://huggingface.co/
|
|
173
|
+
Used Whisper model: `tiny.en` in https://huggingface.co/ggerganov/whisper.cpp
|
|
172
174
|
Sample file: `jfk.wav` in https://github.com/ggerganov/whisper.cpp/tree/master/samples
|
|
173
175
|
|
|
174
|
-
For test better performance on transcribe, you can run the app in Release mode.
|
|
175
|
-
- iOS: `yarn example ios --configuration Release`
|
|
176
|
-
- Android: `yarn example android --mode release`
|
|
177
|
-
|
|
178
176
|
Please follow the [Development Workflow section of contributing guide](./CONTRIBUTING.md#development-workflow) to run the example app.
|
|
179
177
|
|
|
180
178
|
## Mock `whisper.rn`
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
WHISPER_LIB_DIR := $(LOCAL_PATH)/../../../../../cpp
|
|
2
2
|
LOCAL_LDLIBS := -landroid -llog
|
|
3
3
|
|
|
4
|
+
# NOTE: If you want to debug the native code, you can uncomment ifneq and endif
|
|
5
|
+
# ifneq ($(APP_OPTIM),debug)
|
|
6
|
+
|
|
4
7
|
# Make the final output library smaller by only keeping the symbols referenced from the app.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
endif
|
|
8
|
+
LOCAL_CFLAGS += -O3 -DNDEBUG
|
|
9
|
+
LOCAL_CFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
|
10
|
+
LOCAL_CFLAGS += -ffunction-sections -fdata-sections
|
|
11
|
+
LOCAL_LDFLAGS += -Wl,--gc-sections
|
|
12
|
+
LOCAL_LDFLAGS += -Wl,--exclude-libs,ALL
|
|
13
|
+
LOCAL_LDFLAGS += -flto
|
|
14
|
+
|
|
15
|
+
# endif
|
|
13
16
|
|
|
14
17
|
LOCAL_CFLAGS += -DSTDC_HEADERS -std=c11 -I $(WHISPER_LIB_DIR)
|
|
15
18
|
LOCAL_CPPFLAGS += -std=c++11 -I $(WHISPER_LIB_DIR)
|