react-native-executorch
React Native ExecuTorch is a high-performance, privacy-first on-device AI inference library for React Native, powered by PyTorch's ExecuTorch runtime.
It provides a layered architecture designed for different use cases:
-
React Hooks (
use<Task>): Declarative hooks designed for UI components. They manage downloading remote model assets with progress tracking, compilation, and automatic native memory disposal on unmount. -
Task APIs (
create<Task>): Imperative, promise-based pipelines with built-in preprocessing and postprocessing. Ideal for background services, worklets, or apps needing manual lifecycle control. -
Domain Utilities: Domain-specific low-level tools:
- math: Native C++ tensor operations (softmax, sigmoid, argmax, gather, etc.).
- cv: Image transformations (resizing, normalization, layout conversions), bounding box, quadrilateral, and keypoint helpers.
- llm: Token-by-token text generation runner, chat template formatting, and function calling helpers.
- nlp: Fast native HuggingFace tokenizers and privacy filter utilities.
- speech: Text-to-speech phonemizers, sentence splitters, voice activity detection, and audio utilities.
-
Model Registry (models): A curated catalog of verified, hosted on-device AI models across LLMs, Computer Vision, Speech, and NLP. Provides download URLs, pre-tuned configurations, and label maps for out-of-the-box inference.
-
Resource Fetcher (download): Imperative asset downloader and caching engine with abort control, progress tracking, and deduplicated local storage.
-
Core Primitives (Model, Tensor, schema, wrapAsync, createResourceScope): Low-level building blocks for custom architectures: direct C++ tensor memory management, raw model execution, load-time shape/domain validation, worklet threading, and construction-time ownership of native resources.
Hooks
- useClassifier
- useImageEmbedder
- useInstanceSegmenter
- useKeypointDetector
- useLLMChatSession
- useModel
- useObjectDetector
- useOpticalCharacterRecognizer
- usePrivacyFilter
- useResourceDownload
- useSemanticSegmenter
- useSpeechToText
- useStyleTransfer
- useTextEmbedder
- useTextToImage
- useTextToSpeech
- useTokenizer
- useVoiceActivityDetector
Models
Modules
Core / Functions
Core / Types
- DType
- LoadModelOptions
- Model
- ModelInput
- ModelOutput
- NativeResource
- ResourceScope
- RnExecuTorchError
- RnExecuTorchErrorCode
- Tensor
Core / Constants
CV / Tasks
- createClassifier
- createImageEmbedder
- createInstanceSegmenter
- createKeypointDetector
- createObjectDetector
- createPaddleOcr
- createSdxsTextToImage
- createSemanticSegmenter
- createStyleTransfer
CV / Types
- BlazeFaceLandmark
- Classification
- Classifier
- ClassifierModel
- ClassifierOptions
- ClassifyOptions
- CocoClass
- CocoClassYolo
- CocoLandmark
- ColorMap
- DetectKeypointsOptions
- DetectObjectsOptions
- ImageEmbedder
- ImageEmbedderModel
- ImageNet1KLabel
- InstanceSegmentationResult
- InstanceSegmenter
- InstanceSegmenterModel
- InstanceSegmenterOptions
- KeypointDetection
- KeypointDetector
- KeypointDetectorModel
- KeypointDetectorOptions
- Landmarks
- ObjectDetection
- ObjectDetector
- ObjectDetectorModel
- ObjectDetectorOptions
- OcrDetection
- PaddleOcr
- PaddleOcrModel
- PaddleOcrModelOptions
- PascalVocLabel
- RecognizeCharactersOptions
- SdxsTextToImage
- SdxsTextToImageModel
- SegmentInstancesOptions
- SemanticSegmentationResult
- SemanticSegmenter
- SemanticSegmenterModel
- SemanticSegmenterOptions
- StyleTransfer
- StyleTransferModel
- StyleTransferOptions
CV / Constants
- BLAZEFACE_LANDMARKS
- COCO_CLASSES
- COCO_CLASSES_YOLO
- COCO_LANDMARKS
- IMAGENET_NORM
- IMAGENET1K_LABELS
- PASCAL_VOC_LABELS
LLM / Tasks
LLM / Types
NLP / Tasks
NLP / Types
- PrivacyFilter
- PrivacyFilterModel
- PrivacyFilterNemotronLabel
- PrivacyFilterOpenaiLabel
- PrivacyFilterOptions
- TextEmbedder
- TextEmbedderModel
NLP / Constants
Speech / Tasks
- createFsmnVoiceActivityDetector
- createKokoroTextToSpeech
- createSupertonicTextToSpeech
- createWhisperSpeechToText
Speech / Types
- FsmnVadModel
- FsmnVoiceActivityDetector
- KokoroTextToSpeech
- KokoroTtsChunk
- KokoroTtsModel
- KokoroTtsOptions
- SupertonicDefaultVoiceName
- SupertonicTextToSpeech
- SupertonicTtsChunk
- SupertonicTtsModel
- SupertonicTtsOptions
- VadEvent
- VadOptions
- VadSegment
- VadStreamOptions
- WhisperLanguage
- WhisperSpeechToText
- WhisperStreamOptions
- WhisperSttModel
- WhisperSttOptions
Speech / Constants
- FSMN_VAD_SAMPLE_RATE_HZ
- KOKORO_SAMPLE_RATE
- SUPERTONIC_DEFAULT_VOICE_NAMES
- SUPERTONIC_SAMPLE_RATE
- WHISPER_LANGUAGES
- WHISPER_SAMPLE_RATE_HZ