react-native-executorch 0.11.0 → 0.11.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.
Files changed (112) hide show
  1. package/android/CMakeLists.txt +13 -0
  2. package/android/build.gradle.kts +14 -3
  3. package/android/src/main/AndroidManifest.xml +6 -0
  4. package/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchModule.kt +22 -2
  5. package/cpp/core/dtype.cpp +12 -1
  6. package/cpp/core/dtype.h +2 -1
  7. package/cpp/core/install.cpp +1 -0
  8. package/cpp/core/utils.cpp +72 -21
  9. package/cpp/core/utils.h +10 -0
  10. package/cpp/extensions/cv/utils.h +1 -0
  11. package/ios/PrivacyInfo.xcprivacy +36 -0
  12. package/lib/module/constants.js +11 -0
  13. package/lib/module/constants.js.map +1 -1
  14. package/lib/module/core/lifetime.js +6 -0
  15. package/lib/module/core/lifetime.js.map +1 -1
  16. package/lib/module/core/schema.js +7 -0
  17. package/lib/module/core/schema.js.map +1 -1
  18. package/lib/module/core/tensor.js.map +1 -1
  19. package/lib/module/extensions/cv/ops/box.js +3 -3
  20. package/lib/module/extensions/cv/ops/box.js.map +1 -1
  21. package/lib/module/extensions/cv/ops/image.js +10 -14
  22. package/lib/module/extensions/cv/ops/image.js.map +1 -1
  23. package/lib/module/extensions/cv/ops/quad.js +2 -2
  24. package/lib/module/extensions/cv/ops/quad.js.map +1 -1
  25. package/lib/module/extensions/cv/tasks/sdxsTextToImage.js +11 -4
  26. package/lib/module/extensions/cv/tasks/sdxsTextToImage.js.map +1 -1
  27. package/lib/module/extensions/cv/utils/imagePreprocessor.js +3 -0
  28. package/lib/module/extensions/cv/utils/imagePreprocessor.js.map +1 -1
  29. package/lib/module/extensions/cv/utils/paddleOcrUtils.js +2 -2
  30. package/lib/module/extensions/cv/utils/paddleOcrUtils.js.map +1 -1
  31. package/lib/module/extensions/llm/sampler.js +21 -7
  32. package/lib/module/extensions/llm/sampler.js.map +1 -1
  33. package/lib/module/extensions/llm/tasks/llmChatSession.js +4 -1
  34. package/lib/module/extensions/llm/tasks/llmChatSession.js.map +1 -1
  35. package/lib/module/extensions/speech/index.js +2 -0
  36. package/lib/module/extensions/speech/index.js.map +1 -1
  37. package/lib/module/extensions/speech/tasks/fsmnVoiceActivityDetection.js +5 -2
  38. package/lib/module/extensions/speech/tasks/fsmnVoiceActivityDetection.js.map +1 -1
  39. package/lib/module/extensions/speech/tasks/reverbTextToSpeech.js +461 -0
  40. package/lib/module/extensions/speech/tasks/reverbTextToSpeech.js.map +1 -0
  41. package/lib/module/extensions/speech/utils/reverbBackbone.js +275 -0
  42. package/lib/module/extensions/speech/utils/reverbBackbone.js.map +1 -0
  43. package/lib/module/extensions/speech/utils/reverbPartitioner.js +86 -0
  44. package/lib/module/extensions/speech/utils/reverbPartitioner.js.map +1 -0
  45. package/lib/module/extensions/speech/utils/reverbUtils.js +240 -0
  46. package/lib/module/extensions/speech/utils/reverbUtils.js.map +1 -0
  47. package/lib/module/extensions/speech/utils/textPartitioner.js +1 -1
  48. package/lib/module/fetcher/telemetry.js +1 -1
  49. package/lib/module/hooks/useTextToSpeech.js +22 -1
  50. package/lib/module/hooks/useTextToSpeech.js.map +1 -1
  51. package/lib/module/index.js +1 -0
  52. package/lib/module/index.js.map +1 -1
  53. package/lib/module/models.js +391 -43
  54. package/lib/module/models.js.map +1 -1
  55. package/lib/module/native/bridge.js +18 -0
  56. package/lib/module/native/bridge.js.map +1 -1
  57. package/lib/typescript/src/constants.d.ts +10 -0
  58. package/lib/typescript/src/constants.d.ts.map +1 -1
  59. package/lib/typescript/src/core/lifetime.d.ts.map +1 -1
  60. package/lib/typescript/src/core/schema.d.ts +7 -0
  61. package/lib/typescript/src/core/schema.d.ts.map +1 -1
  62. package/lib/typescript/src/core/tensor.d.ts +7 -6
  63. package/lib/typescript/src/core/tensor.d.ts.map +1 -1
  64. package/lib/typescript/src/extensions/cv/ops/image.d.ts.map +1 -1
  65. package/lib/typescript/src/extensions/cv/tasks/sdxsTextToImage.d.ts.map +1 -1
  66. package/lib/typescript/src/extensions/cv/utils/imagePreprocessor.d.ts.map +1 -1
  67. package/lib/typescript/src/extensions/llm/sampler.d.ts.map +1 -1
  68. package/lib/typescript/src/extensions/llm/tasks/llmChatSession.d.ts.map +1 -1
  69. package/lib/typescript/src/extensions/speech/index.d.ts +2 -0
  70. package/lib/typescript/src/extensions/speech/index.d.ts.map +1 -1
  71. package/lib/typescript/src/extensions/speech/tasks/fsmnVoiceActivityDetection.d.ts.map +1 -1
  72. package/lib/typescript/src/extensions/speech/tasks/reverbTextToSpeech.d.ts +175 -0
  73. package/lib/typescript/src/extensions/speech/tasks/reverbTextToSpeech.d.ts.map +1 -0
  74. package/lib/typescript/src/extensions/speech/utils/reverbBackbone.d.ts +67 -0
  75. package/lib/typescript/src/extensions/speech/utils/reverbBackbone.d.ts.map +1 -0
  76. package/lib/typescript/src/extensions/speech/utils/reverbPartitioner.d.ts +27 -0
  77. package/lib/typescript/src/extensions/speech/utils/reverbPartitioner.d.ts.map +1 -0
  78. package/lib/typescript/src/extensions/speech/utils/reverbUtils.d.ts +83 -0
  79. package/lib/typescript/src/extensions/speech/utils/reverbUtils.d.ts.map +1 -0
  80. package/lib/typescript/src/hooks/useTextToSpeech.d.ts +30 -0
  81. package/lib/typescript/src/hooks/useTextToSpeech.d.ts.map +1 -1
  82. package/lib/typescript/src/index.d.ts +1 -0
  83. package/lib/typescript/src/index.d.ts.map +1 -1
  84. package/lib/typescript/src/models.d.ts +56 -0
  85. package/lib/typescript/src/models.d.ts.map +1 -1
  86. package/package.json +4 -3
  87. package/react-native-executorch.podspec +5 -0
  88. package/scripts/download-libs.js +31 -6
  89. package/src/constants.ts +29 -0
  90. package/src/core/lifetime.ts +3 -0
  91. package/src/core/schema.ts +7 -0
  92. package/src/core/tensor.ts +9 -6
  93. package/src/extensions/cv/ops/box.ts +3 -3
  94. package/src/extensions/cv/ops/image.ts +11 -12
  95. package/src/extensions/cv/ops/quad.ts +2 -2
  96. package/src/extensions/cv/tasks/sdxsTextToImage.ts +10 -4
  97. package/src/extensions/cv/utils/imagePreprocessor.ts +3 -0
  98. package/src/extensions/cv/utils/paddleOcrUtils.ts +2 -2
  99. package/src/extensions/llm/sampler.ts +17 -3
  100. package/src/extensions/llm/tasks/llmChatSession.ts +5 -1
  101. package/src/extensions/speech/index.ts +2 -0
  102. package/src/extensions/speech/tasks/fsmnVoiceActivityDetection.ts +7 -1
  103. package/src/extensions/speech/tasks/reverbTextToSpeech.ts +683 -0
  104. package/src/extensions/speech/utils/reverbBackbone.ts +342 -0
  105. package/src/extensions/speech/utils/reverbPartitioner.ts +95 -0
  106. package/src/extensions/speech/utils/reverbUtils.ts +251 -0
  107. package/src/extensions/speech/utils/textPartitioner.ts +1 -1
  108. package/src/fetcher/telemetry.ts +1 -1
  109. package/src/hooks/useTextToSpeech.ts +45 -3
  110. package/src/index.ts +1 -0
  111. package/src/models.ts +369 -8
  112. package/src/native/bridge.ts +21 -0
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,s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AEG;;;gBAGD,oDAAoD;;;;;;;;;CAO3D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-executorch",
3
- "version": "0.11.0",
4
- "nativeLibsVersion": "0.11.0",
3
+ "version": "0.11.1",
4
+ "nativeLibsVersion": "0.11.1",
5
5
  "description": "An easy way to run AI models in React Native with ExecuTorch",
