react-native-executorch 0.5.1-rc.0 → 0.5.2

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 (178) hide show
  1. package/README.md +132 -0
  2. package/common/rnexecutorch/models/speech_to_text/SpeechToText.cpp +4 -10
  3. package/common/rnexecutorch/models/speech_to_text/SpeechToText.h +1 -1
  4. package/common/rnexecutorch/models/speech_to_text/SpeechToTextStrategy.h +3 -2
  5. package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.cpp +16 -4
  6. package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.h +2 -2
  7. package/lib/Error.d.ts +30 -0
  8. package/lib/Error.js +50 -0
  9. package/lib/constants/directories.d.ts +1 -0
  10. package/lib/constants/directories.js +2 -0
  11. package/lib/constants/llmDefaults.d.ts +6 -0
  12. package/lib/constants/llmDefaults.js +16 -0
  13. package/lib/constants/modelUrls.d.ts +217 -83
  14. package/lib/constants/modelUrls.js +304 -98
  15. package/lib/constants/ocr/models.d.ts +882 -0
  16. package/lib/constants/ocr/models.js +182 -0
  17. package/lib/constants/ocr/symbols.d.ts +75 -0
  18. package/lib/constants/ocr/symbols.js +139 -0
  19. package/lib/{typescript/constants → constants}/sttDefaults.d.ts +0 -1
  20. package/lib/constants/sttDefaults.js +12 -10
  21. package/lib/controllers/LLMController.d.ts +47 -0
  22. package/lib/controllers/LLMController.js +14 -11
  23. package/lib/controllers/OCRController.d.ts +23 -0
  24. package/lib/controllers/OCRController.js +12 -5
  25. package/lib/controllers/SpeechToTextController.d.ts +8 -4
  26. package/lib/controllers/SpeechToTextController.js +15 -9
  27. package/lib/controllers/VerticalOCRController.d.ts +25 -0
  28. package/lib/controllers/VerticalOCRController.js +75 -0
  29. package/lib/hooks/computer_vision/useClassification.d.ts +15 -0
  30. package/lib/hooks/computer_vision/useClassification.js +7 -0
  31. package/lib/hooks/computer_vision/useImageEmbeddings.d.ts +15 -0
  32. package/lib/hooks/computer_vision/useImageEmbeddings.js +7 -0
  33. package/lib/hooks/computer_vision/useImageSegmentation.d.ts +38 -0
  34. package/lib/hooks/computer_vision/useImageSegmentation.js +7 -0
  35. package/lib/hooks/computer_vision/useOCR.d.ts +20 -0
  36. package/lib/hooks/computer_vision/useOCR.js +42 -0
  37. package/lib/hooks/computer_vision/useObjectDetection.d.ts +15 -0
  38. package/lib/hooks/computer_vision/useObjectDetection.js +7 -0
  39. package/lib/hooks/computer_vision/useStyleTransfer.d.ts +15 -0
  40. package/lib/hooks/computer_vision/useStyleTransfer.js +7 -0
  41. package/lib/hooks/computer_vision/useVerticalOCR.d.ts +21 -0
  42. package/lib/hooks/computer_vision/useVerticalOCR.js +45 -0
  43. package/lib/hooks/general/useExecutorchModule.d.ts +13 -0
  44. package/lib/hooks/general/useExecutorchModule.js +7 -0
  45. package/lib/hooks/natural_language_processing/useLLM.d.ts +10 -0
  46. package/lib/hooks/natural_language_processing/useLLM.js +78 -0
  47. package/lib/hooks/natural_language_processing/useSpeechToText.d.ts +27 -0
  48. package/lib/hooks/natural_language_processing/useSpeechToText.js +19 -14
  49. package/lib/hooks/natural_language_processing/useTextEmbeddings.d.ts +16 -0
  50. package/lib/hooks/natural_language_processing/useTextEmbeddings.js +7 -0
  51. package/lib/hooks/natural_language_processing/useTokenizer.d.ts +17 -0
  52. package/lib/hooks/natural_language_processing/useTokenizer.js +52 -0
  53. package/lib/hooks/useModule.d.ts +17 -0
  54. package/lib/hooks/useModule.js +45 -0
  55. package/lib/hooks/useNonStaticModule.d.ts +20 -0
  56. package/lib/hooks/useNonStaticModule.js +49 -0
  57. package/lib/index.d.ts +1 -1
  58. package/lib/index.js +3 -2
  59. package/lib/module/constants/modelUrls.js +61 -36
  60. package/lib/module/constants/modelUrls.js.map +1 -1
  61. package/lib/module/constants/ocr/models.js +1 -1
  62. package/lib/module/hooks/natural_language_processing/useSpeechToText.js +71 -34
  63. package/lib/module/hooks/natural_language_processing/useSpeechToText.js.map +1 -1
  64. package/lib/module/index.js +2 -3
  65. package/lib/module/index.js.map +1 -1
  66. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +72 -31
  67. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
  68. package/lib/module/types/stt.js +1 -85
  69. package/lib/module/types/stt.js.map +1 -1
  70. package/lib/module/utils/ResourceFetcher.js +6 -8
  71. package/lib/module/utils/ResourceFetcher.js.map +1 -1
  72. package/lib/module/utils/ResourceFetcherUtils.js +20 -20
  73. package/lib/module/utils/ResourceFetcherUtils.js.map +1 -1
  74. package/lib/module/utils/SpeechToTextModule/ASR.js +191 -0
  75. package/lib/module/utils/SpeechToTextModule/ASR.js.map +1 -0
  76. package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js +73 -0
  77. package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js.map +1 -0
  78. package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js +56 -0
  79. package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js.map +1 -0
  80. package/lib/modules/BaseModule.d.ts +8 -0
  81. package/lib/modules/BaseModule.js +25 -0
  82. package/lib/modules/BaseNonStaticModule.d.ts +9 -0
  83. package/lib/modules/BaseNonStaticModule.js +14 -0
  84. package/lib/modules/computer_vision/ClassificationModule.d.ts +8 -0
  85. package/lib/modules/computer_vision/ClassificationModule.js +17 -0
  86. package/lib/modules/computer_vision/ImageEmbeddingsModule.d.ts +8 -0
  87. package/lib/modules/computer_vision/ImageEmbeddingsModule.js +17 -0
  88. package/lib/modules/computer_vision/ImageSegmentationModule.d.ts +11 -0
  89. package/lib/modules/computer_vision/ImageSegmentationModule.js +27 -0
  90. package/lib/modules/computer_vision/OCRModule.d.ts +15 -0
  91. package/lib/modules/computer_vision/OCRModule.js +20 -0
  92. package/lib/modules/computer_vision/ObjectDetectionModule.d.ts +9 -0
  93. package/lib/modules/computer_vision/ObjectDetectionModule.js +17 -0
  94. package/lib/modules/computer_vision/StyleTransferModule.d.ts +8 -0
  95. package/lib/modules/computer_vision/StyleTransferModule.js +17 -0
  96. package/lib/modules/computer_vision/VerticalOCRModule.d.ts +15 -0
  97. package/lib/modules/computer_vision/VerticalOCRModule.js +22 -0
  98. package/lib/modules/general/ExecutorchModule.d.ts +7 -0
  99. package/lib/modules/general/ExecutorchModule.js +14 -0
  100. package/lib/modules/natural_language_processing/LLMModule.d.ts +28 -0
  101. package/lib/modules/natural_language_processing/LLMModule.js +45 -0
  102. package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +18 -8
  103. package/lib/modules/natural_language_processing/SpeechToTextModule.js +21 -15
  104. package/lib/modules/natural_language_processing/TextEmbeddingsModule.d.ts +9 -0
  105. package/lib/modules/natural_language_processing/TextEmbeddingsModule.js +21 -0
  106. package/lib/modules/natural_language_processing/TokenizerModule.d.ts +12 -0
  107. package/lib/modules/natural_language_processing/TokenizerModule.js +5 -4
  108. package/lib/native/NativeETInstaller.d.ts +6 -0
  109. package/lib/native/NativeETInstaller.js +2 -0
  110. package/lib/native/NativeOCR.d.ts +8 -0
  111. package/lib/native/NativeOCR.js +2 -0
  112. package/lib/native/NativeVerticalOCR.d.ts +8 -0
  113. package/lib/native/NativeVerticalOCR.js +2 -0
  114. package/lib/types/common.d.ts +31 -0
  115. package/lib/types/common.js +25 -0
  116. package/lib/types/imageSegmentation.d.ts +24 -0
  117. package/lib/types/imageSegmentation.js +26 -0
  118. package/lib/types/llm.d.ts +46 -0
  119. package/lib/types/llm.js +9 -0
  120. package/lib/types/objectDetection.d.ts +104 -0
  121. package/lib/types/objectDetection.js +94 -0
  122. package/lib/types/ocr.d.ts +11 -0
  123. package/lib/types/ocr.js +1 -0
  124. package/lib/types/stt.d.ts +94 -0
  125. package/lib/types/stt.js +85 -0
  126. package/lib/typescript/constants/modelUrls.d.ts +24 -7
  127. package/lib/typescript/constants/modelUrls.d.ts.map +1 -1
  128. package/lib/typescript/constants/ocr/models.d.ts +126 -126
  129. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +15 -24
  130. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts.map +1 -1
  131. package/lib/typescript/index.d.ts +2 -3
  132. package/lib/typescript/index.d.ts.map +1 -1
  133. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +19 -22
  134. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
  135. package/lib/typescript/types/stt.d.ts +17 -91
  136. package/lib/typescript/types/stt.d.ts.map +1 -1
  137. package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -1
  138. package/lib/typescript/utils/ResourceFetcherUtils.d.ts.map +1 -1
  139. package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts +27 -0
  140. package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts.map +1 -0
  141. package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts +23 -0
  142. package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts.map +1 -0
  143. package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts +13 -0
  144. package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts.map +1 -0
  145. package/lib/utils/ResourceFetcher.d.ts +24 -0
  146. package/lib/utils/ResourceFetcher.js +305 -0
  147. package/lib/utils/ResourceFetcherUtils.d.ts +54 -0
  148. package/lib/utils/ResourceFetcherUtils.js +9 -0
  149. package/lib/utils/llm.d.ts +6 -0
  150. package/lib/utils/llm.js +1 -0
  151. package/lib/utils/stt.d.ts +1 -0
  152. package/lib/utils/stt.js +21 -0
  153. package/package.json +5 -3
  154. package/src/constants/modelUrls.ts +70 -37
  155. package/src/constants/ocr/models.ts +1 -1
  156. package/src/hooks/natural_language_processing/useSpeechToText.ts +87 -92
  157. package/src/index.ts +6 -8
  158. package/src/modules/natural_language_processing/SpeechToTextModule.ts +81 -69
  159. package/src/types/stt.ts +97 -92
  160. package/src/utils/ResourceFetcher.ts +9 -7
  161. package/src/utils/ResourceFetcherUtils.ts +15 -17
  162. package/src/utils/SpeechToTextModule/ASR.ts +303 -0
  163. package/src/utils/SpeechToTextModule/OnlineProcessor.ts +87 -0
  164. package/src/utils/SpeechToTextModule/hypothesisBuffer.ts +79 -0
  165. package/common/rnexecutorch/models/speech_to_text/MoonshineStrategy.cpp +0 -31
  166. package/common/rnexecutorch/models/speech_to_text/MoonshineStrategy.h +0 -21
  167. package/lib/module/constants/sttDefaults.js +0 -74
  168. package/lib/module/constants/sttDefaults.js.map +0 -1
  169. package/lib/module/controllers/SpeechToTextController.js +0 -320
  170. package/lib/module/controllers/SpeechToTextController.js.map +0 -1
  171. package/lib/typescript/constants/sttDefaults.d.ts.map +0 -1
  172. package/lib/typescript/controllers/SpeechToTextController.d.ts +0 -57
  173. package/lib/typescript/controllers/SpeechToTextController.d.ts.map +0 -1
  174. package/src/constants/sttDefaults.ts +0 -82
  175. package/src/controllers/SpeechToTextController.ts +0 -471
  176. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  177. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/xcuserdata/norbertklockiewicz.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  178. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/xcuserdata/norbertklockiewicz.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -0,0 +1,305 @@
