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.h
CHANGED
|
@@ -241,7 +241,16 @@
|
|
|
241
241
|
#define WSP_GGML_ROPE_TYPE_MROPE 8
|
|
242
242
|
#define WSP_GGML_ROPE_TYPE_VISION 24
|
|
243
243
|
|
|
244
|
+
#define WSP_GGML_MROPE_SECTIONS 4
|
|
245
|
+
|
|
244
246
|
#define WSP_GGML_UNUSED(x) (void)(x)
|
|
247
|
+
#ifdef __CUDACC__
|
|
248
|
+
template<typename... Args>
|
|
249
|
+
__host__ __device__ constexpr inline void wsp_ggml_unused_vars_impl(Args&&...) noexcept {}
|
|
250
|
+
#define WSP_GGML_UNUSED_VARS(...) wsp_ggml_unused_vars_impl(__VA_ARGS__)
|
|
251
|
+
#else
|
|
252
|
+
#define WSP_GGML_UNUSED_VARS(...) do { (void)sizeof((__VA_ARGS__, 0)); } while(0)
|
|
253
|
+
#endif // __CUDACC__
|
|
245
254
|
|
|
246
255
|
#define WSP_GGML_PAD(x, n) (((x) + (n) - 1) & ~((n) - 1))
|
|
247
256
|
|
|
@@ -275,19 +284,19 @@
|
|
|
275
284
|
// WSP_GGML_TENSOR_LOCALS(size_t, nb1, src1, nb);
|
|
276
285
|
//
|
|
277
286
|
#define WSP_GGML_TENSOR_LOCALS_1(type, prefix, pointer, array) \
|
|
278
|
-
const type prefix##0 = (pointer)->array[0]; \
|
|
287
|
+
const type prefix##0 = (pointer) ? (pointer)->array[0] : 0; \
|
|
279
288
|
WSP_GGML_UNUSED(prefix##0);
|
|
280
289
|
#define WSP_GGML_TENSOR_LOCALS_2(type, prefix, pointer, array) \
|
|
281
290
|
WSP_GGML_TENSOR_LOCALS_1 (type, prefix, pointer, array) \
|
|
282
|
-
const type prefix##1 = (pointer)->array[1]; \
|
|
291
|
+
const type prefix##1 = (pointer) ? (pointer)->array[1] : 0; \
|
|
283
292
|
WSP_GGML_UNUSED(prefix##1);
|
|
284
293
|
#define WSP_GGML_TENSOR_LOCALS_3(type, prefix, pointer, array) \
|
|
285
294
|
WSP_GGML_TENSOR_LOCALS_2 (type, prefix, pointer, array) \
|
|
286
|
-
const type prefix##2 = (pointer)->array[2]; \
|
|
295
|
+
const type prefix##2 = (pointer) ? (pointer)->array[2] : 0; \
|
|
287
296
|
WSP_GGML_UNUSED(prefix##2);
|
|
288
297
|
#define WSP_GGML_TENSOR_LOCALS(type, prefix, pointer, array) \
|
|
289
298
|
WSP_GGML_TENSOR_LOCALS_3 (type, prefix, pointer, array) \
|
|
290
|
-
const type prefix##3 = (pointer)->array[3]; \
|
|
299
|
+
const type prefix##3 = (pointer) ? (pointer)->array[3] : 0; \
|
|
291
300
|
WSP_GGML_UNUSED(prefix##3);
|
|
292
301
|
|
|
293
302
|
#define WSP_GGML_TENSOR_UNARY_OP_LOCALS \
|
|
@@ -304,6 +313,16 @@
|
|
|
304
313
|
WSP_GGML_TENSOR_LOCALS(int64_t, ne, dst, ne) \
|
|
305
314
|
WSP_GGML_TENSOR_LOCALS(size_t, nb, dst, nb)
|
|
306
315
|
|
|
316
|
+
#define WSP_GGML_TENSOR_TERNARY_OP_LOCALS \
|
|
317
|
+
WSP_GGML_TENSOR_LOCALS(int64_t, ne0, src0, ne) \
|
|
318
|
+
WSP_GGML_TENSOR_LOCALS(size_t, nb0, src0, nb) \
|
|
319
|
+
WSP_GGML_TENSOR_LOCALS(int64_t, ne1, src1, ne) \
|
|
320
|
+
WSP_GGML_TENSOR_LOCALS(size_t, nb1, src1, nb) \
|
|
321
|
+
WSP_GGML_TENSOR_LOCALS(int64_t, ne2, src2, ne) \
|
|
322
|
+
WSP_GGML_TENSOR_LOCALS(size_t, nb2, src2, nb) \
|
|
323
|
+
WSP_GGML_TENSOR_LOCALS(int64_t, ne, dst, ne) \
|
|
324
|
+
WSP_GGML_TENSOR_LOCALS(size_t, nb, dst, nb)
|
|
325
|
+
|
|
307
326
|
#define WSP_GGML_TENSOR_BINARY_OP_LOCALS01 \
|
|
308
327
|
WSP_GGML_TENSOR_LOCALS(int64_t, ne0, src0, ne) \
|
|
309
328
|
WSP_GGML_TENSOR_LOCALS(size_t, nb0, src0, nb) \
|
|
@@ -314,6 +333,13 @@
|
|
|
314
333
|
extern "C" {
|
|
315
334
|
#endif
|
|
316
335
|
|
|
336
|
+
// Function type used in fatal error callbacks
|
|
337
|
+
typedef void (*wsp_ggml_abort_callback_t)(const char * error_message);
|
|
338
|
+
|
|
339
|
+
// Set the abort callback (passing null will restore original abort functionality: printing a message to stdout)
|
|
340
|
+
// Returns the old callback for chaining
|
|
341
|
+
WSP_GGML_API wsp_ggml_abort_callback_t wsp_ggml_set_abort_callback(wsp_ggml_abort_callback_t callback);
|
|
342
|
+
|
|
317
343
|
WSP_GGML_NORETURN WSP_GGML_ATTRIBUTE_FORMAT(3, 4)
|
|
318
344
|
WSP_GGML_API void wsp_ggml_abort(const char * file, int line, const char * fmt, ...);
|
|
319
345
|
|
|
@@ -388,7 +414,8 @@ extern "C" {
|
|
|
388
414
|
// WSP_GGML_TYPE_IQ4_NL_4_4 = 36,
|
|
389
415
|
// WSP_GGML_TYPE_IQ4_NL_4_8 = 37,
|
|
390
416
|
// WSP_GGML_TYPE_IQ4_NL_8_8 = 38,
|
|
391
|
-
|
|
417
|
+
WSP_GGML_TYPE_MXFP4 = 39, // MXFP4 (1 block)
|
|
418
|
+
WSP_GGML_TYPE_COUNT = 40,
|
|
392
419
|
};
|
|
393
420
|
|
|
394
421
|
// precision
|
|
@@ -423,6 +450,7 @@ extern "C" {
|
|
|
423
450
|
WSP_GGML_FTYPE_MOSTLY_IQ4_XS = 22, // except 1d tensors
|
|
424
451
|
WSP_GGML_FTYPE_MOSTLY_IQ1_M = 23, // except 1d tensors
|
|
425
452
|
WSP_GGML_FTYPE_MOSTLY_BF16 = 24, // except 1d tensors
|
|
453
|
+
WSP_GGML_FTYPE_MOSTLY_MXFP4 = 25, // except 1d tensors
|
|
426
454
|
};
|
|
427
455
|
|
|
428
456
|
// available tensor operations:
|
|
@@ -431,6 +459,7 @@ extern "C" {
|
|
|
431
459
|
|
|
432
460
|
WSP_GGML_OP_DUP,
|
|
433
461
|
WSP_GGML_OP_ADD,
|
|
462
|
+
WSP_GGML_OP_ADD_ID,
|
|
434
463
|
WSP_GGML_OP_ADD1,
|
|
435
464
|
WSP_GGML_OP_ACC,
|
|
436
465
|
WSP_GGML_OP_SUB,
|
|
@@ -482,13 +511,15 @@ extern "C" {
|
|
|
482
511
|
WSP_GGML_OP_CONV_TRANSPOSE_1D,
|
|
483
512
|
WSP_GGML_OP_IM2COL,
|
|
484
513
|
WSP_GGML_OP_IM2COL_BACK,
|
|
514
|
+
WSP_GGML_OP_IM2COL_3D,
|
|
485
515
|
WSP_GGML_OP_CONV_2D,
|
|
516
|
+
WSP_GGML_OP_CONV_3D,
|
|
486
517
|
WSP_GGML_OP_CONV_2D_DW,
|
|
487
518
|
WSP_GGML_OP_CONV_TRANSPOSE_2D,
|
|
488
519
|
WSP_GGML_OP_POOL_1D,
|
|
489
520
|
WSP_GGML_OP_POOL_2D,
|
|
490
521
|
WSP_GGML_OP_POOL_2D_BACK,
|
|
491
|
-
WSP_GGML_OP_UPSCALE,
|
|
522
|
+
WSP_GGML_OP_UPSCALE,
|
|
492
523
|
WSP_GGML_OP_PAD,
|
|
493
524
|
WSP_GGML_OP_PAD_REFLECT_1D,
|
|
494
525
|
WSP_GGML_OP_ROLL,
|
|
@@ -520,6 +551,7 @@ extern "C" {
|
|
|
520
551
|
WSP_GGML_OP_CROSS_ENTROPY_LOSS,
|
|
521
552
|
WSP_GGML_OP_CROSS_ENTROPY_LOSS_BACK,
|
|
522
553
|
WSP_GGML_OP_OPT_STEP_ADAMW,
|
|
554
|
+
WSP_GGML_OP_OPT_STEP_SGD,
|
|
523
555
|
|
|
524
556
|
WSP_GGML_OP_GLU,
|
|
525
557
|
|
|
@@ -550,6 +582,9 @@ extern "C" {
|
|
|
550
582
|
WSP_GGML_GLU_OP_REGLU,
|
|
551
583
|
WSP_GGML_GLU_OP_GEGLU,
|
|
552
584
|
WSP_GGML_GLU_OP_SWIGLU,
|
|
585
|
+
WSP_GGML_GLU_OP_SWIGLU_OAI,
|
|
586
|
+
WSP_GGML_GLU_OP_GEGLU_ERF,
|
|
587
|
+
WSP_GGML_GLU_OP_GEGLU_QUICK,
|
|
553
588
|
|
|
554
589
|
WSP_GGML_GLU_OP_COUNT,
|
|
555
590
|
};
|
|
@@ -639,6 +674,9 @@ extern "C" {
|
|
|
639
674
|
|
|
640
675
|
// misc
|
|
641
676
|
|
|
677
|
+
WSP_GGML_API const char * wsp_ggml_version(void);
|
|
678
|
+
WSP_GGML_API const char * wsp_ggml_commit(void);
|
|
679
|
+
|
|
642
680
|
WSP_GGML_API void wsp_ggml_time_init(void); // call this once at the beginning of the program
|
|
643
681
|
WSP_GGML_API int64_t wsp_ggml_time_ms(void);
|
|
644
682
|
WSP_GGML_API int64_t wsp_ggml_time_us(void);
|
|
@@ -819,6 +857,13 @@ extern "C" {
|
|
|
819
857
|
struct wsp_ggml_tensor * b,
|
|
820
858
|
enum wsp_ggml_type type);
|
|
821
859
|
|
|
860
|
+
// dst[i0, i1, i2] = a[i0, i1, i2] + b[i0, ids[i1, i2]]
|
|
861
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_add_id(
|
|
862
|
+
struct wsp_ggml_context * ctx,
|
|
863
|
+
struct wsp_ggml_tensor * a,
|
|
864
|
+
struct wsp_ggml_tensor * b,
|
|
865
|
+
struct wsp_ggml_tensor * ids);
|
|
866
|
+
|
|
822
867
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_add1(
|
|
823
868
|
struct wsp_ggml_context * ctx,
|
|
824
869
|
struct wsp_ggml_tensor * a,
|
|
@@ -1137,6 +1182,22 @@ extern "C" {
|
|
|
1137
1182
|
struct wsp_ggml_context * ctx,
|
|
1138
1183
|
struct wsp_ggml_tensor * a);
|
|
1139
1184
|
|
|
1185
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_geglu_erf(
|
|
1186
|
+
struct wsp_ggml_context * ctx,
|
|
1187
|
+
struct wsp_ggml_tensor * a);
|
|
1188
|
+
|
|
1189
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_geglu_erf_swapped(
|
|
1190
|
+
struct wsp_ggml_context * ctx,
|
|
1191
|
+
struct wsp_ggml_tensor * a);
|
|
1192
|
+
|
|
1193
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_geglu_quick(
|
|
1194
|
+
struct wsp_ggml_context * ctx,
|
|
1195
|
+
struct wsp_ggml_tensor * a);
|
|
1196
|
+
|
|
1197
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_geglu_quick_swapped(
|
|
1198
|
+
struct wsp_ggml_context * ctx,
|
|
1199
|
+
struct wsp_ggml_tensor * a);
|
|
1200
|
+
|
|
1140
1201
|
// A: n columns, r rows,
|
|
1141
1202
|
// B: n columns, r rows,
|
|
1142
1203
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_glu_split(
|
|
@@ -1160,6 +1221,23 @@ extern "C" {
|
|
|
1160
1221
|
struct wsp_ggml_tensor * a,
|
|
1161
1222
|
struct wsp_ggml_tensor * b);
|
|
1162
1223
|
|
|
1224
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_geglu_erf_split(
|
|
1225
|
+
struct wsp_ggml_context * ctx,
|
|
1226
|
+
struct wsp_ggml_tensor * a,
|
|
1227
|
+
struct wsp_ggml_tensor * b);
|
|
1228
|
+
|
|
1229
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_geglu_quick_split(
|
|
1230
|
+
struct wsp_ggml_context * ctx,
|
|
1231
|
+
struct wsp_ggml_tensor * a,
|
|
1232
|
+
struct wsp_ggml_tensor * b);
|
|
1233
|
+
|
|
1234
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_swiglu_oai(
|
|
1235
|
+
struct wsp_ggml_context * ctx,
|
|
1236
|
+
struct wsp_ggml_tensor * a,
|
|
1237
|
+
struct wsp_ggml_tensor * b,
|
|
1238
|
+
float alpha,
|
|
1239
|
+
float limit);
|
|
1240
|
+
|
|
1163
1241
|
// normalize along rows
|
|
1164
1242
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_norm(
|
|
1165
1243
|
struct wsp_ggml_context * ctx,
|
|
@@ -1259,6 +1337,19 @@ extern "C" {
|
|
|
1259
1337
|
struct wsp_ggml_tensor * a,
|
|
1260
1338
|
float s);
|
|
1261
1339
|
|
|
1340
|
+
// x = s * a + b
|
|
1341
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_scale_bias(
|
|
1342
|
+
struct wsp_ggml_context * ctx,
|
|
1343
|
+
struct wsp_ggml_tensor * a,
|
|
1344
|
+
float s,
|
|
1345
|
+
float b);
|
|
1346
|
+
|
|
1347
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_scale_bias_inplace(
|
|
1348
|
+
struct wsp_ggml_context * ctx,
|
|
1349
|
+
struct wsp_ggml_tensor * a,
|
|
1350
|
+
float s,
|
|
1351
|
+
float b);
|
|
1352
|
+
|
|
1262
1353
|
// b -> view(a,offset,nb1,nb2,3), return modified a
|
|
1263
1354
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_set(
|
|
1264
1355
|
struct wsp_ggml_context * ctx,
|
|
@@ -1313,6 +1404,7 @@ extern "C" {
|
|
|
1313
1404
|
struct wsp_ggml_tensor * a,
|
|
1314
1405
|
struct wsp_ggml_tensor * b);
|
|
1315
1406
|
|
|
1407
|
+
// note: casting from f32 to i32 will discard the fractional part
|
|
1316
1408
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_cast(
|
|
1317
1409
|
struct wsp_ggml_context * ctx,
|
|
1318
1410
|
struct wsp_ggml_tensor * a,
|
|
@@ -1437,7 +1529,11 @@ extern "C" {
|
|
|
1437
1529
|
struct wsp_ggml_context * ctx,
|
|
1438
1530
|
struct wsp_ggml_tensor * a);
|
|
1439
1531
|
|
|
1440
|
-
// supports
|
|
1532
|
+
// supports 4D a:
|
|
1533
|
+
// a [n_embd, ne1, ne2, ne3]
|
|
1534
|
+
// b I32 [n_rows, ne2, ne3, 1]
|
|
1535
|
+
//
|
|
1536
|
+
// return [n_embd, n_rows, ne2, ne3]
|
|
1441
1537
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_get_rows(
|
|
1442
1538
|
struct wsp_ggml_context * ctx,
|
|
1443
1539
|
struct wsp_ggml_tensor * a, // data
|
|
@@ -1503,8 +1599,14 @@ extern "C" {
|
|
|
1503
1599
|
struct wsp_ggml_context * ctx,
|
|
1504
1600
|
struct wsp_ggml_tensor * a);
|
|
1505
1601
|
|
|
1602
|
+
// a [ne0, ne01, ne02, ne03]
|
|
1603
|
+
// mask [ne0, ne11, ne12, ne13] | ne11 >= ne01, F16 or F32, optional
|
|
1604
|
+
//
|
|
1605
|
+
// broadcast:
|
|
1606
|
+
// ne02 % ne12 == 0
|
|
1607
|
+
// ne03 % ne13 == 0
|
|
1608
|
+
//
|
|
1506
1609
|
// fused soft_max(a*scale + mask*(ALiBi slope))
|
|
1507
|
-
// mask is optional
|
|
1508
1610
|
// max_bias = 0.0f for no ALiBi
|
|
1509
1611
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_soft_max_ext(
|
|
1510
1612
|
struct wsp_ggml_context * ctx,
|
|
@@ -1513,6 +1615,10 @@ extern "C" {
|
|
|
1513
1615
|
float scale,
|
|
1514
1616
|
float max_bias);
|
|
1515
1617
|
|
|
1618
|
+
WSP_GGML_API void wsp_ggml_soft_max_add_sinks(
|
|
1619
|
+
struct wsp_ggml_tensor * a,
|
|
1620
|
+
struct wsp_ggml_tensor * sinks);
|
|
1621
|
+
|
|
1516
1622
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_soft_max_ext_back(
|
|
1517
1623
|
struct wsp_ggml_context * ctx,
|
|
1518
1624
|
struct wsp_ggml_tensor * a,
|
|
@@ -1571,7 +1677,7 @@ extern "C" {
|
|
|
1571
1677
|
struct wsp_ggml_tensor * b,
|
|
1572
1678
|
struct wsp_ggml_tensor * c,
|
|
1573
1679
|
int n_dims,
|
|
1574
|
-
int sections[
|
|
1680
|
+
int sections[WSP_GGML_MROPE_SECTIONS],
|
|
1575
1681
|
int mode,
|
|
1576
1682
|
int n_ctx_orig,
|
|
1577
1683
|
float freq_base,
|
|
@@ -1597,6 +1703,22 @@ extern "C" {
|
|
|
1597
1703
|
float beta_fast,
|
|
1598
1704
|
float beta_slow);
|
|
1599
1705
|
|
|
1706
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_rope_multi_inplace(
|
|
1707
|
+
struct wsp_ggml_context * ctx,
|
|
1708
|
+
struct wsp_ggml_tensor * a,
|
|
1709
|
+
struct wsp_ggml_tensor * b,
|
|
1710
|
+
struct wsp_ggml_tensor * c,
|
|
1711
|
+
int n_dims,
|
|
1712
|
+
int sections[WSP_GGML_MROPE_SECTIONS],
|
|
1713
|
+
int mode,
|
|
1714
|
+
int n_ctx_orig,
|
|
1715
|
+
float freq_base,
|
|
1716
|
+
float freq_scale,
|
|
1717
|
+
float ext_factor,
|
|
1718
|
+
float attn_factor,
|
|
1719
|
+
float beta_fast,
|
|
1720
|
+
float beta_slow);
|
|
1721
|
+
|
|
1600
1722
|
WSP_GGML_DEPRECATED(WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_rope_custom(
|
|
1601
1723
|
struct wsp_ggml_context * ctx,
|
|
1602
1724
|
struct wsp_ggml_tensor * a,
|
|
@@ -1754,6 +1876,41 @@ extern "C" {
|
|
|
1754
1876
|
int d0, // dilation dimension 0
|
|
1755
1877
|
int d1); // dilation dimension 1
|
|
1756
1878
|
|
|
1879
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_im2col_3d(
|
|
1880
|
+
struct wsp_ggml_context * ctx,
|
|
1881
|
+
struct wsp_ggml_tensor * a,
|
|
1882
|
+
struct wsp_ggml_tensor * b,
|
|
1883
|
+
int64_t IC,
|
|
1884
|
+
int s0, // stride width
|
|
1885
|
+
int s1, // stride height
|
|
1886
|
+
int s2, // stride depth
|
|
1887
|
+
int p0, // padding width
|
|
1888
|
+
int p1, // padding height
|
|
1889
|
+
int p2, // padding depth
|
|
1890
|
+
int d0, // dilation width
|
|
1891
|
+
int d1, // dilation height
|
|
1892
|
+
int d2, // dilation depth
|
|
1893
|
+
enum wsp_ggml_type dst_type);
|
|
1894
|
+
|
|
1895
|
+
// a: [OC*IC, KD, KH, KW]
|
|
1896
|
+
// b: [N*IC, ID, IH, IW]
|
|
1897
|
+
// result: [N*OC, OD, OH, OW]
|
|
1898
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_conv_3d(
|
|
1899
|
+
struct wsp_ggml_context * ctx,
|
|
1900
|
+
struct wsp_ggml_tensor * a,
|
|
1901
|
+
struct wsp_ggml_tensor * b,
|
|
1902
|
+
int64_t IC,
|
|
1903
|
+
int s0, // stride width
|
|
1904
|
+
int s1, // stride height
|
|
1905
|
+
int s2, // stride depth
|
|
1906
|
+
int p0, // padding width
|
|
1907
|
+
int p1, // padding height
|
|
1908
|
+
int p2, // padding depth
|
|
1909
|
+
int d0, // dilation width
|
|
1910
|
+
int d1, // dilation height
|
|
1911
|
+
int d2 // dilation depth
|
|
1912
|
+
);
|
|
1913
|
+
|
|
1757
1914
|
// kernel size is a->ne[0] x a->ne[1]
|
|
1758
1915
|
// stride is equal to kernel size
|
|
1759
1916
|
// padding is zero
|
|
@@ -1825,6 +1982,23 @@ extern "C" {
|
|
|
1825
1982
|
int d0, // dilation dimension 0
|
|
1826
1983
|
int d1); // dilation dimension 1
|
|
1827
1984
|
|
|
1985
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_conv_3d_direct(
|
|
1986
|
+
struct wsp_ggml_context * ctx,
|
|
1987
|
+
struct wsp_ggml_tensor * a, // kernel [KW, KH, KD, IC * OC]
|
|
1988
|
+
struct wsp_ggml_tensor * b, // input [W, H, D, C * N]
|
|
1989
|
+
int s0, // stride
|
|
1990
|
+
int s1,
|
|
1991
|
+
int s2,
|
|
1992
|
+
int p0, // padding
|
|
1993
|
+
int p1,
|
|
1994
|
+
int p2,
|
|
1995
|
+
int d0, // dilation
|
|
1996
|
+
int d1,
|
|
1997
|
+
int d2,
|
|
1998
|
+
int n_channels,
|
|
1999
|
+
int n_batch,
|
|
2000
|
+
int n_channels_out);
|
|
2001
|
+
|
|
1828
2002
|
enum wsp_ggml_op_pool {
|
|
1829
2003
|
WSP_GGML_OP_POOL_MAX,
|
|
1830
2004
|
WSP_GGML_OP_POOL_AVG,
|
|
@@ -1915,6 +2089,19 @@ extern "C" {
|
|
|
1915
2089
|
int p2,
|
|
1916
2090
|
int p3);
|
|
1917
2091
|
|
|
2092
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_pad_ext(
|
|
2093
|
+
struct wsp_ggml_context * ctx,
|
|
2094
|
+
struct wsp_ggml_tensor * a,
|
|
2095
|
+
int lp0,
|
|
2096
|
+
int rp0,
|
|
2097
|
+
int lp1,
|
|
2098
|
+
int rp1,
|
|
2099
|
+
int lp2,
|
|
2100
|
+
int rp2,
|
|
2101
|
+
int lp3,
|
|
2102
|
+
int rp3
|
|
2103
|
+
);
|
|
2104
|
+
|
|
1918
2105
|
// pad each dimension with reflection: [a, b, c, d] -> [b, a, b, c, d, c]
|
|
1919
2106
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_pad_reflect_1d(
|
|
1920
2107
|
struct wsp_ggml_context * ctx,
|
|
@@ -1967,11 +2154,17 @@ extern "C" {
|
|
|
1967
2154
|
|
|
1968
2155
|
#define WSP_GGML_KQ_MASK_PAD 64
|
|
1969
2156
|
|
|
1970
|
-
// q: [n_embd_k, n_batch, n_head,
|
|
1971
|
-
// k: [n_embd_k, n_kv, n_head_kv,
|
|
1972
|
-
// v: [n_embd_v, n_kv, n_head_kv,
|
|
1973
|
-
// mask: [n_kv, n_batch_pad,
|
|
1974
|
-
// res: [n_embd_v, n_head, n_batch,
|
|
2157
|
+
// q: [n_embd_k, n_batch, n_head, ne3 ]
|
|
2158
|
+
// k: [n_embd_k, n_kv, n_head_kv, ne3 ]
|
|
2159
|
+
// v: [n_embd_v, n_kv, n_head_kv, ne3 ] !! not transposed !!
|
|
2160
|
+
// mask: [n_kv, n_batch_pad, ne32, ne33] !! n_batch_pad = WSP_GGML_PAD(n_batch, WSP_GGML_KQ_MASK_PAD) !!
|
|
2161
|
+
// res: [n_embd_v, n_head, n_batch, ne3 ] !! permuted !!
|
|
2162
|
+
//
|
|
2163
|
+
// broadcast:
|
|
2164
|
+
// n_head % n_head_kv == 0
|
|
2165
|
+
// n_head % ne32 == 0
|
|
2166
|
+
// ne3 % ne33 == 0
|
|
2167
|
+
//
|
|
1975
2168
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_flash_attn_ext(
|
|
1976
2169
|
struct wsp_ggml_context * ctx,
|
|
1977
2170
|
struct wsp_ggml_tensor * q,
|
|
@@ -1989,6 +2182,10 @@ extern "C" {
|
|
|
1989
2182
|
WSP_GGML_API enum wsp_ggml_prec wsp_ggml_flash_attn_ext_get_prec(
|
|
1990
2183
|
const struct wsp_ggml_tensor * a);
|
|
1991
2184
|
|
|
2185
|
+
WSP_GGML_API void wsp_ggml_flash_attn_ext_add_sinks(
|
|
2186
|
+
struct wsp_ggml_tensor * a,
|
|
2187
|
+
struct wsp_ggml_tensor * sinks);
|
|
2188
|
+
|
|
1992
2189
|
// TODO: needs to be adapted to wsp_ggml_flash_attn_ext
|
|
1993
2190
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_flash_attn_back(
|
|
1994
2191
|
struct wsp_ggml_context * ctx,
|
|
@@ -2010,7 +2207,8 @@ extern "C" {
|
|
|
2010
2207
|
struct wsp_ggml_tensor * dt,
|
|
2011
2208
|
struct wsp_ggml_tensor * A,
|
|
2012
2209
|
struct wsp_ggml_tensor * B,
|
|
2013
|
-
struct wsp_ggml_tensor * C
|
|
2210
|
+
struct wsp_ggml_tensor * C,
|
|
2211
|
+
struct wsp_ggml_tensor * ids);
|
|
2014
2212
|
|
|
2015
2213
|
// partition into non-overlapping windows with padding if needed
|
|
2016
2214
|
// example:
|
|
@@ -2193,7 +2391,14 @@ extern "C" {
|
|
|
2193
2391
|
struct wsp_ggml_tensor * grad,
|
|
2194
2392
|
struct wsp_ggml_tensor * m,
|
|
2195
2393
|
struct wsp_ggml_tensor * v,
|
|
2196
|
-
struct wsp_ggml_tensor * adamw_params); // parameters such
|
|
2394
|
+
struct wsp_ggml_tensor * adamw_params); // parameters such as the learning rate
|
|
2395
|
+
|
|
2396
|
+
// stochastic gradient descent step (with weight decay)
|
|
2397
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_opt_step_sgd(
|
|
2398
|
+
struct wsp_ggml_context * ctx,
|
|
2399
|
+
struct wsp_ggml_tensor * a,
|
|
2400
|
+
struct wsp_ggml_tensor * grad,
|
|
2401
|
+
struct wsp_ggml_tensor * sgd_params); // alpha, weight decay
|
|
2197
2402
|
|
|
2198
2403
|
//
|
|
2199
2404
|
// automatic differentiation
|
package/cpp/gguf.cpp
CHANGED
|
@@ -631,7 +631,14 @@ struct wsp_gguf_context * wsp_gguf_init_from_file_impl(FILE * file, struct wsp_g
|
|
|
631
631
|
wsp_gguf_free(ctx);
|
|
632
632
|
return nullptr;
|
|
633
633
|
}
|
|
634
|
-
|
|
634
|
+
size_t padded_size = WSP_GGML_PAD(wsp_ggml_nbytes(&ti.t), ctx->alignment);
|
|
635
|
+
if (SIZE_MAX - ctx->size < padded_size) {
|
|
636
|
+
WSP_GGML_LOG_ERROR("%s: tensor '%s' size overflow, cannot accumulate size %zu + %zu\n",
|
|
637
|
+
__func__, ti.t.name, ctx->size, padded_size);
|
|
638
|
+
wsp_gguf_free(ctx);
|
|
639
|
+
return nullptr;
|
|
640
|
+
}
|
|
641
|
+
ctx->size += padded_size;
|
|
635
642
|
}
|
|
636
643
|
}
|
|
637
644
|
|
package/cpp/jsi/RNWhisperJSI.cpp
CHANGED
|
@@ -17,6 +17,8 @@ using namespace facebook::jsi;
|
|
|
17
17
|
|
|
18
18
|
namespace rnwhisper_jsi {
|
|
19
19
|
|
|
20
|
+
using namespace facebook::jsi;
|
|
21
|
+
|
|
20
22
|
// Consolidated logging function
|
|
21
23
|
enum class LogLevel { LOG_DEBUG, LOG_INFO, LOG_ERROR };
|
|
22
24
|
|
|
@@ -548,9 +550,14 @@ void installJSIBindings(
|
|
|
548
550
|
logError("Failed to create job for transcription");
|
|
549
551
|
code = -2;
|
|
550
552
|
} else {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
553
|
+
try {
|
|
554
|
+
code = whisper_full(context, job->params, audioResult.data.data(), audioResult.count);
|
|
555
|
+
if (job->is_aborted()) {
|
|
556
|
+
code = -999;
|
|
557
|
+
}
|
|
558
|
+
} catch (...) {
|
|
559
|
+
logError("Exception during whisper_full transcription");
|
|
560
|
+
code = -3;
|
|
554
561
|
}
|
|
555
562
|
rnwhisper::job_remove(callbackInfo.jobId);
|
|
556
563
|
}
|
|
@@ -567,6 +574,7 @@ void installJSIBindings(
|
|
|
567
574
|
resolvePtr->call(runtime, resultObj);
|
|
568
575
|
} else {
|
|
569
576
|
std::string errorMsg = (code == -2) ? "Failed to create transcription job" :
|
|
577
|
+
(code == -3) ? "Transcription failed with exception" :
|
|
570
578
|
(code == -999) ? "Transcription was aborted" :
|
|
571
579
|
"Transcription failed";
|
|
572
580
|
auto errorObj = createErrorObject(runtime, errorMsg, code);
|
|
@@ -631,9 +639,20 @@ void installJSIBindings(
|
|
|
631
639
|
logInfo("Starting whisper_vad_detect_speech: vadContext=%p, audioDataCount=%d",
|
|
632
640
|
vadContext, audioResult.count);
|
|
633
641
|
|
|
634
|
-
// Perform VAD detection
|
|
635
|
-
bool isSpeech =
|
|
636
|
-
|
|
642
|
+
// Perform VAD detection with error handling
|
|
643
|
+
bool isSpeech = false;
|
|
644
|
+
try {
|
|
645
|
+
isSpeech = whisper_vad_detect_speech(vadContext, audioResult.data.data(), audioResult.count);
|
|
646
|
+
logInfo("VAD detection result: %s", isSpeech ? "speech" : "no speech");
|
|
647
|
+
} catch (...) {
|
|
648
|
+
logError("Exception during whisper_vad_detect_speech");
|
|
649
|
+
callInvoker->invokeAsync([rejectPtr, safeRuntime]() {
|
|
650
|
+
auto& runtime = *safeRuntime;
|
|
651
|
+
auto errorObj = createErrorObject(runtime, "VAD detection failed with exception");
|
|
652
|
+
rejectPtr->call(runtime, errorObj);
|
|
653
|
+
});
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
637
656
|
|
|
638
657
|
struct whisper_vad_params vad_params = vadParams;
|
|
639
658
|
|
package/cpp/jsi/ThreadPool.h
CHANGED
|
@@ -18,7 +18,7 @@ public:
|
|
|
18
18
|
ThreadPool(size_t);
|
|
19
19
|
template<class F, class... Args>
|
|
20
20
|
auto enqueue(F&& f, Args&&... args)
|
|
21
|
-
-> std::future<
|
|
21
|
+
-> std::future<std::invoke_result_t<F, Args...>>;
|
|
22
22
|
~ThreadPool();
|
|
23
23
|
private:
|
|
24
24
|
// need to keep track of threads so we can join them
|
|
@@ -63,9 +63,9 @@ inline ThreadPool::ThreadPool(size_t threads)
|
|
|
63
63
|
// add new work item to the pool
|
|
64
64
|
template<class F, class... Args>
|
|
65
65
|
auto ThreadPool::enqueue(F&& f, Args&&... args)
|
|
66
|
-
-> std::future<
|
|
66
|
+
-> std::future<std::invoke_result_t<F, Args...>>
|
|
67
67
|
{
|
|
68
|
-
using return_type =
|
|
68
|
+
using return_type = std::invoke_result_t<F, Args...>;
|
|
69
69
|
|
|
70
70
|
auto task = std::make_shared< std::packaged_task<return_type()> >(
|
|
71
71
|
std::bind(std::forward<F>(f), std::forward<Args>(args)...)
|