6
6
  "main": "./lib/module/index.js",
7
7
  "module": "./lib/module/index.js",
@@ -134,13 +134,14 @@
134
134
  "jsonrepair": "^3.12.0",
135
135
  "jsonschema": "^1.5.0",
136
136
  "react-native-device-info": "^15.0.2",
137
+ "verbalis": "^0.1.1",
137
138
  "zod": "^4.3.6"
138
139
  },
139
140
  "// === LEGACY SUPPORT: peerDependencies ===": "@kesha-antonov/react-native-background-downloader is only needed for legacy API (remove when legacy is dropped)",
140
141
  "peerDependencies": {
141
142
  "@kesha-antonov/react-native-background-downloader": ">=4.4.0",
142
143
  "react": "*",
143
- "react-native": "*",
144
+ "react-native": ">=0.83.0",
144
145
  "react-native-blob-util": ">=0.24.11",
145
146
  "react-native-worklets": ">=0.10.0 <0.14.0"
146
147
  },
@@ -351,6 +351,11 @@ Pod::Spec.new do |s|
351
351
  # resource path. `s.ios.resource` achieves that via CocoaPods' resource copy.
352
352
  s.ios.resource = "third-party/ios/libs/executorch/mlx.metallib" if enable_mlx
353
353
 
354
+ # Required-reason APIs (stat/fstat in ExecutorchLib and the Core ML backend)
355
+ # and the download telemetry. The file must exist: a missing one globs to an
356
+ # empty bundle without any error.
357
+ s.resource_bundles = { "RnExecutorchPrivacyInfo" => ["ios/PrivacyInfo.xcprivacy"] }
358
+
354
359
  # An app that turns on `use_frameworks!` without naming a linkage gets the
