whisper.rn 0.5.0-rc.9 → 0.5.1
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/android/build.gradle +2 -1
- package/android/gradle.properties +1 -1
- package/cpp/ggml-alloc.c +265 -141
- package/cpp/ggml-backend-impl.h +4 -1
- package/cpp/ggml-backend-reg.cpp +30 -13
- package/cpp/ggml-backend.cpp +221 -38
- package/cpp/ggml-backend.h +17 -1
- package/cpp/ggml-common.h +17 -0
- package/cpp/ggml-cpu/amx/amx.cpp +4 -2
- package/cpp/ggml-cpu/arch/arm/quants.c +132 -596
- package/cpp/ggml-cpu/arch/arm/repack.cpp +14 -286
- package/cpp/ggml-cpu/arch/x86/quants.c +184 -675
- package/cpp/ggml-cpu/arch/x86/repack.cpp +4679 -1657
- package/cpp/ggml-cpu/arch-fallback.h +32 -2
- package/cpp/ggml-cpu/common.h +14 -0
- package/cpp/ggml-cpu/ggml-cpu-impl.h +13 -6
- package/cpp/ggml-cpu/ggml-cpu.c +70 -42
- package/cpp/ggml-cpu/ggml-cpu.cpp +35 -28
- package/cpp/ggml-cpu/ops.cpp +1587 -1177
- package/cpp/ggml-cpu/ops.h +5 -8
- package/cpp/ggml-cpu/quants.c +35 -0
- package/cpp/ggml-cpu/quants.h +8 -0
- package/cpp/ggml-cpu/repack.cpp +458 -47
- package/cpp/ggml-cpu/repack.h +22 -0
- package/cpp/ggml-cpu/simd-mappings.h +89 -60
- package/cpp/ggml-cpu/traits.cpp +2 -2
- package/cpp/ggml-cpu/traits.h +1 -1
- package/cpp/ggml-cpu/vec.cpp +170 -26
- package/cpp/ggml-cpu/vec.h +506 -63
- package/cpp/ggml-cpu.h +1 -1
- package/cpp/ggml-impl.h +119 -9
- package/cpp/ggml-metal/ggml-metal-common.cpp +446 -0
- package/cpp/ggml-metal/ggml-metal-common.h +52 -0
- package/cpp/ggml-metal/ggml-metal-context.h +33 -0
- package/cpp/ggml-metal/ggml-metal-context.m +600 -0
- package/cpp/ggml-metal/ggml-metal-device.cpp +1376 -0
- package/cpp/ggml-metal/ggml-metal-device.h +226 -0
- package/cpp/ggml-metal/ggml-metal-device.m +1312 -0
- package/cpp/ggml-metal/ggml-metal-impl.h +722 -0
- package/cpp/ggml-metal/ggml-metal-ops.cpp +3158 -0
- package/cpp/ggml-metal/ggml-metal-ops.h +82 -0
- package/cpp/ggml-metal/ggml-metal.cpp +718 -0
- package/cpp/ggml-metal/ggml-whisper-sim.metallib +0 -0
- package/cpp/ggml-metal/ggml-whisper.metallib +0 -0
- package/cpp/ggml-metal-impl.h +90 -51
- package/cpp/ggml-metal.h +1 -6
- package/cpp/ggml-opt.cpp +97 -41
- package/cpp/ggml-opt.h +25 -6
- package/cpp/ggml-quants.c +111 -16
- package/cpp/ggml-quants.h +6 -0
- package/cpp/ggml.c +486 -98
- package/cpp/ggml.h +221 -16
- package/cpp/gguf.cpp +8 -1
- package/cpp/jsi/RNWhisperJSI.cpp +25 -6
- package/cpp/jsi/ThreadPool.h +3 -3
- package/cpp/whisper.cpp +100 -76
- package/cpp/whisper.h +1 -0
- package/ios/CMakeLists.txt +6 -1
- package/ios/RNWhisper.mm +6 -6
- package/ios/RNWhisperContext.mm +2 -0
- package/ios/RNWhisperVadContext.mm +16 -13
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-common.h +17 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-impl.h +119 -9
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-metal-impl.h +90 -51
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-opt.h +25 -6
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-quants.h +6 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml.h +221 -16
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/rnwhisper +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-common.h +17 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-impl.h +119 -9
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal-impl.h +90 -51
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-opt.h +25 -6
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-quants.h +6 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h +221 -16
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/_CodeSignature/CodeResources +1 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/ggml-whisper-sim.metallib +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/rnwhisper +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-common.h +17 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-impl.h +119 -9
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-metal-impl.h +90 -51
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-opt.h +25 -6
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-quants.h +6 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml.h +221 -16
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/rnwhisper +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-common.h +17 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-impl.h +119 -9
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal-impl.h +90 -51
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-opt.h +25 -6
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-quants.h +6 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h +221 -16
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/_CodeSignature/CodeResources +1 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/ggml-whisper-sim.metallib +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/rnwhisper +0 -0
- package/lib/commonjs/realtime-transcription/RealtimeTranscriber.js +13 -0
- package/lib/commonjs/realtime-transcription/RealtimeTranscriber.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/realtime-transcription/RealtimeTranscriber.js +13 -0
- package/lib/module/realtime-transcription/RealtimeTranscriber.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/realtime-transcription/RealtimeTranscriber.d.ts.map +1 -1
- package/lib/typescript/realtime-transcription/types.d.ts +6 -0
- package/lib/typescript/realtime-transcription/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/realtime-transcription/RealtimeTranscriber.ts +17 -0
- package/src/realtime-transcription/types.ts +6 -0
- package/src/version.json +1 -1
- package/whisper-rn.podspec +8 -9
- package/cpp/ggml-metal.m +0 -6284
- package/cpp/ggml-whisper-sim.metallib +0 -0
- package/cpp/ggml-whisper.metallib +0 -0
package/cpp/ggml-backend-impl.h
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
extern "C" {
|
|
9
9
|
#endif
|
|
10
10
|
|
|
11
|
-
#define WSP_GGML_BACKEND_API_VERSION
|
|
11
|
+
#define WSP_GGML_BACKEND_API_VERSION 2
|
|
12
12
|
|
|
13
13
|
//
|
|
14
14
|
// Backend buffer type
|
|
@@ -114,6 +114,9 @@ extern "C" {
|
|
|
114
114
|
void (*event_record)(wsp_ggml_backend_t backend, wsp_ggml_backend_event_t event);
|
|
115
115
|
// wait for an event on on a different stream
|
|
116
116
|
void (*event_wait) (wsp_ggml_backend_t backend, wsp_ggml_backend_event_t event);
|
|
117
|
+
|
|
118
|
+
// (optional) sort/optimize the nodes in the graph
|
|
119
|
+
void (*graph_optimize) (wsp_ggml_backend_t backend, struct wsp_ggml_cgraph * cgraph);
|
|
117
120
|
};
|
|
118
121
|
|
|
119
122
|
struct wsp_ggml_backend {
|
package/cpp/ggml-backend-reg.cpp
CHANGED
|
@@ -45,6 +45,14 @@
|
|
|
45
45
|
#include "ggml-vulkan.h"
|
|
46
46
|
#endif
|
|
47
47
|
|
|
48
|
+
#ifdef WSP_GGML_USE_WEBGPU
|
|
49
|
+
#include "ggml-webgpu.h"
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
#ifdef WSP_GGML_USE_ZDNN
|
|
53
|
+
#include "ggml-zdnn.h"
|
|
54
|
+
#endif
|
|
55
|
+
|
|
48
56
|
#ifdef WSP_GGML_USE_OPENCL
|
|
49
57
|
#include "ggml-opencl.h"
|
|
50
58
|
#endif
|
|
@@ -61,10 +69,6 @@
|
|
|
61
69
|
#include "ggml-cann.h"
|
|
62
70
|
#endif
|
|
63
71
|
|
|
64
|
-
#ifdef WSP_GGML_USE_KOMPUTE
|
|
65
|
-
#include "ggml-kompute.h"
|
|
66
|
-
#endif
|
|
67
|
-
|
|
68
72
|
// disable C++17 deprecation warning for std::codecvt_utf8
|
|
69
73
|
#if defined(__clang__)
|
|
70
74
|
# pragma clang diagnostic push
|
|
@@ -131,6 +135,10 @@ static void * dl_get_sym(dl_handle * handle, const char * name) {
|
|
|
131
135
|
return p;
|
|
132
136
|
}
|
|
133
137
|
|
|
138
|
+
static const char * dl_error() {
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
|
|
134
142
|
#else
|
|
135
143
|
|
|
136
144
|
using dl_handle = void;
|
|
@@ -151,6 +159,11 @@ static void * dl_get_sym(dl_handle * handle, const char * name) {
|
|
|
151
159
|
return dlsym(handle, name);
|
|
152
160
|
}
|
|
153
161
|
|
|
162
|
+
static const char * dl_error() {
|
|
163
|
+
const char *rslt = dlerror();
|
|
164
|
+
return rslt != nullptr ? rslt : "";
|
|
165
|
+
}
|
|
166
|
+
|
|
154
167
|
#endif
|
|
155
168
|
|
|
156
169
|
using dl_handle_ptr = std::unique_ptr<dl_handle, dl_handle_deleter>;
|
|
@@ -177,6 +190,12 @@ struct wsp_ggml_backend_registry {
|
|
|
177
190
|
#ifdef WSP_GGML_USE_VULKAN
|
|
178
191
|
register_backend(wsp_ggml_backend_vk_reg());
|
|
179
192
|
#endif
|
|
193
|
+
#ifdef WSP_GGML_USE_WEBGPU
|
|
194
|
+
register_backend(wsp_ggml_backend_webgpu_reg());
|
|
195
|
+
#endif
|
|
196
|
+
#ifdef WSP_GGML_USE_ZDNN
|
|
197
|
+
register_backend(wsp_ggml_backend_zdnn_reg());
|
|
198
|
+
#endif
|
|
180
199
|
#ifdef WSP_GGML_USE_OPENCL
|
|
181
200
|
register_backend(wsp_ggml_backend_opencl_reg());
|
|
182
201
|
#endif
|
|
@@ -189,9 +208,6 @@ struct wsp_ggml_backend_registry {
|
|
|
189
208
|
#ifdef WSP_GGML_USE_RPC
|
|
190
209
|
register_backend(wsp_ggml_backend_rpc_reg());
|
|
191
210
|
#endif
|
|
192
|
-
#ifdef WSP_GGML_USE_KOMPUTE
|
|
193
|
-
register_backend(wsp_ggml_backend_kompute_reg());
|
|
194
|
-
#endif
|
|
195
211
|
#ifdef WSP_GGML_USE_CPU
|
|
196
212
|
register_backend(wsp_ggml_backend_cpu_reg());
|
|
197
213
|
#endif
|
|
@@ -233,7 +249,7 @@ struct wsp_ggml_backend_registry {
|
|
|
233
249
|
dl_handle_ptr handle { dl_load_library(path) };
|
|
234
250
|
if (!handle) {
|
|
235
251
|
if (!silent) {
|
|
236
|
-
WSP_GGML_LOG_ERROR("%s: failed to load %s\n", __func__, path_str(path).c_str());
|
|
252
|
+
WSP_GGML_LOG_ERROR("%s: failed to load %s: %s\n", __func__, path_str(path).c_str(), dl_error());
|
|
237
253
|
}
|
|
238
254
|
return nullptr;
|
|
239
255
|
}
|
|
@@ -393,9 +409,8 @@ wsp_ggml_backend_t wsp_ggml_backend_init_by_type(enum wsp_ggml_backend_dev_type
|
|
|
393
409
|
|
|
394
410
|
wsp_ggml_backend_t wsp_ggml_backend_init_best(void) {
|
|
395
411
|
wsp_ggml_backend_dev_t dev = wsp_ggml_backend_dev_by_type(WSP_GGML_BACKEND_DEVICE_TYPE_GPU);
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
412
|
+
dev = dev ? dev : wsp_ggml_backend_dev_by_type(WSP_GGML_BACKEND_DEVICE_TYPE_IGPU);
|
|
413
|
+
dev = dev ? dev : wsp_ggml_backend_dev_by_type(WSP_GGML_BACKEND_DEVICE_TYPE_CPU);
|
|
399
414
|
if (!dev) {
|
|
400
415
|
return nullptr;
|
|
401
416
|
}
|
|
@@ -498,6 +513,9 @@ static wsp_ggml_backend_reg_t wsp_ggml_backend_load_best(const char * name, bool
|
|
|
498
513
|
|
|
499
514
|
std::vector<fs::path> search_paths;
|
|
500
515
|
if (user_search_path == nullptr) {
|
|
516
|
+
#ifdef WSP_GGML_BACKEND_DIR
|
|
517
|
+
search_paths.push_back(fs::u8path(WSP_GGML_BACKEND_DIR));
|
|
518
|
+
#endif
|
|
501
519
|
// default search paths: executable directory, current directory
|
|
502
520
|
search_paths.push_back(get_executable_path());
|
|
503
521
|
search_paths.push_back(fs::current_path());
|
|
@@ -521,7 +539,7 @@ static wsp_ggml_backend_reg_t wsp_ggml_backend_load_best(const char * name, bool
|
|
|
521
539
|
if (filename.native().find(file_prefix) == 0 && ext == file_extension) {
|
|
522
540
|
dl_handle_ptr handle { dl_load_library(entry) };
|
|
523
541
|
if (!handle && !silent) {
|
|
524
|
-
WSP_GGML_LOG_ERROR("%s: failed to load %s\n", __func__, path_str(entry.path()).c_str());
|
|
542
|
+
WSP_GGML_LOG_ERROR("%s: failed to load %s: %s\n", __func__, path_str(entry.path()).c_str(), dl_error());
|
|
525
543
|
}
|
|
526
544
|
if (handle) {
|
|
527
545
|
auto score_fn = (wsp_ggml_backend_score_t) dl_get_sym(handle.get(), "wsp_ggml_backend_score");
|
|
@@ -575,7 +593,6 @@ void wsp_ggml_backend_load_all_from_path(const char * dir_path) {
|
|
|
575
593
|
wsp_ggml_backend_load_best("cann", silent, dir_path);
|
|
576
594
|
wsp_ggml_backend_load_best("cuda", silent, dir_path);
|
|
577
595
|
wsp_ggml_backend_load_best("hip", silent, dir_path);
|
|
578
|
-
wsp_ggml_backend_load_best("kompute", silent, dir_path);
|
|
579
596
|
wsp_ggml_backend_load_best("metal", silent, dir_path);
|
|
580
597
|
wsp_ggml_backend_load_best("rpc", silent, dir_path);
|
|
581
598
|
wsp_ggml_backend_load_best("sycl", silent, dir_path);
|