whisper.rn 0.5.2 → 0.5.4
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 +1 -1
- package/cpp/ggml-alloc.c +11 -4
- package/cpp/ggml-backend-reg.cpp +8 -0
- package/cpp/ggml-backend.cpp +0 -2
- package/cpp/ggml-cpu/arch/arm/quants.c +428 -26
- package/cpp/ggml-cpu/ggml-cpu-impl.h +3 -1
- package/cpp/ggml-cpu/ggml-cpu.c +50 -21
- package/cpp/ggml-cpu/ops.cpp +458 -349
- package/cpp/ggml-cpu/ops.h +4 -4
- package/cpp/ggml-cpu/repack.cpp +143 -29
- package/cpp/ggml-cpu/simd-mappings.h +25 -25
- package/cpp/ggml-cpu/unary-ops.cpp +16 -0
- package/cpp/ggml-cpu/unary-ops.h +2 -0
- package/cpp/ggml-cpu/vec.cpp +17 -0
- package/cpp/ggml-cpu/vec.h +10 -0
- package/cpp/ggml-impl.h +17 -1
- package/cpp/ggml-metal/ggml-metal-context.m +5 -6
- package/cpp/ggml-metal/ggml-metal-device.cpp +101 -4
- package/cpp/ggml-metal/ggml-metal-device.h +8 -1
- package/cpp/ggml-metal/ggml-metal-device.m +216 -14
- package/cpp/ggml-metal/ggml-metal-impl.h +90 -2
- package/cpp/ggml-metal/ggml-metal-ops.cpp +346 -85
- package/cpp/ggml-metal/ggml-metal-ops.h +2 -0
- package/cpp/ggml-metal/ggml-metal.cpp +5 -0
- package/cpp/ggml-metal/ggml-metal.metal +12436 -0
- package/cpp/ggml.c +154 -5
- package/cpp/ggml.h +73 -0
- package/cpp/whisper.cpp +6 -2
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-impl.h +17 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml.h +73 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/ggml-metal.metal +12436 -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-impl.h +17 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h +73 -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-metal.metal +12436 -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-impl.h +17 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml.h +73 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/ggml-metal.metal +12436 -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-impl.h +17 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h +73 -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-metal.metal +12436 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/rnwhisper +0 -0
- package/lib/commonjs/realtime-transcription/RealtimeTranscriber.js +156 -12
- package/lib/commonjs/realtime-transcription/RealtimeTranscriber.js.map +1 -1
- package/lib/module/realtime-transcription/RealtimeTranscriber.js +155 -12
- package/lib/module/realtime-transcription/RealtimeTranscriber.js.map +1 -1
- package/lib/typescript/realtime-transcription/RealtimeTranscriber.d.ts +29 -0
- package/lib/typescript/realtime-transcription/RealtimeTranscriber.d.ts.map +1 -1
- package/lib/typescript/realtime-transcription/types.d.ts +7 -0
- package/lib/typescript/realtime-transcription/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/realtime-transcription/RealtimeTranscriber.ts +179 -9
- package/src/realtime-transcription/types.ts +9 -0
- package/whisper-rn.podspec +1 -1
- package/cpp/ggml-metal/ggml-whisper-sim.metallib +0 -0
- package/cpp/ggml-metal/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/ggml-whisper-sim.metallib +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/ggml-whisper-sim.metallib +0 -0
package/cpp/ggml-cpu/ggml-cpu.c
CHANGED
|
@@ -1613,13 +1613,8 @@ static void wsp_ggml_compute_forward_mul_mat_id(
|
|
|
1613
1613
|
chunk_size = 64;
|
|
1614
1614
|
}
|
|
1615
1615
|
|
|
1616
|
-
#if defined(__aarch64__)
|
|
1617
|
-
// disable for ARM
|
|
1618
|
-
const bool disable_chunking = true;
|
|
1619
|
-
#else
|
|
1620
1616
|
// disable for NUMA
|
|
1621
1617
|
const bool disable_chunking = wsp_ggml_is_numa();
|
|
1622
|
-
#endif // defined(__aarch64__)
|
|
1623
1618
|
|
|
1624
1619
|
int64_t nchunk0 = (nr0 + chunk_size - 1) / chunk_size;
|
|
1625
1620
|
int64_t nchunk1 = (nr1 + chunk_size - 1) / chunk_size;
|
|
@@ -1736,6 +1731,10 @@ static void wsp_ggml_compute_forward(struct wsp_ggml_compute_params * params, st
|
|
|
1736
1731
|
{
|
|
1737
1732
|
wsp_ggml_compute_forward_sum_rows(params, tensor);
|
|
1738
1733
|
} break;
|
|
1734
|
+
case WSP_GGML_OP_CUMSUM:
|
|
1735
|
+
{
|
|
1736
|
+
wsp_ggml_compute_forward_cumsum(params, tensor);
|
|
1737
|
+
} break;
|
|
1739
1738
|
case WSP_GGML_OP_MEAN:
|
|
1740
1739
|
{
|
|
1741
1740
|
wsp_ggml_compute_forward_mean(params, tensor);
|
|
@@ -1812,22 +1811,6 @@ static void wsp_ggml_compute_forward(struct wsp_ggml_compute_params * params, st
|
|
|
1812
1811
|
{
|
|
1813
1812
|
wsp_ggml_compute_forward_cont(params, tensor);
|
|
1814
1813
|
} break;
|
|
1815
|
-
case WSP_GGML_OP_RESHAPE:
|
|
1816
|
-
{
|
|
1817
|
-
wsp_ggml_compute_forward_reshape(params, tensor);
|
|
1818
|
-
} break;
|
|
1819
|
-
case WSP_GGML_OP_VIEW:
|
|
1820
|
-
{
|
|
1821
|
-
wsp_ggml_compute_forward_view(params, tensor);
|
|
1822
|
-
} break;
|
|
1823
|
-
case WSP_GGML_OP_PERMUTE:
|
|
1824
|
-
{
|
|
1825
|
-
wsp_ggml_compute_forward_permute(params, tensor);
|
|
1826
|
-
} break;
|
|
1827
|
-
case WSP_GGML_OP_TRANSPOSE:
|
|
1828
|
-
{
|
|
1829
|
-
wsp_ggml_compute_forward_transpose(params, tensor);
|
|
1830
|
-
} break;
|
|
1831
1814
|
case WSP_GGML_OP_GET_ROWS:
|
|
1832
1815
|
{
|
|
1833
1816
|
wsp_ggml_compute_forward_get_rows(params, tensor);
|
|
@@ -1948,6 +1931,14 @@ static void wsp_ggml_compute_forward(struct wsp_ggml_compute_params * params, st
|
|
|
1948
1931
|
{
|
|
1949
1932
|
wsp_ggml_compute_forward_leaky_relu(params, tensor);
|
|
1950
1933
|
} break;
|
|
1934
|
+
case WSP_GGML_OP_TRI:
|
|
1935
|
+
{
|
|
1936
|
+
wsp_ggml_compute_forward_tri(params, tensor);
|
|
1937
|
+
} break;
|
|
1938
|
+
case WSP_GGML_OP_FILL:
|
|
1939
|
+
{
|
|
1940
|
+
wsp_ggml_compute_forward_fill(params, tensor);
|
|
1941
|
+
} break;
|
|
1951
1942
|
case WSP_GGML_OP_FLASH_ATTN_EXT:
|
|
1952
1943
|
{
|
|
1953
1944
|
wsp_ggml_compute_forward_flash_attn_ext(params, tensor);
|
|
@@ -2003,6 +1994,10 @@ static void wsp_ggml_compute_forward(struct wsp_ggml_compute_params * params, st
|
|
|
2003
1994
|
{
|
|
2004
1995
|
wsp_ggml_compute_forward_rwkv_wkv7(params, tensor);
|
|
2005
1996
|
} break;
|
|
1997
|
+
case WSP_GGML_OP_SOLVE_TRI:
|
|
1998
|
+
{
|
|
1999
|
+
wsp_ggml_compute_forward_solve_tri(params, tensor);
|
|
2000
|
+
} break;
|
|
2006
2001
|
case WSP_GGML_OP_MAP_CUSTOM1:
|
|
2007
2002
|
{
|
|
2008
2003
|
wsp_ggml_compute_forward_map_custom1(params, tensor);
|
|
@@ -2047,6 +2042,22 @@ static void wsp_ggml_compute_forward(struct wsp_ggml_compute_params * params, st
|
|
|
2047
2042
|
{
|
|
2048
2043
|
// nop
|
|
2049
2044
|
} break;
|
|
2045
|
+
case WSP_GGML_OP_RESHAPE:
|
|
2046
|
+
{
|
|
2047
|
+
// nop
|
|
2048
|
+
} break;
|
|
2049
|
+
case WSP_GGML_OP_PERMUTE:
|
|
2050
|
+
{
|
|
2051
|
+
// nop
|
|
2052
|
+
} break;
|
|
2053
|
+
case WSP_GGML_OP_VIEW:
|
|
2054
|
+
{
|
|
2055
|
+
// nop
|
|
2056
|
+
} break;
|
|
2057
|
+
case WSP_GGML_OP_TRANSPOSE:
|
|
2058
|
+
{
|
|
2059
|
+
// nop
|
|
2060
|
+
} break;
|
|
2050
2061
|
case WSP_GGML_OP_COUNT:
|
|
2051
2062
|
{
|
|
2052
2063
|
WSP_GGML_ABORT("fatal error");
|
|
@@ -2145,6 +2156,9 @@ static int wsp_ggml_get_n_tasks(struct wsp_ggml_tensor * node, int n_threads) {
|
|
|
2145
2156
|
case WSP_GGML_OP_ADD_ID:
|
|
2146
2157
|
case WSP_GGML_OP_ADD1:
|
|
2147
2158
|
case WSP_GGML_OP_ACC:
|
|
2159
|
+
case WSP_GGML_OP_CUMSUM:
|
|
2160
|
+
case WSP_GGML_OP_TRI:
|
|
2161
|
+
case WSP_GGML_OP_FILL:
|
|
2148
2162
|
{
|
|
2149
2163
|
n_tasks = n_threads;
|
|
2150
2164
|
} break;
|
|
@@ -2162,6 +2176,7 @@ static int wsp_ggml_get_n_tasks(struct wsp_ggml_tensor * node, int n_threads) {
|
|
|
2162
2176
|
n_tasks = 1;
|
|
2163
2177
|
} break;
|
|
2164
2178
|
case WSP_GGML_OP_COUNT_EQUAL:
|
|
2179
|
+
case WSP_GGML_OP_SOLVE_TRI:
|
|
2165
2180
|
{
|
|
2166
2181
|
n_tasks = n_threads;
|
|
2167
2182
|
} break;
|
|
@@ -2184,6 +2199,8 @@ static int wsp_ggml_get_n_tasks(struct wsp_ggml_tensor * node, int n_threads) {
|
|
|
2184
2199
|
case WSP_GGML_UNARY_OP_HARDSWISH:
|
|
2185
2200
|
case WSP_GGML_UNARY_OP_HARDSIGMOID:
|
|
2186
2201
|
case WSP_GGML_UNARY_OP_EXP:
|
|
2202
|
+
case WSP_GGML_UNARY_OP_SOFTPLUS:
|
|
2203
|
+
case WSP_GGML_UNARY_OP_EXPM1:
|
|
2187
2204
|
case WSP_GGML_UNARY_OP_FLOOR:
|
|
2188
2205
|
case WSP_GGML_UNARY_OP_CEIL:
|
|
2189
2206
|
case WSP_GGML_UNARY_OP_ROUND:
|
|
@@ -2889,6 +2906,11 @@ static thread_ret_t wsp_ggml_graph_compute_thread(void * data) {
|
|
|
2889
2906
|
for (int node_n = 0; node_n < cgraph->n_nodes && atomic_load_explicit(&tp->abort, memory_order_relaxed) != node_n; node_n++) {
|
|
2890
2907
|
struct wsp_ggml_tensor * node = cgraph->nodes[node_n];
|
|
2891
2908
|
|
|
2909
|
+
if (wsp_ggml_op_is_empty(node->op)) {
|
|
2910
|
+
// skip NOPs
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2892
2914
|
wsp_ggml_compute_forward(¶ms, node);
|
|
2893
2915
|
|
|
2894
2916
|
if (state->ith == 0 && cplan->abort_callback &&
|
|
@@ -3274,6 +3296,13 @@ void wsp_ggml_cpu_fp16_to_fp32(const wsp_ggml_fp16_t * x, float * y, int64_t n)
|
|
|
3274
3296
|
__m128 y_vec = _mm_cvtph_ps(x_vec);
|
|
3275
3297
|
_mm_storeu_ps(y + i, y_vec);
|
|
3276
3298
|
}
|
|
3299
|
+
#elif defined(__riscv_zvfh)
|
|
3300
|
+
for (int vl; i < n; i += vl) {
|
|
3301
|
+
vl = __riscv_vsetvl_e16m1(n - i);
|
|
3302
|
+
vfloat16m1_t vx = __riscv_vle16_v_f16m1((_Float16 *)&x[i], vl);
|
|
3303
|
+
vfloat32m2_t vy = __riscv_vfwcvt_f_f_v_f32m2(vx, vl);
|
|
3304
|
+
__riscv_vse32_v_f32m2(&y[i], vy, vl);
|
|
3305
|
+
}
|
|
3277
3306
|
#endif
|
|
3278
3307
|
|
|
3279
3308
|
for (; i < n; ++i) {
|