355
360
  # default, dynamic - which is what Firebase's own setup instructions show.
356
361
  # CocoaPods then refuses to install at all, because a dynamic framework may
@@ -23,6 +23,7 @@
23
23
  * xnnpack-ios.tar.gz -- XnnpackBackend.xcframework (iOS)
24
24
  * vulkan-android-arm64-v8a.tar.gz -- libvulkan_executorch_backend.so (Android only)
25
25
  * vulkan-android-x86_64.tar.gz
26
+ * qnn-android-arm64-v8a.tar.gz -- libqnn_executorch_backend.so (Android arm64 only)
26
27
  * coreml-ios.tar.gz -- CoreMLBackend.xcframework (iOS only)
27
28
  * mlx-ios.tar.gz -- MLXBackend.xcframework + mlx.metallib (iOS only)
28
29
  *
@@ -31,16 +32,17 @@
31
32
  *
32
33
  * User configuration (in the app's package.json) — three optional arrays, all merged into a single set:
33
34
  * "react-native-executorch": {
34
- * "backends": ["xnnpack", "coreml", "mlx", "vulkan"],
35
+ * "backends": ["xnnpack", "coreml", "mlx", "vulkan", "qnn"],
35
36
  * "libs": ["opencv", "phonemis"],
36
37
  * "features": ["llm", "textToSpeech", "objectDetection"]
37
38
  * }
38
39
  *
39
40
  * `features` is sugar — each one expands to a set of backends + libs via FEATURE_MAP below.
40
- * If no `react-native-executorch` block is present, every backend and lib defaults to ON.
41
+ * If no `react-native-executorch` block is present, every backend and lib defaults to ON,
42
+ * except qnn, which is opt-in only (see below).
41
43
  *
42
44
  * Recognized values:
43
- * backends: xnnpack, coreml (iOS), mlx (iOS), vulkan (Android)
45
+ * backends: xnnpack, coreml (iOS), mlx (iOS), vulkan (Android), qnn (Android arm64)
44
46
  * libs: opencv, phonemis
45
47
  * features: llm, multimodalLLM, speechToText, textToSpeech, vad, privacyFilter,
46
48
  * textEmbeddings, imageEmbeddings,
@@ -56,6 +58,9 @@
56
58
  * coreml iOS only — toggles CoreMLBackend.xcframework.
57
59
  * mlx iOS only — toggles MLXBackend.xcframework + mlx.metallib resource.
58
60
  * vulkan Android only — toggles libvulkan_executorch_backend.so.
61
+ * qnn Android arm64 only — toggles libqnn_executorch_backend.so and the Qualcomm
62
+ * runtime (Maven com.qualcomm.qti:qnn-runtime). Opt-in: the runtime adds tens of
63
+ * MB to the APK, so an app without a config block does not get it.
59
64
  *
60
65
  * Environment variables:
61
66
  * RNET_SKIP_DOWNLOAD=1 -- skip download entirely (for CI with pre-cached libs)
@@ -112,7 +117,11 @@ const CACHE_DIR = process.env.RNET_LIBS_CACHE_DIR || DEFAULT_CACHE_DIR;
112
117
 
113
118
  // ---- User config -----------------------------------------------------------
114
119
 
115
- const ALL_BACKENDS = ['xnnpack', 'coreml', 'mlx', 'vulkan'];
120
+ const ALL_BACKENDS = ['xnnpack', 'coreml', 'mlx', 'vulkan', 'qnn'];
121
+ // What an app without a config block gets. qnn stays out: it pulls the
122
+ // Qualcomm runtime from Maven, which is far larger than any other backend and
123
+ // only pays off on Snapdragon devices.
124
+ const DEFAULT_BACKENDS = ALL_BACKENDS.filter((b) => b !== 'qnn');
116
125
  const ALL_LIBS = ['opencv', 'phonemis'];
117
126
 
118
127
  // features -> { backends, libs }
@@ -235,7 +244,11 @@ function findUserConfig() {
235
244
  }
236
245
 
237
246
  function readUserConfig() {
238
- const allOn = () => ({ backends: [...ALL_BACKENDS], libs: [...ALL_LIBS], opencvPod: undefined });
247
+ const allOn = () => ({
248
+ backends: [...DEFAULT_BACKENDS],
249
+ libs: [...ALL_LIBS],
250
+ opencvPod: undefined,
251
+ });
239
252
 
240
253
  const { config: rneConfig, manifest } = findUserConfig();
241
254
 
@@ -297,6 +310,7 @@ function writeBuildConfig({ backends, libs, opencvPod }) {
297
310
  enableCoreml: backends.includes('coreml'),
298
311
  enableMlx: backends.includes('mlx'),
299
312
  enableVulkan: backends.includes('vulkan'),
313
+ enableQnn: backends.includes('qnn'),
300
314
  };
301
315
  // Which pod provides opencv2 on iOS. Only set when the app asks for a
302
316
  // specific one; otherwise the podspec picks, preferring an OpenCV the app
@@ -325,6 +339,11 @@ function warnAboutPlatformAsymmetry({ backends }, targets) {
325
339
  '[react-native-executorch] mlx is enabled but the build targets only Android; the MLX backend is iOS-only and the flag has no effect here.'
326
340
  );
327
341
  }
342
+ if (hasIos && !hasAndroid && backends.includes('qnn')) {
343
+ console.warn(
344
+ '[react-native-executorch] qnn is enabled but the build targets only iOS; the QNN backend is Android-only and the flag has no effect here.'
345
+ );
346
+ }
328
347
  if (hasIos && !hasAndroid && backends.includes('vulkan')) {
329
348
  console.warn(
330
349
  '[react-native-executorch] vulkan is enabled but the build targets only iOS; the Vulkan backend is Android-only and the flag has no effect here.'
@@ -402,6 +421,11 @@ function getArtifacts(targets, { backends, libs }) {
402
421
  if (backends.includes('vulkan') && target.startsWith('android')) {
403
422
  artifacts.push(makeArtifact(`vulkan-${target}`, destDir));
404
423
  }
424
+
425
+ // QNN targets Snapdragon's Hexagon NPU, so it is Android arm64 only
426
+ if (backends.includes('qnn') && target === 'android-arm64-v8a') {
427
+ artifacts.push(makeArtifact(`qnn-${target}`, destDir));
428
+ }
405
429
  }
406
430
 
407
431
  return artifacts;
@@ -527,6 +551,7 @@ const BACKEND_FILES = {
527
551
  android: {
528
552
  xnnpack: ['executorch/*/libxnnpack_executorch_backend.so'],
529
553
  vulkan: ['executorch/*/libvulkan_executorch_backend.so'],
554
+ qnn: ['executorch/*/libqnn_executorch_backend.so'],
530
555
  },
531
556
  ios: {
532
557
  xnnpack: ['XnnpackBackend.xcframework'],
@@ -651,7 +676,7 @@ async function main() {
651
676
  `[react-native-executorch] Backends: [${config.backends.join(', ') || '—'}]; Libs: [${config.libs.join(', ') || '—'}]`
652
677
  );
653
678
  console.log(
654
- `[react-native-executorch] Build flags: opencv=${buildConfig.enableOpencv}, phonemis=${buildConfig.enablePhonemis}, xnnpack=${buildConfig.enableXnnpack}, coreml=${buildConfig.enableCoreml}, mlx=${buildConfig.enableMlx}, vulkan=${buildConfig.enableVulkan}`
679
+ `[react-native-executorch] Build flags: opencv=${buildConfig.enableOpencv}, phonemis=${buildConfig.enablePhonemis}, xnnpack=${buildConfig.enableXnnpack}, coreml=${buildConfig.enableCoreml}, mlx=${buildConfig.enableMlx}, vulkan=${buildConfig.enableVulkan}, qnn=${buildConfig.enableQnn}`
655
680
  );
656
681
 
657
682
  const targets = detectTargets();
package/src/constants.ts CHANGED
@@ -1335,6 +1335,35 @@ export const SUPERTONIC_DEFAULT_VOICE_NAMES = [
1335
1335
  */
1336
1336
  export type SupertonicDefaultVoiceName = (typeof SUPERTONIC_DEFAULT_VOICE_NAMES)[number];
1337
1337
 
1338
+ /**
1339
+ * Default Reverb voice names array.
1340
+ * @category Speech / Constants
1341
+ */
1342
+ export const REVERB_DEFAULT_VOICE_NAMES = [
1343
+ 'de_female_standard',
1344
+ 'de_male_standard',
1345
+ 'en_female_narrator',
1346
+ 'en_female_whisper',
1347
+ 'en_male_angry',
1348
+ 'en_male_narrator_1',
1349
+ 'en_male_narrator_2',
1350
+ 'es_male_standard_1',
1351
+ 'es_male_standard_2',
1352
+ 'fr_female_standard',
1353
+ 'fr_male_standard',
1354
+ 'it_male_expressive',
1355
+ 'it_male_standard',
1356
+ 'pl_male_standard',
1357
+ 'pt_female_standard',
1358
+ 'pt_male_standard',
1359
+ ] as const;
1360
+
1361
+ /**
1362
+ * Type representing a valid Reverb default voice name.
1363
+ * @category Speech / Types
1364
+ */
1365
+ export type ReverbDefaultVoiceName = (typeof REVERB_DEFAULT_VOICE_NAMES)[number];
1366
+
1338
1367
  // BIOES tag scheme for the privacy filter models: one outside tag ("O")
1339
1368
  // followed by four prefix variants (B/I/E/S) per entity type, in the entity
1340
1369
  // order below. The resulting arrays must match each model's id2label mapping
@@ -66,10 +66,12 @@ export type ResourceScope = {
66
66
  * ```
67
67
  */
68
68
  export function createResourceScope(): ResourceScope {
69
+ 'worklet';
69
70
  const allocated: NativeResource[] = [];
70
71
 
71
72
  return {
72
73
  track: <R extends NativeResource>(resource: R): R => {
74
+ 'worklet';
73
75
  allocated.push(resource);
74
76
  return resource;
75
77
  },
@@ -77,6 +79,7 @@ export function createResourceScope(): ResourceScope {
77
79
  // from. `splice` empties the list as it goes, which is what makes a second
78
80
  // call a no-op rather than a double dispose.
79
81
  dispose: (): void => {
82
+ 'worklet';
80
83
  for (const resource of allocated.splice(0).reverse()) resource.dispose();
81
84
  },
82
85
  };
@@ -343,6 +343,13 @@ export const SymbolicTensor = (dtype: DType, shape: SymbolicShape) => {
343
343
  * @returns A {@link SymbolicTensor} with `float32` data type.
344
344
  */
345
345
  export const f32 = (...shape: SymbolicShape) => SymbolicTensor('float32', shape);
346
+ /**
347
+ * Shorthand for `SymbolicTensor('float16', shape)`.
348
+ * @category Core / Schema / Functions
349
+ * @param shape Dimension sizes of the tensor.
350
+ * @returns A {@link SymbolicTensor} with `float16` data type.
351
+ */
352
+ export const f16 = (...shape: SymbolicShape) => SymbolicTensor('float16', shape);
346
353
  /**
347
354
  * Shorthand for `SymbolicTensor('int64', shape)`.
348
355
  * @category Core / Schema / Functions
@@ -14,7 +14,7 @@ declare const tensorBrand: unique symbol;
14
14
  * Element data type of a {@link Tensor}.
15
15
  * @category Core / Types
16
16
  */
17
- export type DType = 'float32' | 'uint8' | 'int32' | 'int64' | 'bool';
17
+ export type DType = 'float32' | 'float16' | 'uint8' | 'int32' | 'int64' | 'bool';
18
18
 
19
19
  /**
20
20
  * A native ExecuTorch tensor allocated in C++ memory.
@@ -62,14 +62,15 @@ export type Tensor = {
62
62
  /**
63
63
  * Writes data from a typed array into this tensor's native buffer.
64
64
  * @param src The source typed array. Its size in bytes must match the
65
- * tensor's size. Use a `BigInt64Array` for `int64` tensors and a
66
- * `Uint8Array` for `bool` tensors.
65
+ * tensor's size. Use a `BigInt64Array` for `int64` tensors, a `Uint8Array`
66
+ * for `bool` tensors, and a `Uint16Array` of raw IEEE 754 half-precision bits
67
+ * for `float16` tensors.
67
68
  * @returns `this` tensor.
68
69
  * @throws {RnExecuTorchError} Thrown with code `INVALID_ARGUMENT` if `src`
69
70
  * byte length does not match tensor size, `RESOURCE_BUSY` if the tensor is in
70
71
  * use, or `RESOURCE_DISPOSED` if disposed.
71
72
  */
72
- setData(src: Float32Array | Uint8Array | Int32Array | BigInt64Array): Tensor;
73
+ setData(src: Float32Array | Uint16Array | Uint8Array | Int32Array | BigInt64Array): Tensor;
73
74
 
74
75
  /**
75
76
  * Copies data out of this tensor's native buffer into a typed array.
@@ -81,7 +82,9 @@ export type Tensor = {
81
82
  * byte length does not match tensor size, `RESOURCE_BUSY` if the tensor is in
82
83
  * use, or `RESOURCE_DISPOSED` if disposed.
83
84
  */
84
- getData<T extends Float32Array | Uint8Array | Int32Array | BigInt64Array>(dst: T): T;
85
+ getData<T extends Float32Array | Uint16Array | Uint8Array | Int32Array | BigInt64Array>(
86
+ dst: T
87
+ ): T;
85
88
 
86
89
  /**
87
90
  * Passes `this` tensor as the first argument to `fn` and returns the result.
@@ -147,7 +150,7 @@ export type Tensor = {
147
150
  export function tensor(
148
151
  dtype: DType,
149
152
  shape: number[],
150
- src?: Float32Array | Uint8Array | Int32Array | BigInt64Array
153
+ src?: Float32Array | Uint16Array | Uint8Array | Int32Array | BigInt64Array
151
154
  ): Tensor {
152
155
  'worklet';
153
156
  const t: Tensor = rnexecutorchJsi.createTensor(shape, dtype);
@@ -3,7 +3,7 @@
3
3
  * Suppression (NMS).
4
4
  */
5
5
 
6
- import { rnexecutorchJsi } from '../../../native/bridge';
6
+ import { tryInitJsiCv } from '../../../native/bridge';
7
7
  import type { Tensor } from '../../../core/tensor';
8
8
  import type { ResizeMode } from './image';
9
9
  import { scalePoint } from './point';
@@ -187,7 +187,7 @@ export function nms(
187
187
  ): number[][];
188
188
  export function nms(boxes: Tensor, scores: Tensor, options: NmsOptions): number[] | number[][] {
189
189
  'worklet';
190
- return rnexecutorchJsi.cv.nms(boxes, scores, options);
190
+ return tryInitJsiCv().nms(boxes, scores, options);
191
191
  }
192
192
 
193
193
  /**
@@ -223,5 +223,5 @@ export function restrictToBox(src: Tensor, dst: Tensor, box: BoundingBox<BoxForm
223
223
  [a, b, c, d] = [box.cx, box.cy, box.w, box.h];
224
224
  break;
225
225
  }
226
- return rnexecutorchJsi.cv.restrictToBox(src, dst, [a, b, c, d], box.format);
226
+ return tryInitJsiCv().restrictToBox(src, dst, [a, b, c, d], box.format);
227
227
  }
@@ -6,7 +6,7 @@
6
6
  * pixel normalization, and colormap application.
7
7
  */
8
8
 
9
- import { rnexecutorchJsi } from '../../../native/bridge';
9
+ import { tryInitJsiCv } from '../../../native/bridge';
10
10
  import type { Tensor } from '../../../core/tensor';
11
11
  import type { ImageFormat } from '../image';
12
12
 
@@ -130,7 +130,7 @@ export type NormalizeOptions = {
130
130
  */
131
131
  export function resize(src: Tensor, dst: Tensor, options?: ResizeOptions): Tensor {
132
132
  'worklet';
133
- return rnexecutorchJsi.cv.resize(src, dst, {
133
+ return tryInitJsiCv().resize(src, dst, {
134
134
  mode: options?.mode ?? 'stretch',
135
135
  interpolation: options?.interpolation ?? 'lanczos',
136
136
  padValue: options?.padValue ?? 0,
@@ -157,7 +157,7 @@ export function resize(src: Tensor, dst: Tensor, options?: ResizeOptions): Tenso
157
157
  */
158
158
  export function cvtColor(src: Tensor, dst: Tensor, code: ColorConversionCode): Tensor {
159
159
  'worklet';
160
- return rnexecutorchJsi.cv.cvtColor(src, dst, code);
160
+ return tryInitJsiCv().cvtColor(src, dst, code);
161
161
  }
162
162
 
163
163
  /**
@@ -178,7 +178,7 @@ export function cvtColor(src: Tensor, dst: Tensor, code: ColorConversionCode): T
178
178
  */
179
179
  export function toChannelsFirst(src: Tensor, dst: Tensor): Tensor {
180
180
  'worklet';
181
- return rnexecutorchJsi.cv.toChannelsFirst(src, dst);
181
+ return tryInitJsiCv().toChannelsFirst(src, dst);
182
182
  }
183
183
 
184
184
  /**
@@ -200,7 +200,7 @@ export function toChannelsFirst(src: Tensor, dst: Tensor): Tensor {
200
200
  */
201
201
  export function toChannelsLast(src: Tensor, dst: Tensor): Tensor {
202
202
  'worklet';
203
- return rnexecutorchJsi.cv.toChannelsLast(src, dst);
203
+ return tryInitJsiCv().toChannelsLast(src, dst);
204
204
  }
205
205
 
206
206
  /**
@@ -228,11 +228,10 @@ export function toChannelsLast(src: Tensor, dst: Tensor): Tensor {
228
228
  */
229
229
  export function normalize(src: Tensor, dst: Tensor, options?: NormalizeOptions): Tensor {
230
230
  'worklet';
231
- const defaultNormalizeOptions = {
232
- alpha: 1 / 255.0,
233
- beta: 0.0,
234
- } as const;
235
- return rnexecutorchJsi.cv.normalize(src, dst, { ...defaultNormalizeOptions, ...options });
231
+ return tryInitJsiCv().normalize(src, dst, {
232
+ alpha: options?.alpha ?? 1 / 255.0,
233
+ beta: options?.beta ?? 0.0,
234
+ });
236
235
  }
237
236
 
238
237
  /**
@@ -263,7 +262,7 @@ export function applyColormap(
263
262
  colormap: [number, number, number, number][]
264
263
  ): Tensor {
265
264
  'worklet';
266
- return rnexecutorchJsi.cv.applyColormap(src, dst, colormap);
265
+ return tryInitJsiCv().applyColormap(src, dst, colormap);
267
266
  }
268
267
 
269
268
  /**
@@ -311,7 +310,7 @@ export function blendMasked(
311
310
  options?: BlendMaskedOptions
312
311
  ): Tensor {
313
312
  'worklet';
314
- return rnexecutorchJsi.cv.blendMasked(src, overlay, mask, dst, {
313
+ return tryInitJsiCv().blendMasked(src, overlay, mask, dst, {
315
314
  shrink: options?.shrink ?? 0,
316
315
  feather: options?.feather ?? 0,
317
316
  });
@@ -3,7 +3,7 @@
3
3
  * utilities.
4
4
  */
5
5
 
6
- import { rnexecutorchJsi } from '../../../native/bridge';
6
+ import { tryInitJsiCv } from '../../../native/bridge';
7
7
  import type { Tensor } from '../../../core/tensor';
8
8
  import { RnExecuTorchError } from '../../../core/error';
9
9
  import { distance, scalePoint, type Point } from './point';
@@ -180,7 +180,7 @@ export function rectifyQuad(
180
180
  'worklet';
181
181
  // The native op takes the corners as a flat [x0,y0,..,x3,y3] array.
182
182
  const flat = quad.flatMap((p) => [p.x, p.y]);
183
- return rnexecutorchJsi.cv.rectifyQuad(src, dst, flat, {
183
+ return tryInitJsiCv().rectifyQuad(src, dst, flat, {
184
184
  contentWidth: options.contentWidth,
185
185
  align: options.align ?? 'left',
186
186
  padValue: options.padValue ?? 0,
@@ -23,7 +23,8 @@ import { toChannelsLast, normalize, cvtColor } from '../ops/image';
23
23
  // is no unconditional branch and no denoising loop.
24
24
  const CLIP_MAX_TOKENS = 77;
25
25
  const CLIP_HIDDEN_SIZE = 768;
26
- const CLIP_PAD_TOKEN_ID = 49407;
26
+ const CLIP_BOS_TOKEN_ID = 49406; // <|startoftext|>
27
+ const CLIP_EOS_TOKEN_ID = 49407; // <|endoftext|>, also the padding token
27
28
 
28
29
  const IMAGE_SIZE = 512;
29
30
  const LATENT_CHANNELS = 4;
@@ -147,10 +148,15 @@ export async function createSdxsTextToImage(
147
148
  const generateWorklet = (prompt: string, seed?: number): ImageBuffer => {
148
149
  'worklet';
149
150
 
151
+ // `encode` adds no special tokens and the exported `encode` method reads the
152
+ // ids as given, so the prompt is framed here like CLIPTokenizer does:
153
+ // <|startoftext|>, at most 75 ids, then <|endoftext|> up to 77 tokens.
150
154
  const ids = tokenizer.encode(prompt);
151
- const tokens = new BigInt64Array(CLIP_MAX_TOKENS);
152
- for (let i = 0; i < CLIP_MAX_TOKENS; i++) {
153
- tokens[i] = BigInt(i < ids.length ? ids[i]! : CLIP_PAD_TOKEN_ID);
155
+ const numText = Math.min(ids.length, CLIP_MAX_TOKENS - 2);
156
+ const tokens = new BigInt64Array(CLIP_MAX_TOKENS).fill(BigInt(CLIP_EOS_TOKEN_ID));
157
+ tokens[0] = BigInt(CLIP_BOS_TOKEN_ID);
158
+ for (let i = 0; i < numText; i++) {
159
+ tokens[i + 1] = BigInt(ids[i]!);
154
160
  }
155
161
  tTokens.setData(tokens);
156
162
  model.execute('encode', [tTokens], [tEmbeddings]);
@@ -17,6 +17,7 @@ import {
17
17
  normalize,
18
18
  } from '../ops/image';
19
19
  import { RnExecuTorchError } from '../../../core/error';
20
+ import { tryInitJsiCv } from '../../../native/bridge';
20
21
 
21
22
  /**
22
23
  * Options for configuring the image preprocessor pipeline.
@@ -79,6 +80,8 @@ export function createImagePreprocessor(
79
80
  outputShape: number[]
80
81
  ): ImagePreprocessor {
81
82
  'worklet';
83
+ // Fail when the task is created, not on its first frame.
84
+ tryInitJsiCv();
82
85
  const numRgbChannels = 3;
83
86
  const isRank3 = outputShape.length === 3 && outputShape[0] === numRgbChannels;
84
87
  const isRank4 = outputShape.length === 4 && outputShape[1] === numRgbChannels;
@@ -2,7 +2,7 @@
2
2
  * DBNet contour tracing and text quad extraction utilities for PP-OCRv6.
3
3
  */
4
4
 
5
- import { rnexecutorchJsi } from '../../../native/bridge';
5
+ import { tryInitJsiCv } from '../../../native/bridge';
6
6
  import type { Tensor } from '../../../core/tensor';
7
7
  import { RnExecuTorchError } from '../../../core/error';
8
8
  import type { Quad } from '../ops/quad';
@@ -60,6 +60,6 @@ export type DbnetDecodeOptions = {
60
60
  */
61
61
  export function extractDbnetTextQuads(probabilityMap: Tensor, options: DbnetDecodeOptions): Quad[] {
62
62
  'worklet';
63
- const flat = rnexecutorchJsi.cv.extractDbnetTextQuads(probabilityMap, options) as Float32Array;
63
+ const flat = tryInitJsiCv().extractDbnetTextQuads(probabilityMap, options) as Float32Array;
64
64
  return quadsFromFlat(flat);
65
65
  }
@@ -171,11 +171,25 @@ const DEFAULT_XTC_OPTIONS = {
171
171
  */
172
172
  export function sample(logits: Tensor, ctx: SamplingContext, config: SamplingConfig = {}): number {
173
173
  'worklet';
174
+ // `??` rather than spreading the defaults, so a field passed as `undefined`
175
+ // falls back to its default instead of reaching the native sampler unset.
176
+ const { dry, xtc } = config;
174
177
  const options = {
175
- ...DEFAULT_SAMPLING_OPTIONS,
176
178
  ...config,
177
- dry: config.dry && { ...DEFAULT_DRY_OPTIONS, ...config.dry },
178
- xtc: config.xtc && { ...DEFAULT_XTC_OPTIONS, ...config.xtc },
179
+ temperature: config.temperature ?? DEFAULT_SAMPLING_OPTIONS.temperature,
180
+ repetitionPenalty: config.repetitionPenalty ?? DEFAULT_SAMPLING_OPTIONS.repetitionPenalty,
181
+ penaltyLastN: config.penaltyLastN ?? DEFAULT_SAMPLING_OPTIONS.penaltyLastN,
182
+ topK: config.topK ?? DEFAULT_SAMPLING_OPTIONS.topK,
183
+ topP: config.topP ?? DEFAULT_SAMPLING_OPTIONS.topP,
184
+ minP: config.minP ?? DEFAULT_SAMPLING_OPTIONS.minP,
185
+ dry: dry && {
186
+ ...dry,
187
+ base: dry.base ?? DEFAULT_DRY_OPTIONS.base,
188
+ allowedLength: dry.allowedLength ?? DEFAULT_DRY_OPTIONS.allowedLength,
189
+ penaltyLastN: dry.penaltyLastN ?? DEFAULT_DRY_OPTIONS.penaltyLastN,
190
+ sequenceBreakers: dry.sequenceBreakers ?? DEFAULT_DRY_OPTIONS.sequenceBreakers,
191
+ },
192
+ xtc: xtc && { ...xtc, threshold: xtc.threshold ?? DEFAULT_XTC_OPTIONS.threshold },
179
193
  };
180
194
  return rnexecutorchJsi.llm.sample(logits, ctx, options);
181
195
  }
@@ -256,7 +256,11 @@ export async function createLLMChatSession(
256
256
  throw RnExecuTorchError('RESOURCE_BUSY', 'sendMessage: A turn is already in progress.');
257
257
  }
258
258
 
259
- const turnGenConfig = { ...defaultGenerationConfig, ...genConfig };
259
+ // Drop fields passed as `undefined` so they keep the session default.
260
+ const turnOverrides = Object.fromEntries(
261
+ Object.entries(genConfig ?? {}).filter(([, value]) => value !== undefined)
262
+ );
263
+ const turnGenConfig: LLMGenerationConfig = { ...defaultGenerationConfig, ...turnOverrides };
260
264
  const prefillOptions = { enableThinking: turnGenConfig.enableThinking, addGenPrompt: false };
261
265
  const renderOptions = { ...prefillOptions, addGenPrompt: true };
262
266
  const generationOpts = { genConfig: turnGenConfig, stopTokens, stopRegex, onToken };
@@ -8,3 +8,5 @@ export * from './utils/supertonicUtils';
8
8
  export * from './utils/kokoroUtils';
9
9
  export * from './utils/phonemizer';
10
10
  export * from './utils/textPartitioner';
11
+ export { estimateTargetFrames } from './utils/reverbUtils';
12
+ export * from './utils/reverbPartitioner';
@@ -276,7 +276,13 @@ export async function createFsmnVoiceActivityDetector(
276
276
 
277
277
  const detectVoiceWorklet = (waveform: Float32Array, options?: VadOptions): VadSegment[] => {
278
278
  'worklet';
279
- const mergedOpts: Required<VadOptions> = { ...defaultOptions, ...options };
279
+ const mergedOpts: Required<VadOptions> = {
280
+ speechThreshold: options?.speechThreshold ?? defaultOptions.speechThreshold,
281
+ minSpeechDurationMs: options?.minSpeechDurationMs ?? defaultOptions.minSpeechDurationMs,
282
+ minSilenceDurationMs: options?.minSilenceDurationMs ?? defaultOptions.minSilenceDurationMs,
283
+ speechPadMs: options?.speechPadMs ?? defaultOptions.speechPadMs,
284
+ mergeGapMs: options?.mergeGapMs ?? defaultOptions.mergeGapMs,
285
+ };
280
286
  const numFrames = Math.floor((waveform.length - FRAME_LENGTH) / HOP_LENGTH);
281
287
  if (numFrames <= 0) return [];
282
288