# react-native-executorch **Repository Path**: mirrors_software-mansion/react-native-executorch ## Basic Information - **Project Name**: react-native-executorch - **Description**: Declarative way to run AI models in React Native on device, powered by ExecuTorch. - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-09 - **Last Updated**: 2026-03-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
RNE Logo

React Native ExecuTorch

[![Ad](https://revive-adserver.swmansion.com/www/images/zone-gh-react-native-executorch-1?n=1)](https://revive-adserver.swmansion.com/www/delivery/ck.php?zoneid=zone-gh-react-native-executorch-1&n=1) [![Ad](https://revive-adserver.swmansion.com/www/images/zone-gh-react-native-executorch-2?n=1)](https://revive-adserver.swmansion.com/www/delivery/ck.php?zoneid=zone-gh-react-native-executorch-2&n=1) [![Ad](https://revive-adserver.swmansion.com/www/images/zone-gh-react-native-executorch-3?n=1)](https://revive-adserver.swmansion.com/www/delivery/ck.php?zoneid=zone-gh-react-native-executorch-3&n=1)
GitHub - Contributors GitHub - Stars Join our Discord community Documentation Hire Us

README README ES README FR README CN README PT README IN

**React Native ExecuTorch** provides a declarative way to run AI models on-device using React Native, powered by **ExecuTorch** :rocket:. It offers out-of-the-box support for a wide range of LLMs, computer vision models, and more. Visit our [HuggingFace](https://huggingface.co/software-mansion) page to explore these models. [**ExecuTorch**](https://executorch.ai), developed by Meta, is a novel framework allowing AI model execution on devices like mobile phones or microcontrollers. React Native ExecuTorch bridges the gap between React Native and native platform capabilities, enabling developers to efficiently run local AI models on mobile devices. This can be achieved without the need for extensive expertise in native programming or machine learning. [![npm version](https://img.shields.io/npm/v/react-native-executorch?color=00008B)](https://www.npmjs.com/package/react-native-executorch) [![npm nightly](https://img.shields.io/npm/v/react-native-executorch/executorch-nightly?label=nightly&color=00008B)](https://www.npmjs.com/package/react-native-executorch) [![CI](https://github.com/software-mansion/react-native-executorch/actions/workflows/ci.yml/badge.svg)](https://github.com/software-mansion/react-native-executorch/actions/workflows/ci.yml)
Table of Contents - [Supported Versions](#supported-versions) - [Real-world Example](#real-world-example) - [Quickstart - Running Llama](#quickstart---running-llama) - [:one: Installation](#one-installation) - [:two: Setup \& Initialization](#two-setup--initialization) - [:three: Run the Model!](#three-run-the-model) - [Demo Apps](#demo-apps) - [Ready-made Models](#ready-made-models) - [Documentation](#documentation) - [License](#license) - [What's Next?](#whats-next) - [React Native ExecuTorch is created by Software Mansion](#react-native-executorch-is-created-by-software-mansion)
## Supported Versions The minimal supported version are: * iOS 17.0 * Android 13 * React Native - see [compatibility table](https://docs.swmansion.com/react-native-executorch/docs/next/other/compatibility) > [!IMPORTANT] > React Native ExecuTorch supports only the [New React Native architecture](https://reactnative.dev/architecture/landing-page). ## Real-world Example React Native ExecuTorch is powering [Private Mind](https://privatemind.swmansion.com/), a privacy-first mobile AI app available on [App Store](https://apps.apple.com/gb/app/private-mind/id6746713439) and [Google Play](https://play.google.com/store/apps/details?id=com.swmansion.privatemind). Private Mind promo ## Quickstart - Running Llama **Get started with AI-powered text generation in 3 easy steps!** ### :one: Installation ```bash # Install the package yarn add react-native-executorch # If you use expo, please add these packages for resource fetching: yarn add react-native-executorch-expo-resource-fetcher yarn add expo-file-system expo-asset #if you use bare React Native project use these packages: yarn add react-native-executorch-bare-resource-fetcher yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader # Depending on the platform, choose either iOS or Android yarn < ios | android > ``` ### :two: Setup & Initialization Add this to your component file: ```tsx import { useLLM, LLAMA3_2_1B, Message, initExecutorch, } from 'react-native-executorch'; import { ExpoResourceFetcher } from 'react-native-executorch-expo-resource-fetcher'; initExecutorch({ resourceFetcher: ExpoResourceFetcher, }); function MyComponent() { // Initialize the model 🚀 const llm = useLLM({ model: LLAMA3_2_1B }); // ... rest of your component } ``` ### :three: Run the Model! ```tsx const handleGenerate = async () => { const chat: Message[] = [ { role: 'system', content: 'You are a helpful assistant' }, { role: 'user', content: 'What is the meaning of life?' } ]; // Chat completion await llm.generate(chat); console.log('Llama says:', llm.response); }; ``` ## Demo Apps We currently host a few example [apps](https://github.com/software-mansion/react-native-executorch/tree/main/apps) demonstrating use cases of our library: - `llm` - Chat application showcasing use of LLMs - `speech` - Speech to Text & Text to Speech task implementations - `computer-vision` - Computer vision related tasks - `text-embeddings` - Computing text representations for semantic search - `bare_rn` - LLM chat example for bare React Native (without Expo) If you would like to run a demo app, navigate to its project directory. Then install dependencies and run app with: ```bash yarn && yarn < ios | android > ``` > [!WARNING] > Running LLMs requires a significant amount of RAM. If you are encountering unexpected app crashes, try to increase the amount of RAM allocated to the emulator. ## Ready-made Models Our library has a number of ready-to-use AI models; a complete list is available in the documentation. If you're interested in running your own AI model, you need to first export it to the `.pte` format. Instructions on how to do this are available in the [Python API](https://docs.pytorch.org/executorch/stable/using-executorch-export.html) and [optimum-executorch README](https://github.com/huggingface/optimum-executorch?tab=readme-ov-file#option-2-export-and-load-separately). ## Documentation Check out how our library can help you build your React Native AI features by visiting our docs: https://docs.swmansion.com/react-native-executorch ## License This library is licensed under [The MIT License](./LICENSE). ## What's Next? To learn about our upcoming plans and developments, please visit our [milestones](https://github.com/software-mansion/react-native-executorch/milestones). ## React Native ExecuTorch is created by Software Mansion Since 2012, [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – [Hire us](https://swmansion.com/contact?utm_source=react-native-executorch&utm_medium=readme). [![swm](https://logo.swmansion.com/logo?color=white&variant=desktop&width=150&tag=react-native-executorch-github 'Software Mansion')](https://swmansion.com)