1
+ /**
2
+ * Resource Fetcher
3
+ *
4
+ * Provides an interface for downloading files (via `ResourceFetcher.fetch()`)
5
+ *
6
+ * Key functionality:
7
+ * - Download control: pause, resume, and cancel operations through:
8
+ * - Single file: `.pauseFetching()`, `.resumeFetching()`, `.cancelFetching()`
9
+ * - Downloaded file management:
10
+ * - `.getFilesTotalSize()`, `.listDownloadedFiles()`, `.listDownloadedModels()`, `.deleteResources()`
11
+ *
12
+ * Remark: The pausing/resuming/canceling works only for fetching remote resources.
13
+ *
14
+ * Most exported functions accept:
15
+ * - Multiple `ResourceSource` arguments, (union type of string, number or object)
16
+ *
17
+ * Method `.fetch()` takes argument as callback that reports download progress.
18
+ * Method`.fetch()` returns array of paths to successfully saved files or null if the download was paused or cancelled (then resume functions can return paths).
19
+ *
20
+ * Technical Implementation:
21
+ * - Maintains a `downloads` Map instance that tracks:
22
+ * - Currently downloading resources
23
+ * - Paused downloads
24
+ * - Successful downloads are automatically removed from the `downloads` Map
25
+ * - Uses the `ResourceSourceExtended` interface to enable pause/resume functionality:
26
+ * - Wraps user-provided `ResourceSource` elements
27
+ * - Implements linked list behavior via the `.next` attribute
28
+ * - Automatically processes subsequent downloads when `.next` contains a valid resource
29
+ */
30
+ import { cacheDirectory, createDownloadResumable, moveAsync, FileSystemSessionType, writeAsStringAsync, EncodingType, deleteAsync, readDirectoryAsync, } from 'expo-file-system';
31
+ import { Asset } from 'expo-asset';
32
+ import { RNEDirectory } from '../constants/directories';
33
+ import { ResourceFetcherUtils, } from './ResourceFetcherUtils';
34
+ export class ResourceFetcher {
35
+ static downloads = new Map(); //map of currently downloading (or paused) files, if the download was started by .fetch() method.
36
+ static async fetch(callback = () => { }, ...sources) {
37
+ if (sources.length === 0) {
38
+ throw new Error('Empty list given as an argument!');
39
+ }
40
+ const { results: info, totalLength } = await ResourceFetcherUtils.getFilesSizes(sources);
41
+ const head = {
42
+ source: info[0].source,
43
+ sourceType: info[0].type,
44
+ callback: info[0].type === 4 /* SourceType.REMOTE_FILE */
45
+ ? ResourceFetcherUtils.calculateDownloadProgress(totalLength, info[0].previousFilesTotalLength, info[0].length, callback)
46
+ : () => { },
47
+ results: [],
48
+ };
49
+ let node = head;
50
+ for (let idx = 1; idx < sources.length; idx++) {
51
+ node.next = {
52
+ source: info[idx].source,
53
+ sourceType: info[idx].type,
54
+ callback: info[idx].type === 4 /* SourceType.REMOTE_FILE */
55
+ ? ResourceFetcherUtils.calculateDownloadProgress(totalLength, info[idx].previousFilesTotalLength, info[idx].length, callback)
56
+ : () => { },
57
+ results: [],
58
+ };
59
+ node = node.next;
60
+ }
61
+ return this.singleFetch(head);
62
+ }
63
+ static async singleFetch(sourceExtended) {
64
+ const source = sourceExtended.source;
65
+ switch (sourceExtended.sourceType) {
66
+ case 0 /* SourceType.OBJECT */: {
67
+ return this.returnOrStartNext(sourceExtended, await this.handleObject(source));
68
+ }
69
+ case 1 /* SourceType.LOCAL_FILE */: {
70
+ return this.returnOrStartNext(sourceExtended, this.handleLocalFile(source));
71
+ }
72
+ case 2 /* SourceType.RELEASE_MODE_FILE */: {
73
+ return this.returnOrStartNext(sourceExtended, await this.handleReleaseModeFile(sourceExtended));
74
+ }
75
+ case 3 /* SourceType.DEV_MODE_FILE */: {
76
+ const result = await this.handleDevModeFile(sourceExtended);
77
+ if (result !== null) {
78
+ return this.returnOrStartNext(sourceExtended, result);
79
+ }
80
+ return null;
81
+ }
82
+ default: {
83
+ //case SourceType.REMOTE_FILE
84
+ const result = await this.handleRemoteFile(sourceExtended);
85
+ if (result !== null) {
86
+ return this.returnOrStartNext(sourceExtended, result);
87
+ }
88
+ return null;
89
+ }
90
+ }
91
+ }
92
+ //if any download ends successfully this function is called - it checks whether it should trigger next download or return list of paths.
93
+ static returnOrStartNext(sourceExtended, result) {
94
+ sourceExtended.results.push(result);
95
+ if (sourceExtended.next) {
96
+ const nextSource = sourceExtended.next;
97
+ nextSource.results.push(...sourceExtended.results);
98
+ return this.singleFetch(nextSource);
99
+ }
100
+ sourceExtended.callback(1);
101
+ return sourceExtended.results;
102
+ }
103
+ static async pause(source) {
104
+ const resource = this.downloads.get(source);
105
+ switch (resource.status) {
106
+ case 1 /* DownloadStatus.PAUSED */:
107
+ throw new Error("The file download is currently paused. Can't pause the download of the same file twice.");
108
+ default: {
109
+ resource.status = 1 /* DownloadStatus.PAUSED */;
110
+ await resource.downloadResumable.pauseAsync();
111
+ }
112
+ }
113
+ }
114
+ static async resume(source) {
115
+ const resource = this.downloads.get(source);
116
+ if (!resource.extendedInfo.fileUri ||
117
+ !resource.extendedInfo.cacheFileUri ||
118
+ !resource.extendedInfo.uri) {
119
+ throw new Error('Something went wrong. File uri info is not specified!');
120
+ }
121
+ switch (resource.status) {
122
+ case 0 /* DownloadStatus.ONGOING */:
123
+ throw new Error("The file download is currently ongoing. Can't resume the ongoing download.");
124
+ default: {
125
+ resource.status = 0 /* DownloadStatus.ONGOING */;
126
+ const result = await resource.downloadResumable.resumeAsync();
127
+ if (!this.downloads.has(source) ||
128
+ this.downloads.get(source).status === 1 /* DownloadStatus.PAUSED */) {
129
+ //if canceled or paused after earlier resuming.
130
+ return null;
131
+ }
132
+ if (!result ||
133
+ (result.status !== 200 /* HTTP_CODE.OK */ &&
134
+ result.status !== 206 /* HTTP_CODE.PARTIAL_CONTENT */)) {
135
+ throw new Error(`Failed to fetch resource from '${resource.extendedInfo.uri}'`);
136
+ }
137
+ await moveAsync({
138
+ from: resource.extendedInfo.cacheFileUri,
139
+ to: resource.extendedInfo.fileUri,
140
+ });
141
+ this.downloads.delete(source);
142
+ ResourceFetcherUtils.triggerHuggingFaceDownloadCounter(resource.extendedInfo.uri);
143
+ return this.returnOrStartNext(resource.extendedInfo, ResourceFetcherUtils.removeFilePrefix(resource.extendedInfo.fileUri));
144
+ }
145
+ }
146
+ }
147
+ static async cancel(source) {
148
+ const resource = this.downloads.get(source);
149
+ await resource.downloadResumable.cancelAsync();
150
+ this.downloads.delete(source);
151
+ }
152
+ static async pauseFetching(...sources) {
153
+ const source = this.findActive(sources);
154
+ await this.pause(source);
155
+ }
156
+ static async resumeFetching(...sources) {
157
+ const source = this.findActive(sources);
158
+ await this.resume(source);
159
+ }
160
+ static async cancelFetching(...sources) {
161
+ const source = this.findActive(sources);
162
+ await this.cancel(source);
163
+ }
164
+ static findActive(sources) {
165
+ for (const source of sources) {
166
+ if (this.downloads.has(source)) {
167
+ return source;
168
+ }
169
+ }
170
+ throw new Error('None of given sources are currently during downloading process.');
171
+ }
172
+ static async listDownloadedFiles() {
173
+ const files = await readDirectoryAsync(RNEDirectory);
174
+ return files.map((file) => `${RNEDirectory}${file}`);
175
+ }
176
+ static async listDownloadedModels() {
177
+ const files = await this.listDownloadedFiles();
178
+ return files.filter((file) => file.endsWith('.pte'));
179
+ }
180
+ static async deleteResources(...sources) {
181
+ for (const source of sources) {
182
+ const filename = ResourceFetcherUtils.getFilenameFromUri(source);
183
+ const fileUri = `${RNEDirectory}${filename}`;
184
+ if (await ResourceFetcherUtils.checkFileExists(fileUri)) {
185
+ await deleteAsync(fileUri);
186
+ }
187
+ }
188
+ }
189
+ static async getFilesTotalSize(...sources) {
190
+ return (await ResourceFetcherUtils.getFilesSizes(sources)).totalLength;
191
+ }
192
+ static async handleObject(source) {
193
+ if (typeof source !== 'object') {
194
+ throw new Error('Source is expected to be object!');
195
+ }
196
+ const jsonString = JSON.stringify(source);
197
+ const digest = ResourceFetcherUtils.hashObject(jsonString);
198
+ const filename = `${digest}.json`;
199
+ const path = `${RNEDirectory}${filename}`;
200
+ if (await ResourceFetcherUtils.checkFileExists(path)) {
201
+ return ResourceFetcherUtils.removeFilePrefix(path);
202
+ }
203
+ await ResourceFetcherUtils.createDirectoryIfNoExists();
204
+ await writeAsStringAsync(path, jsonString, {
205
+ encoding: EncodingType.UTF8,
206
+ });
207
+ return ResourceFetcherUtils.removeFilePrefix(path);
208
+ }
209
+ static handleLocalFile(source) {
210
+ if (typeof source !== 'string') {
211
+ throw new Error('Source is expected to be string.');
212
+ }
213
+ return ResourceFetcherUtils.removeFilePrefix(source);
214
+ }
215
+ static async handleReleaseModeFile(sourceExtended) {
216
+ const source = sourceExtended.source;
217
+ if (typeof source !== 'number') {
218
+ throw new Error('Source is expected to be string.');
219
+ }
220
+ const asset = Asset.fromModule(source);
221
+ const uri = asset.uri;
222
+ const filename = ResourceFetcherUtils.getFilenameFromUri(uri);
223
+ const fileUri = `${RNEDirectory}${filename}`;
224
+ const fileUriWithType = `${fileUri}.${asset.type}`;
225
+ if (await ResourceFetcherUtils.checkFileExists(fileUri)) {
226
+ return ResourceFetcherUtils.removeFilePrefix(fileUri);
227
+ }
228
+ await ResourceFetcherUtils.createDirectoryIfNoExists();
229
+ await asset.downloadAsync();
230
+ if (!asset.localUri) {
231
+ throw new Error(`Asset local URI is not available for ${source}`);
232
+ }
233
+ await moveAsync({ from: asset.localUri, to: fileUriWithType });
234
+ return ResourceFetcherUtils.removeFilePrefix(fileUriWithType);
235
+ }
236
+ static async handleDevModeFile(sourceExtended) {
237
+ const source = sourceExtended.source;
238
+ if (typeof source !== 'number') {
239
+ throw new Error('Source is expected to be a number.');
240
+ }
241
+ sourceExtended.uri = Asset.fromModule(source).uri;
242
+ return await this.handleRemoteFile(sourceExtended);
243
+ }
244
+ static async handleRemoteFile(sourceExtended) {
245
+ const source = sourceExtended.source;
246
+ if (typeof source === 'object') {
247
+ throw new Error('Source is expected to be a string or a number.');
248
+ }
249
+ if (this.downloads.has(source)) {
250
+ const resource = this.downloads.get(source);
251
+ if (resource.status === 1 /* DownloadStatus.PAUSED */) {
252
+ // if the download is paused, `fetch` is treated like `resume`
253
+ this.resume(source);
254
+ }
255
+ // if the download is ongoing, throw error.
256
+ throw new Error('Already downloading this file.');
257
+ }
258
+ if (typeof source === 'number' && !sourceExtended.uri) {
259
+ throw new Error('Source Uri is expected to be available here.');
260
+ }
261
+ if (typeof source === 'string') {
262
+ sourceExtended.uri = source;
263
+ }
264
+ const uri = sourceExtended.uri;
265
+ const filename = ResourceFetcherUtils.getFilenameFromUri(uri);
266
+ sourceExtended.fileUri = `${RNEDirectory}${filename}`;
267
+ sourceExtended.cacheFileUri = `${cacheDirectory}${filename}`;
268
+ if (await ResourceFetcherUtils.checkFileExists(sourceExtended.fileUri)) {
269
+ return ResourceFetcherUtils.removeFilePrefix(sourceExtended.fileUri);
270
+ }
271
+ await ResourceFetcherUtils.createDirectoryIfNoExists();
272
+ const downloadResumable = createDownloadResumable(uri, sourceExtended.cacheFileUri, { sessionType: FileSystemSessionType.BACKGROUND }, ({ totalBytesWritten, totalBytesExpectedToWrite }) => {
273
+ if (totalBytesExpectedToWrite === -1) {
274
+ // If totalBytesExpectedToWrite is -1, it means the server does not provide content length.
275
+ sourceExtended.callback(0);
276
+ return;
277
+ }
278
+ sourceExtended.callback(totalBytesWritten / totalBytesExpectedToWrite);
279
+ });
280
+ //create value for the this.download Map
281
+ const downloadResource = {
282
+ downloadResumable: downloadResumable,
283
+ status: 0 /* DownloadStatus.ONGOING */,
284
+ extendedInfo: sourceExtended,
285
+ };
286
+ //add key-value pair to map
287
+ this.downloads.set(source, downloadResource);
288
+ const result = await downloadResumable.downloadAsync();
289
+ if (!this.downloads.has(source) ||
290
+ this.downloads.get(source).status === 1 /* DownloadStatus.PAUSED */) {
291
+ // if canceled or paused during the download
292
+ return null;
293
+ }
294
+ if (!result || result.status !== 200 /* HTTP_CODE.OK */) {
295
+ throw new Error(`Failed to fetch resource from '${source}'`);
296
+ }
297
+ await moveAsync({
298
+ from: sourceExtended.cacheFileUri,
299
+ to: sourceExtended.fileUri,
300
+ });
301
+ this.downloads.delete(source);
302
+ ResourceFetcherUtils.triggerHuggingFaceDownloadCounter(uri);
303
+ return ResourceFetcherUtils.removeFilePrefix(sourceExtended.fileUri);
304
+ }
305
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ import { DownloadResumable } from 'expo-file-system';
5
+ import { ResourceSource } from '../types/common';
6
+ export declare const enum HTTP_CODE {
7
+ OK = 200,
8
+ PARTIAL_CONTENT = 206
9
+ }
10
+ export declare const enum DownloadStatus {
11
+ ONGOING = 0,
12
+ PAUSED = 1
13
+ }
14
+ export declare const enum SourceType {
15
+ OBJECT = 0,
16
+ LOCAL_FILE = 1,
17
+ RELEASE_MODE_FILE = 2,
18
+ DEV_MODE_FILE = 3,
19
+ REMOTE_FILE = 4
20
+ }
21
+ export interface ResourceSourceExtended {
22
+ source: ResourceSource;
23
+ sourceType: SourceType;
24
+ callback?: (downloadProgress: number) => void;
25
+ results: string[];
26
+ uri?: string;
27
+ fileUri?: string;
28
+ cacheFileUri?: string;
29
+ next?: ResourceSourceExtended;
30
+ }
31
+ export interface DownloadResource {
32
+ downloadResumable: DownloadResumable;
33
+ status: DownloadStatus;
34
+ extendedInfo: ResourceSourceExtended;
35
+ }
36
+ export declare namespace ResourceFetcherUtils {
37
+ function getType(source: ResourceSource): SourceType;
38
+ function getFilesSizes(sources: ResourceSource[]): Promise<{
39
+ results: {
40
+ source: ResourceSource;
41
+ type: SourceType;
42
+ length: number;
43
+ previousFilesTotalLength: number;
44
+ }[];
45
+ totalLength: number;
46
+ }>;
47
+ function removeFilePrefix(uri: string): string;
48
+ function hashObject(jsonString: string): string;
49
+ function calculateDownloadProgress(totalLength: number, previousFilesTotalLength: number, currentFileLength: number, setProgress: (downloadProgress: number) => void): (progress: number) => void;
50
+ function triggerHuggingFaceDownloadCounter(uri: string): Promise<void>;
51
+ function createDirectoryIfNoExists(): Promise<void>;
52
+ function checkFileExists(fileUri: string): Promise<boolean>;
53
+ function getFilenameFromUri(uri: string): string;
54
+ }
@@ -42,6 +42,9 @@ export var ResourceFetcherUtils;
42
42
  continue;
43
43
  }
