react-native-executorch 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +1 -0
- package/android/src/main/cpp/CMakeLists.txt +27 -1
- package/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt +1 -13
- package/common/rnexecutorch/RnExecutorchInstaller.cpp +52 -18
- package/common/rnexecutorch/RnExecutorchInstaller.h +0 -25
- package/common/rnexecutorch/TokenizerModule.cpp +1 -1
- package/common/rnexecutorch/TokenizerModule.h +4 -1
- package/common/rnexecutorch/data_processing/FileUtils.h +2 -2
- package/common/rnexecutorch/data_processing/ImageProcessing.cpp +5 -5
- package/common/rnexecutorch/data_processing/ImageProcessing.h +2 -2
- package/common/rnexecutorch/data_processing/Numerical.cpp +40 -19
- package/common/rnexecutorch/data_processing/Numerical.h +53 -4
- package/common/rnexecutorch/data_processing/dsp.cpp +1 -1
- package/common/rnexecutorch/data_processing/dsp.h +1 -1
- package/common/rnexecutorch/data_processing/gzip.cpp +47 -0
- package/common/rnexecutorch/data_processing/gzip.h +7 -0
- package/common/rnexecutorch/host_objects/JsiConversions.h +43 -62
- package/common/rnexecutorch/host_objects/ModelHostObject.h +67 -24
- package/common/rnexecutorch/metaprogramming/ConstructorHelpers.h +8 -6
- package/common/rnexecutorch/metaprogramming/FunctionHelpers.h +1 -1
- package/common/rnexecutorch/metaprogramming/TypeConcepts.h +21 -1
- package/common/rnexecutorch/models/BaseModel.cpp +5 -4
- package/common/rnexecutorch/models/BaseModel.h +8 -2
- package/common/rnexecutorch/models/classification/Classification.cpp +6 -6
- package/common/rnexecutorch/models/classification/Classification.h +5 -0
- package/common/rnexecutorch/models/classification/Constants.h +3 -3
- package/common/rnexecutorch/models/embeddings/BaseEmbeddings.cpp +2 -2
- package/common/rnexecutorch/models/embeddings/BaseEmbeddings.h +2 -2
- package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.cpp +3 -3
- package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.h +5 -0
- package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.cpp +2 -2
- package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.h +6 -1
- package/common/rnexecutorch/models/image_segmentation/Constants.h +3 -3
- package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.cpp +6 -5
- package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.h +8 -1
- package/common/rnexecutorch/models/llm/LLM.cpp +58 -0
- package/common/rnexecutorch/models/llm/LLM.h +35 -0
- package/common/rnexecutorch/models/object_detection/Constants.h +3 -3
- package/common/rnexecutorch/models/object_detection/ObjectDetection.cpp +8 -8
- package/common/rnexecutorch/models/object_detection/ObjectDetection.h +11 -5
- package/common/rnexecutorch/models/object_detection/Types.h +13 -0
- package/common/rnexecutorch/models/object_detection/Utils.cpp +13 -11
- package/common/rnexecutorch/models/object_detection/Utils.h +7 -13
- package/common/rnexecutorch/models/ocr/CTCLabelConverter.cpp +2 -2
- package/common/rnexecutorch/models/ocr/CTCLabelConverter.h +2 -2
- package/common/rnexecutorch/models/ocr/Constants.h +33 -26
- package/common/rnexecutorch/models/ocr/Detector.cpp +20 -22
- package/common/rnexecutorch/models/ocr/Detector.h +4 -4
- package/common/rnexecutorch/models/ocr/OCR.cpp +9 -8
- package/common/rnexecutorch/models/ocr/OCR.h +11 -3
- package/common/rnexecutorch/models/ocr/RecognitionHandler.cpp +20 -19
- package/common/rnexecutorch/models/ocr/RecognitionHandler.h +9 -7
- package/common/rnexecutorch/models/ocr/Recognizer.cpp +7 -7
- package/common/rnexecutorch/models/ocr/Recognizer.h +2 -2
- package/common/rnexecutorch/models/ocr/Types.h +4 -6
- package/common/rnexecutorch/models/ocr/{DetectorUtils.cpp → utils/DetectorUtils.cpp} +70 -63
- package/common/rnexecutorch/models/ocr/{DetectorUtils.h → utils/DetectorUtils.h} +12 -11
- package/common/rnexecutorch/models/ocr/{RecognitionHandlerUtils.cpp → utils/RecognitionHandlerUtils.cpp} +14 -11
- package/common/rnexecutorch/models/ocr/{RecognitionHandlerUtils.h → utils/RecognitionHandlerUtils.h} +5 -5
- package/common/rnexecutorch/models/ocr/{RecognizerUtils.cpp → utils/RecognizerUtils.cpp} +28 -26
- package/common/rnexecutorch/models/ocr/{RecognizerUtils.h → utils/RecognizerUtils.h} +15 -14
- package/common/rnexecutorch/models/speech_to_text/SpeechToText.cpp +102 -41
- package/common/rnexecutorch/models/speech_to_text/SpeechToText.h +48 -19
- package/common/rnexecutorch/models/speech_to_text/asr/ASR.cpp +307 -0
- package/common/rnexecutorch/models/speech_to_text/asr/ASR.h +61 -0
- package/common/rnexecutorch/models/speech_to_text/stream/HypothesisBuffer.cpp +80 -0
- package/common/rnexecutorch/models/speech_to_text/stream/HypothesisBuffer.h +27 -0
- package/common/rnexecutorch/models/speech_to_text/stream/OnlineASRProcessor.cpp +96 -0
- package/common/rnexecutorch/models/speech_to_text/stream/OnlineASRProcessor.h +36 -0
- package/common/rnexecutorch/models/speech_to_text/types/DecodingOptions.h +15 -0
- package/common/rnexecutorch/models/speech_to_text/types/GenerationResult.h +12 -0
- package/common/rnexecutorch/models/speech_to_text/types/ProcessResult.h +12 -0
- package/common/rnexecutorch/models/speech_to_text/types/Segment.h +14 -0
- package/common/rnexecutorch/models/speech_to_text/types/Word.h +13 -0
- package/common/rnexecutorch/models/style_transfer/StyleTransfer.cpp +5 -5
- package/common/rnexecutorch/models/style_transfer/StyleTransfer.h +6 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.cpp +23 -22
- package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.h +4 -4
- package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.cpp +34 -34
- package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.h +27 -20
- package/{third-party/ios/ExecutorchLib/ExecutorchLib/sampler → common/runner}/sampler.cpp +3 -2
- package/{third-party/ios/ExecutorchLib/ExecutorchLib/sampler → common/runner}/sampler.h +3 -2
- package/ios/libs/executorch/libbackend_coreml_ios.a +0 -0
- package/ios/libs/executorch/libbackend_coreml_simulator.a +0 -0
- package/{third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64 → ios/libs/executorch}/libbackend_mps_ios.a +0 -0
- package/{third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64-simulator → ios/libs/executorch}/libbackend_mps_simulator.a +0 -0
- package/ios/libs/executorch/libbackend_xnnpack_ios.a +0 -0
- package/ios/libs/executorch/libbackend_xnnpack_simulator.a +0 -0
- package/ios/libs/executorch/libexecutorch_ios.a +0 -0
- package/ios/libs/executorch/libexecutorch_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_custom_ios.a +0 -0
- package/ios/libs/executorch/libkernels_custom_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_optimized_ios.a +0 -0
- package/ios/libs/executorch/libkernels_optimized_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_portable_ios.a +0 -0
- package/ios/libs/executorch/libkernels_portable_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_quantized_ios.a +0 -0
- package/ios/libs/executorch/libkernels_quantized_simulator.a +0 -0
- package/ios/libs/tokenizers-cpp/physical-arm64-release/libsentencepiece.a +0 -0
- package/ios/{ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib → libs/tokenizers-cpp/physical-arm64-release/libtokenizers_c.a} +0 -0
- package/ios/libs/tokenizers-cpp/physical-arm64-release/libtokenizers_cpp.a +0 -0
- package/ios/libs/tokenizers-cpp/simulator-arm64-debug/libsentencepiece.a +0 -0
- package/ios/{ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib → libs/tokenizers-cpp/simulator-arm64-debug/libtokenizers_c.a} +0 -0
- package/ios/libs/tokenizers-cpp/simulator-arm64-debug/libtokenizers_cpp.a +0 -0
- package/lib/Error.js +9 -6
- package/lib/ThreadPool.d.ts +10 -0
- package/lib/ThreadPool.js +28 -0
- package/lib/constants/modelUrls.js +1 -1
- package/lib/controllers/OCRController.js +9 -14
- package/lib/controllers/VerticalOCRController.js +9 -14
- package/lib/hooks/computer_vision/useOCR.js +7 -8
- package/lib/hooks/computer_vision/useVerticalOCR.js +3 -5
- package/lib/index.d.ts +0 -2
- package/lib/index.js +1 -3
- package/lib/module/controllers/LLMController.js +6 -10
- package/lib/module/controllers/LLMController.js.map +1 -1
- package/lib/module/hooks/computer_vision/useClassification.js +2 -2
- package/lib/module/hooks/computer_vision/useClassification.js.map +1 -1
- package/lib/module/hooks/computer_vision/useImageEmbeddings.js +2 -2
- package/lib/module/hooks/computer_vision/useImageEmbeddings.js.map +1 -1
- package/lib/module/hooks/computer_vision/useImageSegmentation.js +2 -2
- package/lib/module/hooks/computer_vision/useImageSegmentation.js.map +1 -1
- package/lib/module/hooks/computer_vision/useObjectDetection.js +2 -2
- package/lib/module/hooks/computer_vision/useObjectDetection.js.map +1 -1
- package/lib/module/hooks/computer_vision/useStyleTransfer.js +2 -2
- package/lib/module/hooks/computer_vision/useStyleTransfer.js.map +1 -1
- package/lib/module/hooks/general/useExecutorchModule.js +2 -2
- package/lib/module/hooks/general/useExecutorchModule.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js +2 -2
- package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js.map +1 -1
- package/lib/module/hooks/useModule.js +13 -9
- package/lib/module/hooks/useModule.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/BaseModule.js +9 -17
- package/lib/module/modules/BaseModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ClassificationModule.js +2 -2
- package/lib/module/modules/computer_vision/ClassificationModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js +2 -2
- package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ImageSegmentationModule.js +2 -2
- package/lib/module/modules/computer_vision/ImageSegmentationModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ObjectDetectionModule.js +2 -2
- package/lib/module/modules/computer_vision/ObjectDetectionModule.js.map +1 -1
- package/lib/module/modules/computer_vision/StyleTransferModule.js +2 -2
- package/lib/module/modules/computer_vision/StyleTransferModule.js.map +1 -1
- package/lib/module/modules/general/ExecutorchModule.js +2 -2
- package/lib/module/modules/general/ExecutorchModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +75 -53
- package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js +2 -2
- package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js.map +1 -1
- package/lib/module/native/RnExecutorchModules.js +1 -2
- package/lib/module/native/RnExecutorchModules.js.map +1 -1
- package/lib/modules/computer_vision/OCRModule.d.ts +4 -5
- package/lib/modules/computer_vision/OCRModule.js +9 -12
- package/lib/modules/computer_vision/VerticalOCRModule.d.ts +4 -5
- package/lib/modules/computer_vision/VerticalOCRModule.js +9 -12
- package/lib/native/RnExecutorchModules.d.ts +5 -1
- package/lib/native/RnExecutorchModules.js +3 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/common.d.ts +1 -0
- package/lib/typescript/controllers/LLMController.d.ts +1 -1
- package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +5 -5
- package/lib/typescript/hooks/useModule.d.ts +8 -5
- package/lib/typescript/hooks/useModule.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modules/BaseModule.d.ts +7 -6
- package/lib/typescript/modules/BaseModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts +2 -2
- package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts +2 -2
- package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts +2 -2
- package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts +2 -2
- package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts +2 -2
- package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts.map +1 -1
- package/lib/typescript/modules/general/ExecutorchModule.d.ts +2 -2
- package/lib/typescript/modules/general/ExecutorchModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +7 -12
- package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts +2 -2
- package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts.map +1 -1
- package/lib/typescript/native/RnExecutorchModules.d.ts +1 -3
- package/lib/typescript/native/RnExecutorchModules.d.ts.map +1 -1
- package/lib/typescript/types/stt.d.ts +0 -9
- package/lib/typescript/types/stt.d.ts.map +1 -1
- package/lib/utils/ResourceFetcherUtils.js +0 -1
- package/lib/utils/llm.js +0 -1
- package/package.json +1 -2
- package/react-native-executorch.podspec +49 -44
- package/src/controllers/LLMController.ts +8 -13
- package/src/hooks/computer_vision/useClassification.ts +2 -2
- package/src/hooks/computer_vision/useImageEmbeddings.ts +2 -2
- package/src/hooks/computer_vision/useImageSegmentation.ts +2 -2
- package/src/hooks/computer_vision/useObjectDetection.ts +2 -2
- package/src/hooks/computer_vision/useStyleTransfer.ts +2 -2
- package/src/hooks/general/useExecutorchModule.ts +2 -2
- package/src/hooks/natural_language_processing/useTextEmbeddings.ts +2 -2
- package/src/hooks/useModule.ts +23 -13
- package/src/index.ts +3 -2
- package/src/modules/BaseModule.ts +17 -28
- package/src/modules/computer_vision/ClassificationModule.ts +2 -2
- package/src/modules/computer_vision/ImageEmbeddingsModule.ts +2 -2
- package/src/modules/computer_vision/ImageSegmentationModule.ts +2 -2
- package/src/modules/computer_vision/ObjectDetectionModule.ts +2 -2
- package/src/modules/computer_vision/StyleTransferModule.ts +2 -2
- package/src/modules/general/ExecutorchModule.ts +2 -2
- package/src/modules/natural_language_processing/SpeechToTextModule.ts +118 -54
- package/src/modules/natural_language_processing/TextEmbeddingsModule.ts +2 -2
- package/src/native/RnExecutorchModules.ts +1 -5
- package/src/types/stt.ts +0 -12
- package/third-party/android/libs/cpuinfo/arm64-v8a/libcpuinfo.so +0 -0
- package/third-party/android/libs/pthreadpool/arm64-v8a/libpthreadpool.so +0 -0
- package/third-party/include/cpuinfo/cpuinfo.h +2305 -0
- package/third-party/include/executorch/extension/threadpool/cpuinfo_utils.h +26 -0
- package/third-party/include/executorch/extension/threadpool/threadpool.h +94 -0
- package/third-party/include/pthreadpool/pthreadpool.h +2236 -0
- package/android/src/main/java/com/swmansion/rnexecutorch/LLM.kt +0 -63
- package/common/rnexecutorch/models/EncoderDecoderBase.cpp +0 -21
- package/common/rnexecutorch/models/EncoderDecoderBase.h +0 -31
- package/common/rnexecutorch/models/speech_to_text/SpeechToTextStrategy.h +0 -27
- package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.cpp +0 -50
- package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.h +0 -25
- package/ios/ExecutorchLib.xcframework/Info.plist +0 -43
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Headers/ETModel.h +0 -27
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Headers/HuggingFaceTokenizer.h +0 -14
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Headers/LLaMARunner.h +0 -32
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Headers/ETModel.h +0 -27
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Headers/HuggingFaceTokenizer.h +0 -14
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Headers/LLaMARunner.h +0 -32
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
- package/ios/RnExecutorch/LLM.h +0 -5
- package/ios/RnExecutorch/LLM.mm +0 -78
- package/lib/Error.d.ts +0 -30
- package/lib/constants/directories.d.ts +0 -1
- package/lib/constants/ocr/symbols.d.ts +0 -75
- package/lib/controllers/OCRController.d.ts +0 -23
- package/lib/controllers/VerticalOCRController.d.ts +0 -25
- package/lib/hooks/useModule.d.ts +0 -17
- package/lib/module/modules/BaseNonStaticModule.js +0 -17
- package/lib/module/modules/BaseNonStaticModule.js.map +0 -1
- package/lib/module/native/NativeLLM.js +0 -5
- package/lib/module/native/NativeLLM.js.map +0 -1
- package/lib/module/utils/SpeechToTextModule/ASR.js +0 -191
- package/lib/module/utils/SpeechToTextModule/ASR.js.map +0 -1
- package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js +0 -73
- package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js.map +0 -1
- package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js +0 -56
- package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js.map +0 -1
- package/lib/module/utils/stt.js +0 -22
- package/lib/module/utils/stt.js.map +0 -1
- package/lib/modules/BaseModule.d.ts +0 -8
- package/lib/modules/BaseNonStaticModule.d.ts +0 -9
- package/lib/native/NativeETInstaller.d.ts +0 -6
- package/lib/native/NativeOCR.d.ts +0 -8
- package/lib/native/NativeVerticalOCR.d.ts +0 -8
- package/lib/types/imageSegmentation.d.ts +0 -24
- package/lib/types/objectDetection.d.ts +0 -104
- package/lib/types/ocr.d.ts +0 -11
- package/lib/typescript/modules/BaseNonStaticModule.d.ts +0 -10
- package/lib/typescript/modules/BaseNonStaticModule.d.ts.map +0 -1
- package/lib/typescript/native/NativeLLM.d.ts +0 -12
- package/lib/typescript/native/NativeLLM.d.ts.map +0 -1
- package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts +0 -27
- package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts.map +0 -1
- package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts +0 -23
- package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts.map +0 -1
- package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts +0 -13
- package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts.map +0 -1
- package/lib/typescript/utils/stt.d.ts +0 -2
- package/lib/typescript/utils/stt.d.ts.map +0 -1
- package/lib/utils/stt.d.ts +0 -1
- package/src/modules/BaseNonStaticModule.ts +0 -26
- package/src/native/NativeLLM.ts +0 -14
- package/src/utils/SpeechToTextModule/ASR.ts +0 -303
- package/src/utils/SpeechToTextModule/OnlineProcessor.ts +0 -87
- package/src/utils/SpeechToTextModule/hypothesisBuffer.ts +0 -79
- package/src/utils/stt.ts +0 -28
- package/third-party/include/tokenizers-cpp/tokenizers_c.h +0 -61
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.h +0 -27
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.mm +0 -249
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.h +0 -14
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.mm +0 -80
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.h +0 -32
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.mm +0 -95
- package/third-party/ios/ExecutorchLib/ExecutorchLib/InputType.h +0 -12
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Utils.hpp +0 -217
- package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.cpp +0 -11
- package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.h +0 -11
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/base64.h +0 -202
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.cpp +0 -313
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.h +0 -57
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.cpp +0 -78
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.h +0 -23
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.cpp +0 -427
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.h +0 -87
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tokenizer.h +0 -76
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.pbxproj +0 -683
- package/third-party/ios/ExecutorchLib/build.sh +0 -44
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64/libbackend_coreml_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64-simulator/libbackend_coreml_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64/libbackend_xnnpack_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64-simulator/libbackend_xnnpack_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/Info.plist +0 -47
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Export.h +0 -163
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Macros.h +0 -497
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-inl.h +0 -342
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-math.h +0 -266
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16.h +0 -125
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half-inl.h +0 -347
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half.h +0 -416
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/TypeSafeSignMath.h +0 -133
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/bit_cast.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/floating_point_utils.h +0 -33
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/irange.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorch.h +0 -13
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchError.h +0 -16
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchLog.h +0 -76
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchModule.h +0 -286
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchTensor.h +0 -742
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchValue.h +0 -219
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/module/module.h +0 -492
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor.h +0 -13
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_accessor.h +0 -190
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr.h +0 -347
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr_maker.h +0 -653
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_execution_context.h +0 -71
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_init_context.h +0 -72
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/interface.h +0 -166
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/array_ref.h +0 -235
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/data_loader.h +0 -136
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/defines.h +0 -20
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/error.h +0 -229
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/evalue.h +0 -521
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer.h +0 -565
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks.h +0 -323
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +0 -197
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/exec_aten.h +0 -147
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +0 -263
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +0 -1331
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +0 -21
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +0 -69
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +0 -1250
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/freeable_buffer.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/hierarchical_allocator.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/memory_allocator.h +0 -198
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/named_data_map.h +0 -86
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16.h +0 -27
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +0 -14
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bits_types.h +0 -83
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +0 -163
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +0 -497
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +0 -342
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +0 -266
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +0 -125
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +0 -347
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +0 -416
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +0 -133
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +0 -33
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/complex.h +0 -44
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/device.h +0 -70
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/half.h +0 -27
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/optional.h +0 -36
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/qint_types.h +0 -83
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar.h +0 -110
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar_type.h +0 -154
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/string_view.h +0 -29
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor.h +0 -142
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_impl.h +0 -261
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_options.h +0 -60
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/result.h +0 -258
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/span.h +0 -93
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tag.h +0 -71
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_layout.h +0 -79
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_shape_dynamism.h +0 -39
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/memory_manager.h +0 -113
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method.h +0 -387
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method_meta.h +0 -251
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/program.h +0 -320
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/pte_data_map.h +0 -144
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/tensor_parser.h +0 -156
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/kernel_runtime_context.h +0 -122
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/operator_registry.h +0 -278
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/abort.h +0 -36
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/assert.h +0 -119
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/clock.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compat_unistd.h +0 -75
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compiler.h +0 -191
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/log.h +0 -177
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/platform.h +0 -133
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/profiler.h +0 -292
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/runtime.h +0 -35
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/system.h +0 -49
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/types.h +0 -24
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/schema/extended_header.h +0 -76
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/module.modulemap +0 -5
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/libexecutorch_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Export.h +0 -163
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Macros.h +0 -497
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-inl.h +0 -342
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-math.h +0 -266
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16.h +0 -125
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half-inl.h +0 -347
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half.h +0 -416
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/TypeSafeSignMath.h +0 -133
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/bit_cast.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/floating_point_utils.h +0 -33
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/irange.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorch.h +0 -13
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchError.h +0 -16
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchLog.h +0 -76
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchModule.h +0 -286
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchTensor.h +0 -742
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchValue.h +0 -219
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/module/module.h +0 -492
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor.h +0 -13
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_accessor.h +0 -190
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr.h +0 -347
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr_maker.h +0 -653
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_execution_context.h +0 -71
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_init_context.h +0 -72
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/interface.h +0 -166
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/array_ref.h +0 -235
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/data_loader.h +0 -136
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/defines.h +0 -20
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/error.h +0 -229
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/evalue.h +0 -521
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer.h +0 -565
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks.h +0 -323
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +0 -197
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/exec_aten.h +0 -147
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +0 -263
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +0 -1331
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +0 -21
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +0 -69
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +0 -1250
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/freeable_buffer.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/hierarchical_allocator.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/memory_allocator.h +0 -198
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/named_data_map.h +0 -86
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16.h +0 -27
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +0 -14
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bits_types.h +0 -83
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +0 -163
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +0 -497
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +0 -342
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +0 -266
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +0 -125
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +0 -347
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +0 -416
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +0 -133
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +0 -33
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +0 -107
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/complex.h +0 -44
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/device.h +0 -70
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/half.h +0 -27
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/optional.h +0 -36
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/qint_types.h +0 -83
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar.h +0 -110
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar_type.h +0 -154
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/string_view.h +0 -29
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor.h +0 -142
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_impl.h +0 -261
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_options.h +0 -60
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/result.h +0 -258
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/span.h +0 -93
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tag.h +0 -71
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_layout.h +0 -79
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_shape_dynamism.h +0 -39
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/memory_manager.h +0 -113
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method.h +0 -387
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method_meta.h +0 -251
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/program.h +0 -320
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/pte_data_map.h +0 -144
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/tensor_parser.h +0 -156
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/kernel_runtime_context.h +0 -122
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/operator_registry.h +0 -278
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/abort.h +0 -36
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/assert.h +0 -119
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/clock.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compat_unistd.h +0 -75
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compiler.h +0 -191
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/log.h +0 -177
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/platform.h +0 -133
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/profiler.h +0 -292
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/runtime.h +0 -35
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/system.h +0 -49
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/types.h +0 -24
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/schema/extended_header.h +0 -76
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/module.modulemap +0 -5
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/libexecutorch_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64/libkernels_custom_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64-simulator/libkernels_custom_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64/libkernels_optimized_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64-simulator/libkernels_optimized_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64/libkernels_portable_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64-simulator/libkernels_portable_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64/libkernels_quantized_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64-simulator/libkernels_quantized_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/Info.plist +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/bitmap256.h +0 -82
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/filtered_re2.h +0 -111
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/pod_array.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter.h +0 -130
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter_tree.h +0 -139
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prog.h +0 -483
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/re2.h +0 -994
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/regexp.h +0 -692
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/set.h +0 -85
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_array.h +0 -367
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_set.h +0 -241
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/stringpiece.h +0 -205
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_casefold.h +0 -78
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_groups.h +0 -64
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/walker-inl.h +0 -235
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Info.plist +0 -26
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/re2 +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/bitmap256.h +0 -82
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/filtered_re2.h +0 -111
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/pod_array.h +0 -43
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter.h +0 -130
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter_tree.h +0 -139
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prog.h +0 -483
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/re2.h +0 -994
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/regexp.h +0 -692
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/set.h +0 -85
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_array.h +0 -367
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_set.h +0 -241
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/stringpiece.h +0 -205
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_casefold.h +0 -78
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_groups.h +0 -64
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/walker-inl.h +0 -235
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Info.plist +0 -26
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/re2 +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/irunner.h +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/runner.cpp +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/runner.h +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/stats.h +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/text_decoder_runner.cpp +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/text_decoder_runner.h +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/text_prefiller.cpp +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/text_prefiller.h +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/text_token_generator.h +0 -0
- /package/{third-party/ios/ExecutorchLib/ExecutorchLib → common}/runner/util.h +0 -0
package/lib/hooks/useModule.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
interface Module {
|
|
2
|
-
load: (...args: any[]) => Promise<void>;
|
|
3
|
-
forward: (...input: any[]) => Promise<any>;
|
|
4
|
-
onDownloadProgress: (cb: (progress: number) => void) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const useModule: <M extends Module, LoadArgs extends Parameters<M["load"]>, ForwardArgs extends Parameters<M["forward"]>, ForwardReturn extends Awaited<ReturnType<M["forward"]>>>({ module, loadArgs, preventLoad, }: {
|
|
7
|
-
module: M;
|
|
8
|
-
loadArgs: LoadArgs;
|
|
9
|
-
preventLoad?: boolean;
|
|
10
|
-
}) => {
|
|
11
|
-
error: string | null;
|
|
12
|
-
isReady: boolean;
|
|
13
|
-
isGenerating: boolean;
|
|
14
|
-
downloadProgress: number;
|
|
15
|
-
forward: (...input: ForwardArgs) => Promise<ForwardReturn>;
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export class BaseNonStaticModule {
|
|
4
|
-
nativeModule = null;
|
|
5
|
-
async forwardET(inputTensor) {
|
|
6
|
-
return await this.nativeModule.forward(inputTensor);
|
|
7
|
-
}
|
|
8
|
-
async getInputShape(methodName, index) {
|
|
9
|
-
return this.nativeModule.getInputShape(methodName, index);
|
|
10
|
-
}
|
|
11
|
-
delete() {
|
|
12
|
-
if (this.nativeModule !== null) {
|
|
13
|
-
this.nativeModule.unload();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=BaseNonStaticModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BaseNonStaticModule","nativeModule","forwardET","inputTensor","forward","getInputShape","methodName","index","delete","unload"],"sourceRoot":"../../../src","sources":["modules/BaseNonStaticModule.ts"],"mappings":";;AAGA,OAAO,MAAeA,mBAAmB,CAAC;EACxCC,YAAY,GAAQ,IAAI;EAQxB,MAAgBC,SAASA,CAACC,WAAwB,EAAwB;IACxE,OAAO,MAAM,IAAI,CAACF,YAAY,CAACG,OAAO,CAACD,WAAW,CAAC;EACrD;EAEA,MAAME,aAAaA,CAACC,UAAkB,EAAEC,KAAa,EAAqB;IACxE,OAAO,IAAI,CAACN,YAAY,CAACI,aAAa,CAACC,UAAU,EAAEC,KAAK,CAAC;EAC3D;EAEAC,MAAMA,CAAA,EAAG;IACP,IAAI,IAAI,CAACP,YAAY,KAAK,IAAI,EAAE;MAC9B,IAAI,CAACA,YAAY,CAACQ,MAAM,CAAC,CAAC;IAC5B;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["native/NativeLLM.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAYlD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,KAAK,CAAC","ignoreList":[]}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// NOTE: This will be implemented in C++
|
|
4
|
-
|
|
5
|
-
import { TokenizerModule } from '../../modules/natural_language_processing/TokenizerModule';
|
|
6
|
-
import { ResourceFetcher } from '../ResourceFetcher';
|
|
7
|
-
export class ASR {
|
|
8
|
-
tokenizerModule = new TokenizerModule();
|
|
9
|
-
timePrecision = 0.02; // Whisper timestamp precision
|
|
10
|
-
maxDecodeLength = 128;
|
|
11
|
-
chunkSize = 30; // 30 seconds
|
|
12
|
-
minChunkSamples = 1 * 16000; // 1 second
|
|
13
|
-
samplingRate = 16000;
|
|
14
|
-
async load(model, onDownloadProgressCallback) {
|
|
15
|
-
const tokenizerLoadPromise = this.tokenizerModule.load(model);
|
|
16
|
-
const encoderDecoderPromise = ResourceFetcher.fetch(onDownloadProgressCallback, model.encoderSource, model.decoderSource);
|
|
17
|
-
const [_, encoderDecoderResults] = await Promise.all([tokenizerLoadPromise, encoderDecoderPromise]);
|
|
18
|
-
const encoderSource = encoderDecoderResults?.[0];
|
|
19
|
-
const decoderSource = encoderDecoderResults?.[1];
|
|
20
|
-
if (!encoderSource || !decoderSource) {
|
|
21
|
-
throw new Error('Download interrupted.');
|
|
22
|
-
}
|
|
23
|
-
this.nativeModule = await global.loadSpeechToText(encoderSource, decoderSource, 'whisper');
|
|
24
|
-
this.startOfTranscriptToken = await this.tokenizerModule.tokenToId('<|startoftranscript|>');
|
|
25
|
-
this.endOfTextToken = await this.tokenizerModule.tokenToId('<|endoftext|>');
|
|
26
|
-
this.timestampBeginToken = await this.tokenizerModule.tokenToId('<|0.00|>');
|
|
27
|
-
}
|
|
28
|
-
async getInitialSequence(options) {
|
|
29
|
-
const initialSequence = [this.startOfTranscriptToken];
|
|
30
|
-
if (options.language) {
|
|
31
|
-
const languageToken = await this.tokenizerModule.tokenToId(`<|${options.language}|>`);
|
|
32
|
-
const taskToken = await this.tokenizerModule.tokenToId('<|transcribe|>');
|
|
33
|
-
initialSequence.push(languageToken);
|
|
34
|
-
initialSequence.push(taskToken);
|
|
35
|
-
}
|
|
36
|
-
initialSequence.push(this.timestampBeginToken);
|
|
37
|
-
return initialSequence;
|
|
38
|
-
}
|
|
39
|
-
async generate(audio, temperature, options) {
|
|
40
|
-
await this.encode(new Float32Array(audio));
|
|
41
|
-
const initialSequence = await this.getInitialSequence(options);
|
|
42
|
-
const sequencesIds = [...initialSequence];
|
|
43
|
-
const scores = [];
|
|
44
|
-
while (sequencesIds.length <= this.maxDecodeLength) {
|
|
45
|
-
const logits = this.softmaxWithTemperature(Array.from(await this.decode(sequencesIds)), temperature === 0 ? 1 : temperature);
|
|
46
|
-
const nextTokenId = temperature === 0 ? logits.indexOf(Math.max(...logits)) : this.sampleFromDistribution(logits);
|
|
47
|
-
const nextTokenProb = logits[nextTokenId];
|
|
48
|
-
sequencesIds.push(nextTokenId);
|
|
49
|
-
scores.push(nextTokenProb);
|
|
50
|
-
if (nextTokenId === this.endOfTextToken) {
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
sequencesIds: sequencesIds.slice(initialSequence.length),
|
|
56
|
-
scores: scores.slice(initialSequence.length)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
softmaxWithTemperature(logits, temperature = 1.0) {
|
|
60
|
-
const max = Math.max(...logits);
|
|
61
|
-
const exps = logits.map(logit => Math.exp((logit - max) / temperature));
|
|
62
|
-
const sum = exps.reduce((a, b) => a + b, 0);
|
|
63
|
-
return exps.map(exp => exp / sum);
|
|
64
|
-
}
|
|
65
|
-
sampleFromDistribution(probs) {
|
|
66
|
-
const r = Math.random();
|
|
67
|
-
let cumulative = 0;
|
|
68
|
-
for (let i = 0; i < probs.length; i++) {
|
|
69
|
-
cumulative += probs[i];
|
|
70
|
-
if (r < cumulative) {
|
|
71
|
-
return i;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return probs.length - 1;
|
|
75
|
-
}
|
|
76
|
-
async generateWithFallback(audio, options) {
|
|
77
|
-
const temperatures = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0];
|
|
78
|
-
let generatedTokens = [];
|
|
79
|
-
for (const temperature of temperatures) {
|
|
80
|
-
const result = await this.generate(audio, temperature, options);
|
|
81
|
-
const tokens = result.sequencesIds;
|
|
82
|
-
const scores = result.scores;
|
|
83
|
-
const seqLen = tokens.length;
|
|
84
|
-
const cumLogProb = scores.reduce((acc, score) => acc + Math.log(score), 0);
|
|
85
|
-
const avgLogProb = cumLogProb / seqLen;
|
|
86
|
-
if (avgLogProb >= -1.0) {
|
|
87
|
-
generatedTokens = tokens;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return this.calculateWordLevelTimestamps(generatedTokens, audio);
|
|
92
|
-
}
|
|
93
|
-
async calculateWordLevelTimestamps(generatedTokens, audio) {
|
|
94
|
-
const segments = [];
|
|
95
|
-
let tokens = [];
|
|
96
|
-
let prevTimestamp = this.timestampBeginToken;
|
|
97
|
-
for (let i = 0; i < generatedTokens.length; i++) {
|
|
98
|
-
if (generatedTokens[i] < this.timestampBeginToken) {
|
|
99
|
-
tokens.push(generatedTokens[i]);
|
|
100
|
-
}
|
|
101
|
-
if (i > 0 && generatedTokens[i - 1] >= this.timestampBeginToken && generatedTokens[i] >= this.timestampBeginToken) {
|
|
102
|
-
const start = prevTimestamp;
|
|
103
|
-
const end = generatedTokens[i - 1];
|
|
104
|
-
const wordObjects = await this.estimateWordTimestampsLinear(tokens, start, end);
|
|
105
|
-
segments.push({
|
|
106
|
-
words: wordObjects
|
|
107
|
-
});
|
|
108
|
-
tokens = [];
|
|
109
|
-
prevTimestamp = generatedTokens[i];
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const start = prevTimestamp;
|
|
113
|
-
const end = generatedTokens.at(-2);
|
|
114
|
-
const wordObjects = await this.estimateWordTimestampsLinear(tokens, start, end);
|
|
115
|
-
segments.push({
|
|
116
|
-
words: wordObjects
|
|
117
|
-
});
|
|
118
|
-
const scalingFactor = audio.length / this.samplingRate / ((end - this.timestampBeginToken) * this.timePrecision);
|
|
119
|
-
if (scalingFactor < 1) {
|
|
120
|
-
for (const segment of segments) {
|
|
121
|
-
for (const word of segment.words) {
|
|
122
|
-
word.start *= scalingFactor;
|
|
123
|
-
word.end *= scalingFactor;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return segments;
|
|
128
|
-
}
|
|
129
|
-
async estimateWordTimestampsLinear(tokens, start, end) {
|
|
130
|
-
const duration = (end - start) * this.timePrecision;
|
|
131
|
-
const segmentText = (await this.tokenizerModule.decode(tokens)).trim();
|
|
132
|
-
const words = segmentText.split(' ').map(w => ` ${w}`);
|
|
133
|
-
const numOfCharacters = words.reduce((acc, word) => acc + word.length, 0);
|
|
134
|
-
const timePerCharacter = duration / numOfCharacters;
|
|
135
|
-
const wordObjects = [];
|
|
136
|
-
const startTimeOffset = (start - this.timestampBeginToken) * this.timePrecision;
|
|
137
|
-
let prevCharNum = 0;
|
|
138
|
-
for (let j = 0; j < words.length; j++) {
|
|
139
|
-
const word = words[j];
|
|
140
|
-
const start = startTimeOffset + prevCharNum * timePerCharacter;
|
|
141
|
-
const end = start + timePerCharacter * word.length;
|
|
142
|
-
wordObjects.push({
|
|
143
|
-
word,
|
|
144
|
-
start,
|
|
145
|
-
end
|
|
146
|
-
});
|
|
147
|
-
prevCharNum += word.length;
|
|
148
|
-
}
|
|
149
|
-
return wordObjects;
|
|
150
|
-
}
|
|
151
|
-
async transcribe(audio, options) {
|
|
152
|
-
let seek = 0;
|
|
153
|
-
const allSegments = [];
|
|
154
|
-
while (seek * this.samplingRate < audio.length) {
|
|
155
|
-
const chunk = audio.slice(seek * this.samplingRate, (seek + this.chunkSize) * this.samplingRate);
|
|
156
|
-
if (chunk.length < this.minChunkSamples) {
|
|
157
|
-
return allSegments;
|
|
158
|
-
}
|
|
159
|
-
const segments = await this.generateWithFallback(chunk, options);
|
|
160
|
-
for (const segment of segments) {
|
|
161
|
-
for (const word of segment.words) {
|
|
162
|
-
word.start += seek;
|
|
163
|
-
word.end += seek;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
allSegments.push(...segments);
|
|
167
|
-
const lastTimeStamp = segments.at(-1).words.at(-1).end;
|
|
168
|
-
seek = lastTimeStamp;
|
|
169
|
-
}
|
|
170
|
-
return allSegments;
|
|
171
|
-
}
|
|
172
|
-
tsWords(segments) {
|
|
173
|
-
const o = [];
|
|
174
|
-
for (const segment of segments) {
|
|
175
|
-
for (const word of segment.words) {
|
|
176
|
-
o.push([word.start, word.end, word.word]);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return o;
|
|
180
|
-
}
|
|
181
|
-
segmentsEndTs(res) {
|
|
182
|
-
return res.map(segment => segment.words.at(-1).end);
|
|
183
|
-
}
|
|
184
|
-
async encode(waveform) {
|
|
185
|
-
await this.nativeModule.encode(waveform);
|
|
186
|
-
}
|
|
187
|
-
async decode(tokens) {
|
|
188
|
-
return new Float32Array(await this.nativeModule.decode(tokens));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=ASR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TokenizerModule","ResourceFetcher","ASR","tokenizerModule","timePrecision","maxDecodeLength","chunkSize","minChunkSamples","samplingRate","load","model","onDownloadProgressCallback","tokenizerLoadPromise","encoderDecoderPromise","fetch","encoderSource","decoderSource","_","encoderDecoderResults","Promise","all","Error","nativeModule","global","loadSpeechToText","startOfTranscriptToken","tokenToId","endOfTextToken","timestampBeginToken","getInitialSequence","options","initialSequence","language","languageToken","taskToken","push","generate","audio","temperature","encode","Float32Array","sequencesIds","scores","length","logits","softmaxWithTemperature","Array","from","decode","nextTokenId","indexOf","Math","max","sampleFromDistribution","nextTokenProb","slice","exps","map","logit","exp","sum","reduce","a","b","probs","r","random","cumulative","i","generateWithFallback","temperatures","generatedTokens","result","tokens","seqLen","cumLogProb","acc","score","log","avgLogProb","calculateWordLevelTimestamps","segments","prevTimestamp","start","end","wordObjects","estimateWordTimestampsLinear","words","at","scalingFactor","segment","word","duration","segmentText","trim","split","w","numOfCharacters","timePerCharacter","startTimeOffset","prevCharNum","j","transcribe","seek","allSegments","chunk","lastTimeStamp","tsWords","o","segmentsEndTs","res","waveform"],"sourceRoot":"../../../../src","sources":["utils/SpeechToTextModule/ASR.ts"],"mappings":";;AAAA;;AAEA,SAASA,eAAe,QAAQ,2DAA2D;AAQ3F,SAASC,eAAe,QAAQ,oBAAoB;AAEpD,OAAO,MAAMC,GAAG,CAAC;EAEPC,eAAe,GAAoB,IAAIH,eAAe,CAAC,CAAC;EAExDI,aAAa,GAAW,IAAI,CAAC,CAAC;EAC9BC,eAAe,GAAW,GAAG;EAC7BC,SAAS,GAAW,EAAE,CAAC,CAAC;EACxBC,eAAe,GAAW,CAAC,GAAG,KAAK,CAAC,CAAC;EACrCC,YAAY,GAAW,KAAK;EAMpC,MAAaC,IAAIA,CACfC,KAA8B,EAC9BC,0BAAsD,EACtD;IACA,MAAMC,oBAAoB,GAAG,IAAI,CAACT,eAAe,CAACM,IAAI,CAACC,KAAK,CAAC;IAC7D,MAAMG,qBAAqB,GAAGZ,eAAe,CAACa,KAAK,CACjDH,0BAA0B,EAC1BD,KAAK,CAACK,aAAa,EACnBL,KAAK,CAACM,aACR,CAAC;IACD,MAAM,CAACC,CAAC,EAAEC,qBAAqB,CAAC,GAAG,MAAMC,OAAO,CAACC,GAAG,CAAC,CACnDR,oBAAoB,EACpBC,qBAAqB,CACtB,CAAC;IACF,MAAME,aAAa,GAAGG,qBAAqB,GAAG,CAAC,CAAC;IAChD,MAAMF,aAAa,GAAGE,qBAAqB,GAAG,CAAC,CAAC;IAChD,IAAI,CAACH,aAAa,IAAI,CAACC,aAAa,EAAE;MACpC,MAAM,IAAIK,KAAK,CAAC,uBAAuB,CAAC;IAC1C;IACA,IAAI,CAACC,YAAY,GAAG,MAAMC,MAAM,CAACC,gBAAgB,CAC/CT,aAAa,EACbC,aAAa,EAC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QAAmB,EAAe;IAC/C,MAAM2B,CAAc,GAAG,EAAE;IACzB,KAAK,MAAMlB,OAAO,IAAIT,QAAQ,EAAE;MAC9B,KAAK,MAAMU,IAAI,IAAID,OAAO,CAACH,KAAK,EAAE;QAChCqB,CAAC,CAACzE,IAAI,CAAC,CAACwD,IAAI,CAACR,KAAK,EAAEQ,IAAI,CAACP,GAAG,EAAEO,IAAI,CAACA,IAAI,CAAC,CAAC;MAC3C;IACF;IACA,OAAOiB,CAAC;EACV;EAEOC,aAAaA,CAACC,GAAc,EAAE;IACnC,OAAOA,GAAG,CAACrD,GAAG,CAAEiC,OAAO,IAAKA,OAAO,CAACH,KAAK,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAEJ,GAAG,CAAC;EACxD;EAEA,MAAa7C,MAAMA,CAACwE,QAAsB,EAAiB;IACzD,MAAM,IAAI,CAACzF,YAAY,CAACiB,MAAM,CAACwE,QAAQ,CAAC;EAC1C;EAEA,MAAa/D,MAAMA,CAACyB,MAAgB,EAAyB;IAC3D,OAAO,IAAIjC,YAAY,CAAC,MAAM,IAAI,CAAClB,YAAY,CAAC0B,MAAM,CAACyB,MAAM,CAAC,CAAC;EACjE;AACF","ignoreList":[]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// NOTE: This will be implemented in C++
|
|
4
|
-
|
|
5
|
-
import { HypothesisBuffer } from './hypothesisBuffer';
|
|
6
|
-
export class OnlineASRProcessor {
|
|
7
|
-
samplingRate = 16000;
|
|
8
|
-
audioBuffer = [];
|
|
9
|
-
transcriptBuffer = new HypothesisBuffer();
|
|
10
|
-
bufferTimeOffset = 0;
|
|
11
|
-
committed = [];
|
|
12
|
-
constructor(asr) {
|
|
13
|
-
this.asr = asr;
|
|
14
|
-
}
|
|
15
|
-
insertAudioChunk(audio) {
|
|
16
|
-
this.audioBuffer.push(...audio);
|
|
17
|
-
}
|
|
18
|
-
async processIter(options) {
|
|
19
|
-
const res = await this.asr.transcribe(this.audioBuffer, options);
|
|
20
|
-
const tsw = this.asr.tsWords(res);
|
|
21
|
-
this.transcriptBuffer.insert(tsw, this.bufferTimeOffset);
|
|
22
|
-
const o = this.transcriptBuffer.flush();
|
|
23
|
-
this.committed.push(...o);
|
|
24
|
-
const s = 15;
|
|
25
|
-
if (this.audioBuffer.length / this.samplingRate > s) {
|
|
26
|
-
this.chunkCompletedSegment(res);
|
|
27
|
-
}
|
|
28
|
-
const committed = this.toFlush(o)[2];
|
|
29
|
-
const nonCommitted = this.transcriptBuffer.complete().map(x => x[2]).join('');
|
|
30
|
-
return {
|
|
31
|
-
committed,
|
|
32
|
-
nonCommitted
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
chunkCompletedSegment(res) {
|
|
36
|
-
if (this.committed.length === 0) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const ends = this.asr.segmentsEndTs(res);
|
|
40
|
-
const t = this.committed.at(-1)[1];
|
|
41
|
-
if (ends.length > 1) {
|
|
42
|
-
let e = ends.at(-2) + this.bufferTimeOffset;
|
|
43
|
-
while (ends.length > 2 && e > t) {
|
|
44
|
-
ends.pop();
|
|
45
|
-
e = ends.at(-2) + this.bufferTimeOffset;
|
|
46
|
-
}
|
|
47
|
-
if (e <= t) {
|
|
48
|
-
this.chunkAt(e);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
chunkAt(time) {
|
|
53
|
-
this.transcriptBuffer.popCommitted(time);
|
|
54
|
-
const cutSeconds = time - this.bufferTimeOffset;
|
|
55
|
-
this.audioBuffer = this.audioBuffer.slice(Math.floor(cutSeconds * this.samplingRate));
|
|
56
|
-
this.bufferTimeOffset = time;
|
|
57
|
-
}
|
|
58
|
-
async finish() {
|
|
59
|
-
const o = this.transcriptBuffer.complete();
|
|
60
|
-
const f = this.toFlush(o);
|
|
61
|
-
this.bufferTimeOffset += this.audioBuffer.length / this.samplingRate;
|
|
62
|
-
return {
|
|
63
|
-
committed: f[2]
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
toFlush(words) {
|
|
67
|
-
const t = words.map(s => s[2]).join(' ');
|
|
68
|
-
const b = words.length === 0 ? null : words[0][0];
|
|
69
|
-
const e = words.length === 0 ? null : words.at(-1)[1];
|
|
70
|
-
return [b, e, t];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=OnlineProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["HypothesisBuffer","OnlineASRProcessor","samplingRate","audioBuffer","transcriptBuffer","bufferTimeOffset","committed","constructor","asr","insertAudioChunk","audio","push","processIter","options","res","transcribe","tsw","tsWords","insert","o","flush","s","length","chunkCompletedSegment","toFlush","nonCommitted","complete","map","x","join","ends","segmentsEndTs","t","at","e","pop","chunkAt","time","popCommitted","cutSeconds","slice","Math","floor","finish","f","words","b"],"sourceRoot":"../../../../src","sources":["utils/SpeechToTextModule/OnlineProcessor.ts"],"mappings":";;AAAA;;AAIA,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD,OAAO,MAAMC,kBAAkB,CAAC;EAGtBC,YAAY,GAAW,KAAK;EAC7BC,WAAW,GAAa,EAAE;EACzBC,gBAAgB,GAAqB,IAAIJ,gBAAgB,CAAC,CAAC;EAC3DK,gBAAgB,GAAW,CAAC;EAC5BC,SAAS,GAAgB,EAAE;EAEnCC,WAAWA,CAACC,GAAQ,EAAE;IACpB,IAAI,CAACA,GAAG,GAAGA,GAAG;EAChB;EAEOC,gBAAgBA,CAACC,KAAe,EAAE;IACvC,IAAI,CAACP,WAAW,CAACQ,IAAI,CAAC,GAAGD,KAAK,CAAC;EACjC;EAEA,MAAaE,WAAWA,CAACC,OAAwB,EAAE;IACjD,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACN,GAAG,CAACO,UAAU,CAAC,IAAI,CAACZ,WAAW,EAAEU,OAAO,CAAC;IAChE,MAAMG,GAAG,GAAG,IA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AAGW,KAAK,CAACvB,MAAM,KAAK,CAAC,GAAG,IAAI,GAAGuB,KAAK,CAACZ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACtD,OAAO,CAACa,CAAC,EAAEZ,CAAC,EAAEF,CAAC,CAAC;EAClB;AACF","ignoreList":[]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// NOTE: This will be implemented in C++
|
|
4
|
-
|
|
5
|
-
export class HypothesisBuffer {
|
|
6
|
-
committedInBuffer = [];
|
|
7
|
-
buffer = [];
|
|
8
|
-
new = [];
|
|
9
|
-
lastCommittedTime = 0;
|
|
10
|
-
lastCommittedWord = null;
|
|
11
|
-
insert(newWords, offset) {
|
|
12
|
-
const newWordsOffset = newWords.map(([a, b, t]) => [a + offset, b + offset, t]);
|
|
13
|
-
this.new = newWordsOffset.filter(([a, _b, _t]) => a > this.lastCommittedTime - 0.5);
|
|
14
|
-
if (this.new.length > 0) {
|
|
15
|
-
const [a, _b, _t] = this.new[0];
|
|
16
|
-
if (Math.abs(a - this.lastCommittedTime) < 1 && this.committedInBuffer.length > 0) {
|
|
17
|
-
const cn = this.committedInBuffer.length;
|
|
18
|
-
const nn = this.new.length;
|
|
19
|
-
for (let i = 1; i <= Math.min(cn, nn, 5); i++) {
|
|
20
|
-
const c = this.committedInBuffer.slice(-i).map(w => w[2]).join(' ');
|
|
21
|
-
const tail = this.new.slice(0, i).map(w => w[2]).join(' ');
|
|
22
|
-
if (c === tail) {
|
|
23
|
-
for (let j = 0; j < i; j++) {
|
|
24
|
-
this.new.shift();
|
|
25
|
-
}
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
flush() {
|
|
33
|
-
const commit = [];
|
|
34
|
-
while (this.new.length > 0 && this.buffer.length > 0) {
|
|
35
|
-
if (this.new[0][2] !== this.buffer[0][2]) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
commit.push(this.new[0]);
|
|
39
|
-
this.lastCommittedWord = this.new[0][2];
|
|
40
|
-
this.lastCommittedTime = this.new[0][1];
|
|
41
|
-
this.buffer.shift();
|
|
42
|
-
this.new.shift();
|
|
43
|
-
}
|
|
44
|
-
this.buffer = this.new;
|
|
45
|
-
this.new = [];
|
|
46
|
-
this.committedInBuffer.push(...commit);
|
|
47
|
-
return commit;
|
|
48
|
-
}
|
|
49
|
-
popCommitted(time) {
|
|
50
|
-
this.committedInBuffer = this.committedInBuffer.filter(([_a, b, _t]) => b > time);
|
|
51
|
-
}
|
|
52
|
-
complete() {
|
|
53
|
-
return this.buffer;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=hypothesisBuffer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["HypothesisBuffer","committedInBuffer","buffer","new","lastCommittedTime","lastCommittedWord","insert","newWords","offset","newWordsOffset","map","a","b","t","filter","_b","_t","length","Math","abs","cn","nn","i","min","c","slice","w","join","tail","j","shift","flush","commit","push","popCommitted","time","_a","complete"],"sourceRoot":"../../../../src","sources":["utils/SpeechToTextModule/hypothesisBuffer.ts"],"mappings":";;AAAA;;AAIA,OAAO,MAAMA,gBAAgB,CAAC;EACpBC,iBAAiB,GAAgB,EAAE;EACnCC,MAAM,GAAgB,EAAE;EACxBC,GAAG,GAAgB,EAAE;EAErBC,iBAAiB,GAAW,CAAC;EAC9BC,iBAAiB,GAAkB,IAAI;EAEvCC,MAAMA,CAACC,QAAqB,EAAEC,MAAc,EAAE;IACnD,MAAMC,cAA2B,GAAGF,QAAQ,CAACG,GAAG,CAAC,CAAC,CAACC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC,KAAK,CAC9DF,CAAC,GAAGH,MAAM,EACVI,CAAC,GAAGJ,MAAM,EACVK,CAAC,CACF,CAAC;IACF,IAAI,CAACV,GAAG,GAAGM,cAA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
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export const longCommonInfPref = (seq1, seq2, hammingDistThreshold) => {
|
|
4
|
-
let maxInd = 0;
|
|
5
|
-
let maxLength = 0;
|
|
6
|
-
for (let i = 0; i < seq1.length; i++) {
|
|
7
|
-
let j = 0;
|
|
8
|
-
let hammingDist = 0;
|
|
9
|
-
while (j < seq2.length && i + j < seq1.length && (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
|
-
};
|
|
22
|
-
//# sourceMappingURL=stt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["longCommonInfPref","seq1","seq2","hammingDistThreshold","maxInd","maxLength","i","length","j","hammingDist"],"sourceRoot":"../../../src","sources":["utils/stt.ts"],"mappings":";;AAAA,OAAO,MAAMA,iBAAiB,GAAGA,CAC/BC,IAAc,EACdC,IAAc,EACdC,oBAA4B,KACzB;EACH,IAAIC,MAAM,GAAG,CAAC;EACd,IAAIC,SAAS,GAAG,CAAC;EAEjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAIE,CAAC,GAAG,CAAC;IACT,IAAIC,WAAW,GAAG,CAAC;IACnB,OACED,CAAC,GAAGN,IAAI,CAACK,MAAM,IACfD,CAAC,GAAGE,CAAC,GAAGP,IAAI,CAACM,MAAM,KAClBN,IAAI,CAACK,CAAC,GAAGE,CAAC,CAAC,KAAKN,IAAI,CAACM,CAAC,CAAC,IAAIC,WAAW,GAAGN,oBAAoB,CAAC,EAC/D;MACA,IAAIF,IAAI,CAACK,CAAC,GAAGE,CAAC,CAAC,KAAKN,IAAI,CAACM,CAAC,CAAC,EAAE;QAC3BC,WAAW,EAAE;MACf;MACAD,CAAC,EAAE;IACL;IACA,IAAIA,CAAC,IAAIH,SAAS,EAAE;MAClBA,SAAS,GAAGG,CAAC;MACbJ,MAAM,GAAGE,CAAC;IACZ;EACF;EACA,OAAOF,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ResourceSource } from '../types/common';
|
|
2
|
-
export declare class BaseModule {
|
|
3
|
-
protected static nativeModule: any;
|
|
4
|
-
static onDownloadProgressCallback: (downloadProgress: number) => void;
|
|
5
|
-
static load(sources: ResourceSource[], ...loadArgs: any[]): Promise<void>;
|
|
6
|
-
protected static forward(..._args: any[]): Promise<any>;
|
|
7
|
-
static onDownloadProgress(callback: (downloadProgress: number) => void): void;
|
|
8
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ResourceSource } from '../types/common';
|
|
2
|
-
import { TensorPtr } from '../types/common';
|
|
3
|
-
export declare abstract class BaseNonStaticModule {
|
|
4
|
-
nativeModule: any;
|
|
5
|
-
abstract load(modelSource: ResourceSource, onDownloadProgressCallback: (_: number) => void, ...args: any[]): Promise<void>;
|
|
6
|
-
protected forwardET(inputTensor: TensorPtr[]): Promise<TensorPtr[]>;
|
|
7
|
-
getInputShape(methodName: string, index: number): Promise<number[]>;
|
|
8
|
-
delete(): void;
|
|
9
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
|
-
import { OCRDetection } from '../types/ocr';
|
|
3
|
-
export interface Spec extends TurboModule {
|
|
4
|
-
loadModule(detectorSource: string, recognizerSourceLarge: string, recognizerSourceMedium: string, recognizerSourceSmall: string, symbols: string): Promise<number>;
|
|
5
|
-
forward(input: string): Promise<OCRDetection[]>;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: Spec | null;
|
|
8
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
|
-
import { OCRDetection } from '../types/ocr';
|
|
3
|
-
export interface Spec extends TurboModule {
|
|
4
|
-
loadModule(detectorLargeSource: string, detectorNarrowSource: string, recognizerSource: string, symbols: string, independentCharacters: boolean): Promise<number>;
|
|
5
|
-
forward(input: string): Promise<OCRDetection[]>;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: Spec | null;
|
|
8
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare enum DeeplabLabel {
|
|
2
|
-
BACKGROUND = 0,
|
|
3
|
-
AEROPLANE = 1,
|
|
4
|
-
BICYCLE = 2,
|
|
5
|
-
BIRD = 3,
|
|
6
|
-
BOAT = 4,
|
|
7
|
-
BOTTLE = 5,
|
|
8
|
-
BUS = 6,
|
|
9
|
-
CAR = 7,
|
|
10
|
-
CAT = 8,
|
|
11
|
-
CHAIR = 9,
|
|
12
|
-
COW = 10,
|
|
13
|
-
DININGTABLE = 11,
|
|
14
|
-
DOG = 12,
|
|
15
|
-
HORSE = 13,
|
|
16
|
-
MOTORBIKE = 14,
|
|
17
|
-
PERSON = 15,
|
|
18
|
-
POTTEDPLANT = 16,
|
|
19
|
-
SHEEP = 17,
|
|
20
|
-
SOFA = 18,
|
|
21
|
-
TRAIN = 19,
|
|
22
|
-
TVMONITOR = 20,
|
|
23
|
-
ARGMAX = 21
|
|
24
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export interface Bbox {
|
|
2
|
-
x1: number;
|
|
3
|
-
x2: number;
|
|
4
|
-
y1: number;
|
|
5
|
-
y2: number;
|
|
6
|
-
}
|
|
7
|
-
export interface Detection {
|
|
8
|
-
bbox: Bbox;
|
|
9
|
-
label: keyof typeof CocoLabel;
|
|
10
|
-
score: number;
|
|
11
|
-
}
|
|
12
|
-
declare enum CocoLabel {
|
|
13
|
-
PERSON = 1,
|
|
14
|
-
BICYCLE = 2,
|
|
15
|
-
CAR = 3,
|
|
16
|
-
MOTORCYCLE = 4,
|
|
17
|
-
AIRPLANE = 5,
|
|
18
|
-
BUS = 6,
|
|
19
|
-
TRAIN = 7,
|
|
20
|
-
TRUCK = 8,
|
|
21
|
-
BOAT = 9,
|
|
22
|
-
TRAFFIC_LIGHT = 10,
|
|
23
|
-
FIRE_HYDRANT = 11,
|
|
24
|
-
STREET_SIGN = 12,
|
|
25
|
-
STOP_SIGN = 13,
|
|
26
|
-
PARKING = 14,
|
|
27
|
-
BENCH = 15,
|
|
28
|
-
BIRD = 16,
|
|
29
|
-
CAT = 17,
|
|
30
|
-
DOG = 18,
|
|
31
|
-
HORSE = 19,
|
|
32
|
-
SHEEP = 20,
|
|
33
|
-
COW = 21,
|
|
34
|
-
ELEPHANT = 22,
|
|
35
|
-
BEAR = 23,
|
|
36
|
-
ZEBRA = 24,
|
|
37
|
-
GIRAFFE = 25,
|
|
38
|
-
HAT = 26,
|
|
39
|
-
BACKPACK = 27,
|
|
40
|
-
UMBRELLA = 28,
|
|
41
|
-
SHOE = 29,
|
|
42
|
-
EYE = 30,
|
|
43
|
-
HANDBAG = 31,
|
|
44
|
-
TIE = 32,
|
|
45
|
-
SUITCASE = 33,
|
|
46
|
-
FRISBEE = 34,
|
|
47
|
-
SKIS = 35,
|
|
48
|
-
SNOWBOARD = 36,
|
|
49
|
-
SPORTS = 37,
|
|
50
|
-
KITE = 38,
|
|
51
|
-
BASEBALL = 39,
|
|
52
|
-
SKATEBOARD = 41,
|
|
53
|
-
SURFBOARD = 42,
|
|
54
|
-
TENNIS_RACKET = 43,
|
|
55
|
-
BOTTLE = 44,
|
|
56
|
-
PLATE = 45,
|
|
57
|
-
WINE_GLASS = 46,
|
|
58
|
-
CUP = 47,
|
|
59
|
-
FORK = 48,
|
|
60
|
-
KNIFE = 49,
|
|
61
|
-
SPOON = 50,
|
|
62
|
-
BOWL = 51,
|
|
63
|
-
BANANA = 52,
|
|
64
|
-
APPLE = 53,
|
|
65
|
-
SANDWICH = 54,
|
|
66
|
-
ORANGE = 55,
|
|
67
|
-
BROCCOLI = 56,
|
|
68
|
-
CARROT = 57,
|
|
69
|
-
HOT_DOG = 58,
|
|
70
|
-
PIZZA = 59,
|
|
71
|
-
DONUT = 60,
|
|
72
|
-
CAKE = 61,
|
|
73
|
-
CHAIR = 62,
|
|
74
|
-
COUCH = 63,
|
|
75
|
-
POTTED_PLANT = 64,
|
|
76
|
-
BED = 65,
|
|
77
|
-
MIRROR = 66,
|
|
78
|
-
DINING_TABLE = 67,
|
|
79
|
-
WINDOW = 68,
|
|
80
|
-
DESK = 69,
|
|
81
|
-
TOILET = 70,
|
|
82
|
-
DOOR = 71,
|
|
83
|
-
TV = 72,
|
|
84
|
-
LAPTOP = 73,
|
|
85
|
-
MOUSE = 74,
|
|
86
|
-
REMOTE = 75,
|
|
87
|
-
KEYBOARD = 76,
|
|
88
|
-
CELL_PHONE = 77,
|
|
89
|
-
MICROWAVE = 78,
|
|
90
|
-
OVEN = 79,
|
|
91
|
-
TOASTER = 80,
|
|
92
|
-
SINK = 81,
|
|
93
|
-
REFRIGERATOR = 82,
|
|
94
|
-
BLENDER = 83,
|
|
95
|
-
BOOK = 84,
|
|
96
|
-
CLOCK = 85,
|
|
97
|
-
VASE = 86,
|
|
98
|
-
SCISSORS = 87,
|
|
99
|
-
TEDDY_BEAR = 88,
|
|
100
|
-
HAIR_DRIER = 89,
|
|
101
|
-
TOOTHBRUSH = 90,
|
|
102
|
-
HAIR_BRUSH = 91
|
|
103
|
-
}
|
|
104
|
-
export {};
|
package/lib/types/ocr.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ResourceSource } from '../types/common';
|
|
2
|
-
import { TensorPtr } from '../types/common';
|
|
3
|
-
export declare abstract class BaseNonStaticModule {
|
|
4
|
-
nativeModule: any;
|
|
5
|
-
abstract load(modelSource: ResourceSource, onDownloadProgressCallback: (_: number) => void, ...args: any[]): Promise<void>;
|
|
6
|
-
protected forwardET(inputTensor: TensorPtr[]): Promise<TensorPtr[]>;
|
|
7
|
-
getInputShape(methodName: string, index: number): Promise<number[]>;
|
|
8
|
-
delete(): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=BaseNonStaticModule.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNonStaticModule.d.ts","sourceRoot":"","sources":["../../../src/modules/BaseNonStaticModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,8BAAsB,mBAAmB;IACvC,YAAY,EAAE,GAAG,CAAQ;IAEzB,QAAQ,CAAC,IAAI,CACX,WAAW,EAAE,cAAc,EAC3B,0BAA0B,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAC/C,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,OAAO,CAAC,IAAI,CAAC;cAEA,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAInE,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzE,MAAM;CAKP"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
|
-
import type { EventEmitter } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
-
export interface Spec extends TurboModule {
|
|
4
|
-
loadLLM(modelSource: string, tokenizerSource: string): Promise<string>;
|
|
5
|
-
forward(input: string): Promise<string>;
|
|
6
|
-
interrupt(): void;
|
|
7
|
-
releaseResources(): void;
|
|
8
|
-
readonly onToken: EventEmitter<string>;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: Spec | null;
|
|
11
|
-
export default _default;
|
|
12
|
-
//# sourceMappingURL=NativeLLM.d.ts.map
|