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
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// Adopted from https://github.com/sewenew/tokenizer
|
|
10
|
-
|
|
11
|
-
// @lint-ignore-every LICENSELINT
|
|
12
|
-
/**************************************************************************
|
|
13
|
-
Copyright (c) 2023 sewenew
|
|
14
|
-
|
|
15
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
16
|
-
you may not use this file except in compliance with the License.
|
|
17
|
-
You may obtain a copy of the License at
|
|
18
|
-
|
|
19
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
-
|
|
21
|
-
Unless required by applicable law or agreed to in writing, software
|
|
22
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
23
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
|
-
See the License for the specific language governing permissions and
|
|
25
|
-
limitations under the License.
|
|
26
|
-
*************************************************************************/
|
|
27
|
-
|
|
28
|
-
#include "tiktoken.h"
|
|
29
|
-
#include "base64.h"
|
|
30
|
-
#include <executorch/runtime/core/result.h>
|
|
31
|
-
#include <fstream>
|
|
32
|
-
#include <limits>
|
|
33
|
-
|
|
34
|
-
using ::executorch::runtime::Error;
|
|
35
|
-
using ::executorch::runtime::Result;
|
|
36
|
-
|
|
37
|
-
namespace executorch {
|
|
38
|
-
namespace extension {
|
|
39
|
-
namespace llm {
|
|
40
|
-
|
|
41
|
-
// ------------------------------Util start------------------------------------
|
|
42
|
-
|
|
43
|
-
static uint64_t _max_size() { return std::numeric_limits<uint64_t>::max(); }
|
|
44
|
-
|
|
45
|
-
static Re2UPtr _create_regex(const std::string &pattern) {
|
|
46
|
-
assert(!pattern.empty());
|
|
47
|
-
|
|
48
|
-
return std::make_unique<re2::RE2>("(" + pattern + ")");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static Re2UPtr _build_special_token_regex(const Encoder &special_encoder) {
|
|
52
|
-
std::string special_pattern;
|
|
53
|
-
for (const auto &ele : special_encoder) {
|
|
54
|
-
if (!special_pattern.empty()) {
|
|
55
|
-
special_pattern += "|";
|
|
56
|
-
}
|
|
57
|
-
special_pattern += re2::RE2::QuoteMeta(ele.first);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (special_pattern.empty()) {
|
|
61
|
-
return nullptr;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return _create_regex(special_pattern);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static Result<std::pair<std::string, uint64_t>>
|
|
68
|
-
_parse(const std::string &line) {
|
|
69
|
-
// Tiktoken format
|
|
70
|
-
// https://github.com/openai/tiktoken/blob/main/tiktoken/load.py#L140 <base64
|
|
71
|
-
// encoded token str> <rank>
|
|
72
|
-
auto pos = line.find(" ");
|
|
73
|
-
ET_CHECK_OR_RETURN_ERROR(pos != std::string::npos, InvalidArgument,
|
|
74
|
-
"invalid tiktoken line: %s", line.c_str());
|
|
75
|
-
|
|
76
|
-
auto token = ET_UNWRAP(base64::decode({line.data(), pos}));
|
|
77
|
-
uint64_t rank = 0;
|
|
78
|
-
try {
|
|
79
|
-
rank = std::stoul(line.substr(pos + 1));
|
|
80
|
-
} catch (const std::exception &) {
|
|
81
|
-
ET_CHECK_OR_RETURN_ERROR(false, InvalidArgument, "invalid encoder rank: %s",
|
|
82
|
-
line.c_str());
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return std::pair{std::move(token), rank};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
static Result<Encoder> _load_encoder(const std::string &path) {
|
|
89
|
-
std::ifstream file(path);
|
|
90
|
-
ET_CHECK_OR_RETURN_ERROR(file, InvalidArgument,
|
|
91
|
-
"failed to open encoder file: %s", path.c_str());
|
|
92
|
-
|
|
93
|
-
Encoder encoder;
|
|
94
|
-
std::string line;
|
|
95
|
-
while (std::getline(file, line)) {
|
|
96
|
-
auto [token, rank] = ET_UNWRAP(_parse(line));
|
|
97
|
-
|
|
98
|
-
ET_CHECK_OR_RETURN_ERROR(encoder.emplace(std::move(token), rank).second,
|
|
99
|
-
InvalidArgument, "duplicate item: %s",
|
|
100
|
-
line.c_str());
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return encoder;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
static Result<Decoder> _build_decoder(const Encoder &encoder) {
|
|
107
|
-
Decoder decoder;
|
|
108
|
-
for (const auto &[k, v] : encoder) {
|
|
109
|
-
decoder.emplace(v, k);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
ET_CHECK_OR_RETURN_ERROR(encoder.size() == decoder.size(), InvalidArgument,
|
|
113
|
-
"duplicate items in encoder");
|
|
114
|
-
|
|
115
|
-
return decoder;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static std::vector<uint64_t>
|
|
119
|
-
_byte_pair_merge(const std::string &piece,
|
|
120
|
-
const std::unordered_map<std::string, uint64_t> &ranks,
|
|
121
|
-
std::function<uint64_t(uint64_t, uint64_t)> func) {
|
|
122
|
-
// This is a vector of (start, rank).
|
|
123
|
-
// The rank is of the byte pair starting at position start.
|
|
124
|
-
// The rank of the last item in the vector is not a valid value.
|
|
125
|
-
std::vector<std::pair<uint64_t, uint64_t>> parts;
|
|
126
|
-
parts.reserve(piece.size() + 1);
|
|
127
|
-
for (auto idx = 0U; idx < piece.size() + 1; ++idx) {
|
|
128
|
-
parts.emplace_back(idx, _max_size());
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
auto get_rank =
|
|
132
|
-
[&piece, &ranks](const std::vector<std::pair<uint64_t, uint64_t>> &parts,
|
|
133
|
-
uint64_t start_idx,
|
|
134
|
-
uint64_t skip) -> std::optional<uint64_t> {
|
|
135
|
-
if (start_idx + skip + 2 < parts.size()) {
|
|
136
|
-
auto s = parts[start_idx].first;
|
|
137
|
-
auto e = parts[start_idx + skip + 2].first;
|
|
138
|
-
auto key = piece.substr(s, e - s);
|
|
139
|
-
auto iter = ranks.find(key);
|
|
140
|
-
if (iter != ranks.end()) {
|
|
141
|
-
return iter->second;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return std::nullopt;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// We look up the ranks once in the beginning and iteratively update
|
|
148
|
-
// them during each merge, which reduces the number of rank lookups.
|
|
149
|
-
for (auto i = 0U; i < parts.size() - 2; ++i) {
|
|
150
|
-
auto rank = get_rank(parts, i, 0);
|
|
151
|
-
if (rank) {
|
|
152
|
-
// usize::MAX is a sentinel value and cannot be a valid rank
|
|
153
|
-
ET_CHECK_MSG(*rank != _max_size(), "rank is too large");
|
|
154
|
-
parts[i].second = *rank;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// If you have n parts and m merges, this does O(mn) work.
|
|
159
|
-
// We could do something with a heap and do O(m log n) work.
|
|
160
|
-
// It is important to consider that n is often small (<100), and as such
|
|
161
|
-
// the cache-locality benefits outweigh the algorithmic complexity downsides
|
|
162
|
-
// of the `parts` vector data structure above.
|
|
163
|
-
|
|
164
|
-
// Note that we hash bytes, not token pairs. As long as we train BPE the way
|
|
165
|
-
// we currently do, this is equivalent. An easy way to break this would be
|
|
166
|
-
// to decouple merge priority from token index or to prevent specific token
|
|
167
|
-
// merges.
|
|
168
|
-
while (true) {
|
|
169
|
-
if (parts.size() == 1) {
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// usize::MAX is a sentinel rank value allowing us to
|
|
174
|
-
// take the min more quickly
|
|
175
|
-
auto min_rank = std::make_pair<uint64_t, uint64_t>(_max_size(), 0);
|
|
176
|
-
for (auto i = 0U; i < parts.size() - 1; ++i) {
|
|
177
|
-
auto rank = parts[i].second;
|
|
178
|
-
if (rank < min_rank.first) {
|
|
179
|
-
min_rank.first = rank;
|
|
180
|
-
min_rank.second = i;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (min_rank.first != _max_size()) {
|
|
185
|
-
auto i = min_rank.second;
|
|
186
|
-
|
|
187
|
-
// NOTE: We are about to remove parts[i + 1]. We do not do it
|
|
188
|
-
// yet because there are cache-locality benefits to updating
|
|
189
|
-
// parts[i] and parts[i-1] before removing, which could thrash
|
|
190
|
-
// the cache. Thus, we update the rank calculation by skipping over
|
|
191
|
-
// parts[i + 1], by invoking `get_rank!` with `skip = 1`.
|
|
192
|
-
auto rank = get_rank(parts, i, 1);
|
|
193
|
-
if (rank) {
|
|
194
|
-
parts[i].second = *rank;
|
|
195
|
-
} else {
|
|
196
|
-
parts[i].second = _max_size();
|
|
197
|
-
}
|
|
198
|
-
if (i > 0) {
|
|
199
|
-
rank = get_rank(parts, i - 1, 1);
|
|
200
|
-
if (rank) {
|
|
201
|
-
parts[i - 1].second = *rank;
|
|
202
|
-
} else {
|
|
203
|
-
parts[i - 1].second = _max_size();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
parts.erase(parts.begin() + (i + 1));
|
|
208
|
-
} else {
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
std::vector<uint64_t> out;
|
|
213
|
-
out.reserve(parts.size() - 1);
|
|
214
|
-
for (auto i = 0U; i < parts.size() - 1; ++i) {
|
|
215
|
-
auto s = parts[i].first;
|
|
216
|
-
auto e = parts[i + 1].first;
|
|
217
|
-
out.push_back(func(s, e));
|
|
218
|
-
}
|
|
219
|
-
return out;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
static std::vector<uint64_t> _byte_pair_encode(const std::string &piece,
|
|
223
|
-
const Encoder &encoder) {
|
|
224
|
-
if (piece.size() == 1) {
|
|
225
|
-
auto iter = encoder.find(piece);
|
|
226
|
-
if (iter != encoder.end()) {
|
|
227
|
-
return std::vector<uint64_t>({iter->second});
|
|
228
|
-
} else {
|
|
229
|
-
// TODO: is it possible?
|
|
230
|
-
return {};
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return _byte_pair_merge(piece, encoder,
|
|
235
|
-
[&piece, &encoder](uint64_t start, uint64_t stop) {
|
|
236
|
-
std::string key = piece.substr(start, stop - start);
|
|
237
|
-
auto iter = encoder.find(key);
|
|
238
|
-
if (iter != encoder.end()) {
|
|
239
|
-
return iter->second;
|
|
240
|
-
} else {
|
|
241
|
-
// TODO: what if key does not exist? Should we
|
|
242
|
-
// return `unknown`? assert(false); // ??
|
|
243
|
-
return uint64_t(0);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
// ------------------------------Util end------------------------------------
|
|
248
|
-
// -------------------------private method start-------------------------------
|
|
249
|
-
|
|
250
|
-
template <typename T>
|
|
251
|
-
std::pair<std::optional<std::string>, re2::StringPiece>
|
|
252
|
-
Tiktoken::_split_with_allowed_special_token(re2::StringPiece &input,
|
|
253
|
-
const T &allowed_special) const {
|
|
254
|
-
if (!_special_token_regex) {
|
|
255
|
-
return std::make_pair(std::nullopt, input);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
#if __cplusplus >= 202002L
|
|
259
|
-
auto start = input.begin();
|
|
260
|
-
#else
|
|
261
|
-
const char *start = input.data();
|
|
262
|
-
#endif
|
|
263
|
-
std::string special;
|
|
264
|
-
while (true) {
|
|
265
|
-
if (!re2::RE2::FindAndConsume(&input, *_special_token_regex, &special)) {
|
|
266
|
-
// No special token.
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (allowed_special.count(special) == 1) {
|
|
271
|
-
// Found an allowed special token, split the text with it.
|
|
272
|
-
#if __cplusplus >= 202002L
|
|
273
|
-
return std::make_pair(
|
|
274
|
-
special,
|
|
275
|
-
re2::StringPiece(start, input.begin() - start - special.size()));
|
|
276
|
-
#else
|
|
277
|
-
return std::make_pair(
|
|
278
|
-
special,
|
|
279
|
-
re2::StringPiece(start, (input.data() - start) - special.size()));
|
|
280
|
-
#endif
|
|
281
|
-
} // else try to find the next special token
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return std::make_pair(std::nullopt, input);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
void Tiktoken::_encode(re2::StringPiece &input, std::vector<uint64_t> &ret,
|
|
288
|
-
uint64_t &last_piece_token_len) const {
|
|
289
|
-
std::string piece;
|
|
290
|
-
assert(_regex);
|
|
291
|
-
while (re2::RE2::FindAndConsume(&input, *_regex, &piece)) {
|
|
292
|
-
auto iter = _encoder.find(piece);
|
|
293
|
-
if (iter != _encoder.end()) {
|
|
294
|
-
last_piece_token_len = 1;
|
|
295
|
-
ret.push_back(iter->second);
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
auto tokens = _byte_pair_encode(piece, _encoder);
|
|
299
|
-
last_piece_token_len = tokens.size();
|
|
300
|
-
ret.insert(ret.end(), tokens.begin(), tokens.end());
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
template <typename T>
|
|
305
|
-
std::pair<std::vector<uint64_t>, uint64_t>
|
|
306
|
-
Tiktoken::_encode_with_special_token(const std::string &text,
|
|
307
|
-
const T &allowed_special) const {
|
|
308
|
-
std::vector<uint64_t> tokens;
|
|
309
|
-
uint64_t last_piece_token_len = 0;
|
|
310
|
-
re2::StringPiece input(text);
|
|
311
|
-
while (true) {
|
|
312
|
-
auto [special, sub_input] =
|
|
313
|
-
_split_with_allowed_special_token(input, allowed_special);
|
|
314
|
-
|
|
315
|
-
_encode(sub_input, tokens, last_piece_token_len);
|
|
316
|
-
|
|
317
|
-
if (special) {
|
|
318
|
-
uint64_t token = 0;
|
|
319
|
-
try {
|
|
320
|
-
token = _special_token_encoder.at(*special);
|
|
321
|
-
} catch (const std::out_of_range &) {
|
|
322
|
-
// Should never go here, since special pattern includes all special
|
|
323
|
-
// chars.
|
|
324
|
-
ET_CHECK_MSG(false, "unknown special token: %s", special->c_str());
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
tokens.push_back(token);
|
|
328
|
-
last_piece_token_len = 0;
|
|
329
|
-
} else {
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// last_piece_token_len is how many tokens came from the last regex split.
|
|
335
|
-
// This is used for determining unstable tokens, since you can't merge
|
|
336
|
-
// across (stable) regex splits
|
|
337
|
-
return std::make_pair(tokens, last_piece_token_len);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
Encoder Tiktoken::_build_special_token_encoder(ssize_t num_base_tokens) const {
|
|
341
|
-
Encoder special_token_encoder;
|
|
342
|
-
for (ssize_t i = 0; i < _special_tokens->size(); ++i) {
|
|
343
|
-
special_token_encoder.emplace(_special_tokens->at(i), num_base_tokens + i);
|
|
344
|
-
}
|
|
345
|
-
return special_token_encoder;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// -------------------------private method end-------------------------------
|
|
349
|
-
// -------------------------public method start-------------------------------
|
|
350
|
-
|
|
351
|
-
Tiktoken::Tiktoken(std::unique_ptr<std::vector<std::string>> special_tokens,
|
|
352
|
-
size_t bos_token_index, size_t eos_token_index)
|
|
353
|
-
: Tokenizer(), _special_tokens(std::move(special_tokens)),
|
|
354
|
-
_bos_token_index(bos_token_index), _eos_token_index(eos_token_index) {
|
|
355
|
-
ET_CHECK_MSG(_bos_token_index < _special_tokens->size(),
|
|
356
|
-
"invalid bos_token_index %zu", _bos_token_index);
|
|
357
|
-
ET_CHECK_MSG(_eos_token_index < _special_tokens->size(),
|
|
358
|
-
"invalid eos_token_index %zu", _eos_token_index);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
Error Tiktoken::load(const std::string &path) {
|
|
362
|
-
_encoder = ET_UNWRAP(_load_encoder(path));
|
|
363
|
-
_special_token_encoder = _build_special_token_encoder(_encoder.size());
|
|
364
|
-
|
|
365
|
-
_decoder = ET_UNWRAP(_build_decoder(_encoder));
|
|
366
|
-
_special_token_decoder = ET_UNWRAP(_build_decoder(_special_token_encoder));
|
|
367
|
-
|
|
368
|
-
_regex = _create_regex(_pattern);
|
|
369
|
-
// Warmup re2 as it is slow on the first run, void the return value as it's
|
|
370
|
-
// not needed Refer to
|
|
371
|
-
// https://github.com/google/re2/blob/6dcd83d60f7944926bfd308cc13979fc53dd69ca/re2/fuzzing/re2_fuzzer.cc#L136-L141
|
|
372
|
-
(void)_regex->ReverseProgramSize();
|
|
373
|
-
|
|
374
|
-
_special_token_regex = _build_special_token_regex(_special_token_encoder);
|
|
375
|
-
// Same as above, warm up re2
|
|
376
|
-
(void)_special_token_regex->ReverseProgramSize();
|
|
377
|
-
|
|
378
|
-
// initialize vocab_size, bos_tok, eos_tok
|
|
379
|
-
vocab_size_ = _encoder.size() + _special_token_encoder.size();
|
|
380
|
-
bos_tok_ = _special_token_encoder.at(_special_tokens->at(_bos_token_index));
|
|
381
|
-
eos_tok_ = _special_token_encoder.at(_special_tokens->at(_eos_token_index));
|
|
382
|
-
|
|
383
|
-
initialized_ = true;
|
|
384
|
-
return Error::Ok;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
Result<std::vector<uint64_t>> Tiktoken::encode(const std::string &text,
|
|
388
|
-
int8_t bos, int8_t eos) const {
|
|
389
|
-
if (!initialized_) {
|
|
390
|
-
return Error::NotSupported;
|
|
391
|
-
}
|
|
392
|
-
auto res = _encode_with_special_token(text, _special_token_encoder).first;
|
|
393
|
-
for (auto i = 0; i < bos; ++i) {
|
|
394
|
-
res.insert(res.begin(), bos_tok_);
|
|
395
|
-
}
|
|
396
|
-
for (auto i = 0; i < eos; ++i) {
|
|
397
|
-
res.push_back(eos_tok_);
|
|
398
|
-
}
|
|
399
|
-
return Result<std::vector<uint64_t>>(std::move(res));
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
Result<std::string> Tiktoken::decode(uint64_t prev, uint64_t cur) const {
|
|
403
|
-
(void)prev;
|
|
404
|
-
ET_CHECK_OK_OR_RETURN_ERROR(Tokenizer::decode_verify(cur));
|
|
405
|
-
std::string ret;
|
|
406
|
-
|
|
407
|
-
std::string token_bytes;
|
|
408
|
-
auto iter = _decoder.find(cur);
|
|
409
|
-
if (iter != _decoder.end()) {
|
|
410
|
-
token_bytes = iter->second;
|
|
411
|
-
} else {
|
|
412
|
-
iter = _special_token_decoder.find(cur);
|
|
413
|
-
if (iter != _special_token_decoder.end()) {
|
|
414
|
-
token_bytes = iter->second;
|
|
415
|
-
} else {
|
|
416
|
-
ET_CHECK_MSG(false, "unknown token: %" PRIu64, cur);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
ret += token_bytes;
|
|
420
|
-
|
|
421
|
-
return ret;
|
|
422
|
-
}
|
|
423
|
-
// -------------------------public method end-------------------------------
|
|
424
|
-
|
|
425
|
-
} // namespace llm
|
|
426
|
-
} // namespace extension
|
|
427
|
-
} // namespace executorch
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#pragma once
|
|
10
|
-
|
|
11
|
-
#include "tokenizer.h"
|
|
12
|
-
#include <memory>
|
|
13
|
-
#include <optional>
|
|
14
|
-
#include <re2/re2.h>
|
|
15
|
-
#include <unordered_map>
|
|
16
|
-
|
|
17
|
-
namespace executorch {
|
|
18
|
-
namespace extension {
|
|
19
|
-
namespace llm {
|
|
20
|
-
|
|
21
|
-
using Encoder = std::unordered_map<std::string, uint64_t>;
|
|
22
|
-
using Decoder = std::unordered_map<uint64_t, std::string>;
|
|
23
|
-
using Re2UPtr = std::unique_ptr<re2::RE2>;
|
|
24
|
-
|
|
25
|
-
class Tiktoken : public Tokenizer {
|
|
26
|
-
public:
|
|
27
|
-
/**
|
|
28
|
-
* @param[in] special_tokens List of special tokens including bos, eos;
|
|
29
|
-
* @param[in] bos_token_index Index of the bos token in special_tokens;
|
|
30
|
-
* @param[in] eos_token_index Index of the eos token in special_tokens.
|
|
31
|
-
*/
|
|
32
|
-
explicit Tiktoken(std::unique_ptr<std::vector<std::string>> special_tokens,
|
|
33
|
-
size_t bos_token_index, size_t eos_token_index);
|
|
34
|
-
|
|
35
|
-
::executorch::runtime::Error load(const std::string &tokenizer_path) override;
|
|
36
|
-
|
|
37
|
-
::executorch::runtime::Result<std::vector<uint64_t>>
|
|
38
|
-
encode(const std::string &input, int8_t bos, int8_t eos) const override;
|
|
39
|
-
|
|
40
|
-
::executorch::runtime::Result<std::string>
|
|
41
|
-
decode(uint64_t prev_token, uint64_t token) const override;
|
|
42
|
-
|
|
43
|
-
private:
|
|
44
|
-
template <typename T>
|
|
45
|
-
std::pair<std::optional<std::string>, re2::StringPiece>
|
|
46
|
-
_split_with_allowed_special_token(re2::StringPiece &input,
|
|
47
|
-
const T &allowed_special) const;
|
|
48
|
-
|
|
49
|
-
void _encode(re2::StringPiece &input, std::vector<uint64_t> &ret,
|
|
50
|
-
uint64_t &last_piece_token_len) const;
|
|
51
|
-
|
|
52
|
-
template <typename T>
|
|
53
|
-
std::pair<std::vector<uint64_t>, uint64_t>
|
|
54
|
-
_encode_with_special_token(const std::string &text,
|
|
55
|
-
const T &allowed_special) const;
|
|
56
|
-
|
|
57
|
-
Encoder _build_special_token_encoder(ssize_t num_base_tokens) const;
|
|
58
|
-
|
|
59
|
-
std::unique_ptr<std::vector<std::string>> _special_tokens;
|
|
60
|
-
size_t _bos_token_index;
|
|
61
|
-
size_t _eos_token_index;
|
|
62
|
-
// Removed negative lookahead \s+(?!\S) since it's not supported by RE2.
|
|
63
|
-
const std::string _pattern =
|
|
64
|
-
R"((?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+)";
|
|
65
|
-
Encoder _encoder;
|
|
66
|
-
Encoder _special_token_encoder;
|
|
67
|
-
Decoder _decoder;
|
|
68
|
-
Decoder _special_token_decoder;
|
|
69
|
-
|
|
70
|
-
Re2UPtr _regex;
|
|
71
|
-
Re2UPtr _special_token_regex;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
} // namespace llm
|
|
75
|
-
} // namespace extension
|
|
76
|
-
} // namespace executorch
|
|
77
|
-
|
|
78
|
-
namespace torch {
|
|
79
|
-
namespace executor {
|
|
80
|
-
// TODO(T197294990): Remove these deprecated aliases once all users have moved
|
|
81
|
-
// to the new `::executorch` namespaces.
|
|
82
|
-
using ::executorch::extension::llm::Decoder;
|
|
83
|
-
using ::executorch::extension::llm::Encoder;
|
|
84
|
-
using ::executorch::extension::llm::Re2UPtr;
|
|
85
|
-
using ::executorch::extension::llm::Tiktoken;
|
|
86
|
-
} // namespace executor
|
|
87
|
-
} // namespace torch
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#pragma once
|
|
10
|
-
|
|
11
|
-
#include <cinttypes>
|
|
12
|
-
// patternlint-disable-next-line executorch-cpp-nostdinc
|
|
13
|
-
#include <string>
|
|
14
|
-
// patternlint-disable-next-line executorch-cpp-nostdinc
|
|
15
|
-
#include <vector>
|
|
16
|
-
|
|
17
|
-
#include <executorch/runtime/core/error.h>
|
|
18
|
-
#include <executorch/runtime/core/result.h>
|
|
19
|
-
|
|
20
|
-
namespace executorch {
|
|
21
|
-
namespace extension {
|
|
22
|
-
namespace llm {
|
|
23
|
-
|
|
24
|
-
// A tokenizer interface.
|
|
25
|
-
class Tokenizer {
|
|
26
|
-
public:
|
|
27
|
-
explicit Tokenizer() {}
|
|
28
|
-
virtual ~Tokenizer() {}
|
|
29
|
-
|
|
30
|
-
virtual ::executorch::runtime::Error
|
|
31
|
-
load(const std::string &tokenizer_path) = 0;
|
|
32
|
-
|
|
33
|
-
virtual ::executorch::runtime::Result<std::vector<uint64_t>>
|
|
34
|
-
encode(const std::string &input, int8_t bos, int8_t eos) const = 0;
|
|
35
|
-
|
|
36
|
-
::executorch::runtime::Error decode_verify(uint64_t token) const {
|
|
37
|
-
if (!initialized_) {
|
|
38
|
-
ET_LOG(Error, "Tokenizer not initialized");
|
|
39
|
-
return ::executorch::runtime::Error::NotSupported;
|
|
40
|
-
}
|
|
41
|
-
if (token >= vocab_size_) {
|
|
42
|
-
ET_LOG(Error, "token %" PRIu64 " is out side of vacab range %d", token,
|
|
43
|
-
vocab_size_);
|
|
44
|
-
return ::executorch::runtime::Error::NotSupported;
|
|
45
|
-
}
|
|
46
|
-
return ::executorch::runtime::Error::Ok;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
virtual ::executorch::runtime::Result<std::string>
|
|
50
|
-
decode(uint64_t prev_token, uint64_t token) const = 0;
|
|
51
|
-
|
|
52
|
-
// getters
|
|
53
|
-
int32_t vocab_size() const { return vocab_size_; }
|
|
54
|
-
|
|
55
|
-
uint64_t bos_tok() const { return bos_tok_; }
|
|
56
|
-
|
|
57
|
-
uint64_t eos_tok() const { return eos_tok_; }
|
|
58
|
-
|
|
59
|
-
protected:
|
|
60
|
-
bool initialized_ = false;
|
|
61
|
-
int32_t vocab_size_ = 0;
|
|
62
|
-
uint64_t bos_tok_ = 0;
|
|
63
|
-
uint64_t eos_tok_ = 0;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
} // namespace llm
|
|
67
|
-
} // namespace extension
|
|
68
|
-
} // namespace executorch
|
|
69
|
-
|
|
70
|
-
namespace torch {
|
|
71
|
-
namespace executor {
|
|
72
|
-
// TODO(T197294990): Remove these deprecated aliases once all users have moved
|
|
73
|
-
// to the new `::executorch` namespaces.
|
|
74
|
-
using ::executorch::extension::llm::Tokenizer;
|
|
75
|
-
} // namespace executor
|
|
76
|
-
} // namespace torch
|