44
44
  const contentLength = response.headers.get('content-length');
45
+ if (!contentLength) {
46
+ Logger.warn(`No content-length header for ${source}`);
47
+ }
45
48
  length = contentLength ? parseInt(contentLength, 10) : 0;
46
49
  previousFilesTotalLength = totalLength;
47
50
  totalLength += length;
@@ -79,6 +82,11 @@ export var ResourceFetcherUtils;
79
82
  setProgress(1);
80
83
  return;
81
84
  }
85
+ // Avoid division by zero
86
+ if (totalLength === 0) {
87
+ setProgress(0);
88
+ return;
89
+ }
82
90
  const baseProgress = previousFilesTotalLength / totalLength;
83
91
  const scaledProgress = progress * (currentFileLength / totalLength);
84
92
  const updatedProgress = baseProgress + scaledProgress;
@@ -117,3 +125,4 @@ export var ResourceFetcherUtils;
117
125
  }
118
126
  ResourceFetcherUtils.getFilenameFromUri = getFilenameFromUri;
119
127
  })(ResourceFetcherUtils || (ResourceFetcherUtils = {}));
128
+ //dassaads
@@ -0,0 +1,6 @@
1
+ import { ToolCall } from '../types/llm';
2
+ import { Schema } from 'jsonschema';
3
+ import * as zCore from 'zod/v4/core';
4
+ export declare const parseToolCall: (message: string) => ToolCall[];
5
+ export declare const getStructuredOutputPrompt: <T extends zCore.$ZodType>(responseSchema: T | Schema) => string;
6
+ export declare const fixAndValidateStructuredOutput: <T extends zCore.$ZodType>(output: string, responseSchema: T | Schema) => zCore.output<T>;
package/lib/utils/llm.js CHANGED
@@ -6,6 +6,7 @@ import * as zCore from 'zod/v4/core';
6
6
  import { Logger } from '../common/Logger';
7
7
  export const parseToolCall = (message) => {
8
8
  try {
9
+ const a = 6;
9
10
  const unparsedToolCalls = message.match('\\[(.|\\s)*\\]');
10
11
  if (!unparsedToolCalls) {
11
12
  throw Error('Regex did not match array.');
@@ -0,0 +1 @@
1
+ export declare const longCommonInfPref: (seq1: number[], seq2: number[], hammingDistThreshold: number) => number;
@@ -0,0 +1,21 @@
1
+ export const longCommonInfPref = (seq1, seq2, hammingDistThreshold) => {
2
+ let maxInd = 0;
3
+ let maxLength = 0;
4
+ for (let i = 0; i < seq1.length; i++) {
5
+ let j = 0;
6
+ let hammingDist = 0;
7
+ while (j < seq2.length &&
8
+ i + j < seq1.length &&
9
+ (seq1[i + j] === seq2[j] || hammingDist < hammingDistThreshold)) {
10
+ if (seq1[i + j] !== seq2[j]) {
11
+ hammingDist++;
12
+ }
13
+ j++;
14
+ }
15
+ if (j >= maxLength) {
16
+ maxLength = j;
17
+ maxInd = i;
18
+ }
19
+ }
20
+ return maxInd;
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-executorch",
3
- "version": "0.5.1-rc.0",
3
+ "version": "0.5.2",
4
4
  "description": "An easy way to run AI models in React Native with ExecuTorch",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",
@@ -31,10 +31,12 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "example": "yarn workspace react-native-executorch-example",
34
- "typecheck": "tsc",
34
+ "typecheck": "tsc --noEmit",
35
35
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
36
36
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
37
- "prepare": "bob build"
37
+ "prepare": "bob build",
38
+ "prepack": "cp ../../README.md ./README.md",
39
+ "postpack": "rm ./README.md"
38
40
  },
39
41
  "keywords": [
40
42
  "react-native",
@@ -1,10 +1,8 @@
1
1
  import { Platform } from 'react-native';
2
- import { AvailableModels } from '../types/stt';
3
2
 
4
3
  const URL_PREFIX =
5
4
  'https://huggingface.co/software-mansion/react-native-executorch';
6
- const VERSION_TAG = 'resolve/v0.4.0';
7
- const NEXT_VERSION_TAG = 'resolve/v0.5.0';
5
+ const VERSION_TAG = 'resolve/v0.5.0';
8
6
 
9
7
  // LLMs
10
8
 
@@ -308,35 +306,70 @@ export const STYLE_TRANSFER_UDNIE = {
308
306
  };
309
307
 
310
308
  // S2T
311
- const MOONSHINE_TINY_DECODER_MODEL = `${URL_PREFIX}-moonshine-tiny/${VERSION_TAG}/xnnpack/moonshine_tiny_xnnpack_decoder.pte`;
312
- const MOONSHINE_TINY_ENCODER_MODEL = `${URL_PREFIX}-moonshine-tiny/${VERSION_TAG}/xnnpack/moonshine_tiny_xnnpack_encoder.pte`;
313
- const MOONSHINE_TOKENIZER = `${URL_PREFIX}-moonshine-tiny/${VERSION_TAG}/moonshine_tiny_tokenizer.json`;
314
- const WHISPER_TOKENIZER = `${URL_PREFIX}-whisper-tiny.en/${VERSION_TAG}/whisper_tokenizer.json`;
315
- const WHISPER_TINY_DECODER_MODEL = `${URL_PREFIX}-whisper-tiny.en/${VERSION_TAG}/xnnpack/whisper_tiny_en_xnnpack_decoder.pte`;
316
- const WHISPER_TINY_ENCODER_MODEL = `${URL_PREFIX}-whisper-tiny.en/${VERSION_TAG}/xnnpack/whisper_tiny_en_xnnpack_encoder.pte`;
317
- const WHISPER_TINY_MULTILINGUAL_ENCODER_MODEL = `${URL_PREFIX}-whisper-tiny/${VERSION_TAG}/xnnpack/xnnpack_whisper_encoder.pte`;
318
- const WHISPER_TINY_MULTILINGUAL_DECODER_MODEL = `${URL_PREFIX}-whisper-tiny/${VERSION_TAG}/xnnpack/xnnpack_whisper_decoder.pte`;
319
- const WHISPER_TINY_MULTILINGUAL_TOKENIZER = `${URL_PREFIX}-whisper-tiny/${VERSION_TAG}/tokenizer.json`;
320
-
321
- export const MOONSHINE_TINY = {
322
- modelName: AvailableModels.MOONSHINE,
323
- decoderSource: MOONSHINE_TINY_DECODER_MODEL,
324
- encoderSource: MOONSHINE_TINY_ENCODER_MODEL,
325
- tokenizerSource: MOONSHINE_TOKENIZER,
309
+ const WHISPER_TINY_EN_TOKENIZER = `${URL_PREFIX}-whisper-tiny.en/${VERSION_TAG}/tokenizer.json`;
310
+ const WHISPER_TINY_EN_ENCODER = `${URL_PREFIX}-whisper-tiny.en/${VERSION_TAG}/xnnpack/whisper_tiny_en_encoder_xnnpack.pte`;
311
+ const WHISPER_TINY_EN_DECODER = `${URL_PREFIX}-whisper-tiny.en/${VERSION_TAG}/xnnpack/whisper_tiny_en_decoder_xnnpack.pte`;
312
+
313
+ const WHISPER_BASE_EN_TOKENIZER = `${URL_PREFIX}-whisper-base.en/${VERSION_TAG}/tokenizer.json`;
314
+ const WHISPER_BASE_EN_ENCODER = `${URL_PREFIX}-whisper-base.en/${VERSION_TAG}/xnnpack/whisper_base_en_encoder_xnnpack.pte`;
315
+ const WHISPER_BASE_EN_DECODER = `${URL_PREFIX}-whisper-base.en/${VERSION_TAG}/xnnpack/whisper_base_en_decoder_xnnpack.pte`;
316
+
317
+ const WHISPER_SMALL_EN_TOKENIZER = `${URL_PREFIX}-whisper-small.en/${VERSION_TAG}/tokenizer.json`;
318
+ const WHISPER_SMALL_EN_ENCODER = `${URL_PREFIX}-whisper-small.en/${VERSION_TAG}/xnnpack/whisper_small_en_encoder_xnnpack.pte`;
319
+ const WHISPER_SMALL_EN_DECODER = `${URL_PREFIX}-whisper-small.en/${VERSION_TAG}/xnnpack/whisper_small_en_decoder_xnnpack.pte`;
320
+
321
+ const WHISPER_TINY_TOKENIZER = `${URL_PREFIX}-whisper-tiny/${VERSION_TAG}/tokenizer.json`;
322
+ const WHISPER_TINY_ENCODER_MODEL = `${URL_PREFIX}-whisper-tiny/${VERSION_TAG}/xnnpack/whisper_tiny_encoder_xnnpack.pte`;
323
+ const WHISPER_TINY_DECODER_MODEL = `${URL_PREFIX}-whisper-tiny/${VERSION_TAG}/xnnpack/whisper_tiny_decoder_xnnpack.pte`;
324
+
325
+ const WHISPER_BASE_TOKENIZER = `${URL_PREFIX}-whisper-base/${VERSION_TAG}/tokenizer.json`;
326
+ const WHISPER_BASE_ENCODER_MODEL = `${URL_PREFIX}-whisper-base/${VERSION_TAG}/xnnpack/whisper_base_encoder_xnnpack.pte`;
327
+ const WHISPER_BASE_DECODER_MODEL = `${URL_PREFIX}-whisper-base/${VERSION_TAG}/xnnpack/whisper_base_decoder_xnnpack.pte`;
328
+
329
+ const WHISPER_SMALL_TOKENIZER = `${URL_PREFIX}-whisper-small/${VERSION_TAG}/tokenizer.json`;
330
+ const WHISPER_SMALL_ENCODER_MODEL = `${URL_PREFIX}-whisper-small/${VERSION_TAG}/xnnpack/whisper_small_encoder_xnnpack.pte`;
331
+ const WHISPER_SMALL_DECODER_MODEL = `${URL_PREFIX}-whisper-small/${VERSION_TAG}/xnnpack/whisper_small_decoder_xnnpack.pte`;
332
+
333
+ export const WHISPER_TINY_EN = {
334
+ isMultilingual: false,
335
+ encoderSource: WHISPER_TINY_EN_ENCODER,
336
+ decoderSource: WHISPER_TINY_EN_DECODER,
337
+ tokenizerSource: WHISPER_TINY_EN_TOKENIZER,
338
+ };
339
+
340
+ export const WHISPER_BASE_EN = {
341
+ isMultilingual: false,
342
+ encoderSource: WHISPER_BASE_EN_ENCODER,
343
+ decoderSource: WHISPER_BASE_EN_DECODER,
344
+ tokenizerSource: WHISPER_BASE_EN_TOKENIZER,
345
+ };
346
+
347
+ export const WHISPER_SMALL_EN = {
348
+ isMultilingual: false,
349
+ encoderSource: WHISPER_SMALL_EN_ENCODER,
350
+ decoderSource: WHISPER_SMALL_EN_DECODER,
351
+ tokenizerSource: WHISPER_SMALL_EN_TOKENIZER,
326
352
  };
327
353
 
328
354
  export const WHISPER_TINY = {
329
- modelName: AvailableModels.WHISPER,
330
- decoderSource: WHISPER_TINY_DECODER_MODEL,
355
+ isMultilingual: true,
331
356
  encoderSource: WHISPER_TINY_ENCODER_MODEL,
332
- tokenizerSource: WHISPER_TOKENIZER,
357
+ decoderSource: WHISPER_TINY_DECODER_MODEL,
358
+ tokenizerSource: WHISPER_TINY_TOKENIZER,
359
+ };
360
+
361
+ export const WHISPER_BASE = {
362
+ isMultilingual: true,
363
+ encoderSource: WHISPER_BASE_ENCODER_MODEL,
364
+ decoderSource: WHISPER_BASE_DECODER_MODEL,
365
+ tokenizerSource: WHISPER_BASE_TOKENIZER,
333
366
  };
334
367
 
335
- export const WHISPER_TINY_MULTILINGUAL = {
336
- modelName: AvailableModels.WHISPER_MULTILINGUAL,
337
- decoderSource: WHISPER_TINY_MULTILINGUAL_DECODER_MODEL,
338
- encoderSource: WHISPER_TINY_MULTILINGUAL_ENCODER_MODEL,
339
- tokenizerSource: WHISPER_TINY_MULTILINGUAL_TOKENIZER,
368
+ export const WHISPER_SMALL = {
369
+ isMultilingual: true,
370
+ encoderSource: WHISPER_SMALL_ENCODER_MODEL,
371
+ decoderSource: WHISPER_SMALL_DECODER_MODEL,
372
+ tokenizerSource: WHISPER_SMALL_TOKENIZER,
340
373
  };
341
374
 
342
375
  // Image segmentation
@@ -347,23 +380,23 @@ export const DEEPLAB_V3_RESNET50 = {
347
380
  };
348
381
 
349
382
  // Image Embeddings
350
- const CLIP_VIT_BASE_PATCH32_IMAGE_MODEL = `${URL_PREFIX}-clip-vit-base-patch32/${NEXT_VERSION_TAG}/clip-vit-base-patch32-vision_xnnpack.pte`;
383
+ const CLIP_VIT_BASE_PATCH32_IMAGE_MODEL = `${URL_PREFIX}-clip-vit-base-patch32/${VERSION_TAG}/clip-vit-base-patch32-vision_xnnpack.pte`;
351
384
 
352
385
  export const CLIP_VIT_BASE_PATCH32_IMAGE = {
353
386
  modelSource: CLIP_VIT_BASE_PATCH32_IMAGE_MODEL,
354
387
  };
355
388
 
356
389
  // Text Embeddings
357
- const ALL_MINILM_L6_V2_MODEL = `${URL_PREFIX}-all-MiniLM-L6-v2/${NEXT_VERSION_TAG}/all-MiniLM-L6-v2_xnnpack.pte`;
358
- const ALL_MINILM_L6_V2_TOKENIZER = `${URL_PREFIX}-all-MiniLM-L6-v2/${NEXT_VERSION_TAG}/tokenizer.json`;
359
- const ALL_MPNET_BASE_V2_MODEL = `${URL_PREFIX}-all-mpnet-base-v2/${NEXT_VERSION_TAG}/all-mpnet-base-v2_xnnpack.pte`;
360
- const ALL_MPNET_BASE_V2_TOKENIZER = `${URL_PREFIX}-all-mpnet-base-v2/${NEXT_VERSION_TAG}/tokenizer.json`;
361
- const MULTI_QA_MINILM_L6_COS_V1_MODEL = `${URL_PREFIX}-multi-qa-MiniLM-L6-cos-v1/${NEXT_VERSION_TAG}/multi-qa-MiniLM-L6-cos-v1_xnnpack.pte`;
362
- const MULTI_QA_MINILM_L6_COS_V1_TOKENIZER = `${URL_PREFIX}-multi-qa-MiniLM-L6-cos-v1/${NEXT_VERSION_TAG}/tokenizer.json`;
363
- const MULTI_QA_MPNET_BASE_DOT_V1_MODEL = `${URL_PREFIX}-multi-qa-mpnet-base-dot-v1/${NEXT_VERSION_TAG}/multi-qa-mpnet-base-dot-v1_xnnpack.pte`;
364
- const MULTI_QA_MPNET_BASE_DOT_V1_TOKENIZER = `${URL_PREFIX}-multi-qa-mpnet-base-dot-v1/${NEXT_VERSION_TAG}/tokenizer.json`;
365
- const CLIP_VIT_BASE_PATCH32_TEXT_MODEL = `${URL_PREFIX}-clip-vit-base-patch32/${NEXT_VERSION_TAG}/clip-vit-base-patch32-text_xnnpack.pte`;
366
- const CLIP_VIT_BASE_PATCH32_TEXT_TOKENIZER = `${URL_PREFIX}-clip-vit-base-patch32/${NEXT_VERSION_TAG}/tokenizer.json`;
390
+ const ALL_MINILM_L6_V2_MODEL = `${URL_PREFIX}-all-MiniLM-L6-v2/${VERSION_TAG}/all-MiniLM-L6-v2_xnnpack.pte`;
391
+ const ALL_MINILM_L6_V2_TOKENIZER = `${URL_PREFIX}-all-MiniLM-L6-v2/${VERSION_TAG}/tokenizer.json`;
392
+ const ALL_MPNET_BASE_V2_MODEL = `${URL_PREFIX}-all-mpnet-base-v2/${VERSION_TAG}/all-mpnet-base-v2_xnnpack.pte`;
393
+ const ALL_MPNET_BASE_V2_TOKENIZER = `${URL_PREFIX}-all-mpnet-base-v2/${VERSION_TAG}/tokenizer.json`;
394
+ const MULTI_QA_MINILM_L6_COS_V1_MODEL = `${URL_PREFIX}-multi-qa-MiniLM-L6-cos-v1/${VERSION_TAG}/multi-qa-MiniLM-L6-cos-v1_xnnpack.pte`;
395
+ const MULTI_QA_MINILM_L6_COS_V1_TOKENIZER = `${URL_PREFIX}-multi-qa-MiniLM-L6-cos-v1/${VERSION_TAG}/tokenizer.json`;
396
+ const MULTI_QA_MPNET_BASE_DOT_V1_MODEL = `${URL_PREFIX}-multi-qa-mpnet-base-dot-v1/${VERSION_TAG}/multi-qa-mpnet-base-dot-v1_xnnpack.pte`;
397
+ const MULTI_QA_MPNET_BASE_DOT_V1_TOKENIZER = `${URL_PREFIX}-multi-qa-mpnet-base-dot-v1/${VERSION_TAG}/tokenizer.json`;
398
+ const CLIP_VIT_BASE_PATCH32_TEXT_MODEL = `${URL_PREFIX}-clip-vit-base-patch32/${VERSION_TAG}/clip-vit-base-patch32-text_xnnpack.pte`;
399
+ const CLIP_VIT_BASE_PATCH32_TEXT_TOKENIZER = `${URL_PREFIX}-clip-vit-base-patch32/${VERSION_TAG}/tokenizer.json`;
367
400
 
368
401
  export const ALL_MINILM_L6_V2 = {
369
402
  modelSource: ALL_MINILM_L6_V2_MODEL,
@@ -2,7 +2,7 @@ import { alphabets, symbols } from './symbols';
2
2
 
3
3
  const URL_PREFIX =
4
4
  'https://huggingface.co/software-mansion/react-native-executorch';
5
- const VERSION_TAG = 'resolve/v0.4.0';
5
+ const VERSION_TAG = 'resolve/v0.5.0';
6
6
 
7
7
  const DETECTOR_CRAFT_1280_MODEL = `${URL_PREFIX}-detector-craft/${VERSION_TAG}/xnnpack/xnnpack_craft_1280.pte`;
8
8
  const DETECTOR_CRAFT_800_MODEL = `${URL_PREFIX}-detector-craft/${VERSION_TAG}/xnnpack/xnnpack_craft_800.pte`;