From d9dd1afe40e5e1dbfe1a344709c4c0dd8846a4e3 Mon Sep 17 00:00:00 2001 From: Norbert Klockiewicz Date: Fri, 7 Mar 2025 15:25:25 +0100 Subject: [PATCH 1/2] docs: add note about new architecture in readme and docs --- README.md | 41 ++++++++++++++--------- docs/docs/fundamentals/getting-started.md | 6 ++++ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b10b862c..29cf8a85 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ **ExecuTorch** is a novel framework created by Meta that enables running AI models on devices such as mobile phones or microcontrollers. React Native ExecuTorch bridges the gap between React Native and native platform capabilities, allowing developers to run AI models locally on mobile devices with state-of-the-art performance, without requiring deep knowledge of native code or machine learning internals. +## Compatibility + +React Native Executorch supports only the [New React Native architecture](https://reactnative.dev/architecture/landing-page). + +If your app still runs on the old architecture, please consider adopting the New Architecture. + ## Readymade models 🤖 To run any AI model in ExecuTorch, you need to export it to a `.pte` format. If you're interested in experimenting with your own models, we highly encourage you to check out the [Python API](https://pypi.org/project/executorch/). If you prefer focusing on developing your React Native app, we will cover several common use cases. For more details, please refer to the documentation. @@ -15,12 +21,12 @@ To run any AI model in ExecuTorch, you need to export it to a `.pte` format. If Take a look at how our library can help build you your React Native AI features in our docs: https://docs.swmansion.com/react-native-executorch +# 🦙 **Quickstart - Running Llama** -# 🦙 **Quickstart - Running Llama** +**Get started with AI-powered text generation in 3 easy steps!** -**Get started with AI-powered text generation in 3 easy steps!** +### 1️⃣ **Installation** -### 1️⃣ **Installation** ```bash # Install the package yarn add react-native-executorch @@ -29,20 +35,22 @@ cd ios && pod install && cd .. --- -### 2️⃣ **Setup & Initialization** -Add this to your component file: +### 2️⃣ **Setup & Initialization** + +Add this to your component file: + ```tsx -import { - LLAMA3_2_3B_QLORA, +import { + LLAMA3_2_3B_QLORA, LLAMA3_2_3B_TOKENIZER, - useLLM + useLLM, } from 'react-native-executorch'; function MyComponent() { // Initialize the model 🚀 const llama = useLLM({ modelSource: LLAMA3_2_3B_QLORA, - tokenizerSource: LLAMA3_2_3B_TOKENIZER + tokenizerSource: LLAMA3_2_3B_TOKENIZER, }); // ... rest of your component } @@ -50,18 +58,20 @@ function MyComponent() { --- -### 3️⃣ **Run the model!** +### 3️⃣ **Run the model!** + ```tsx const handleGenerate = async () => { - const prompt = "The meaning of life is"; - + const prompt = 'The meaning of life is'; + // Generate text based on your desired prompt const response = await llama.generate(prompt); - console.log("Llama says:", response); + console.log('Llama says:', response); }; ``` ## Minimal supported versions + The minimal supported version is 17.0 for iOS and Android 13. ## Examples 📲 @@ -69,6 +79,7 @@ The minimal supported version is 17.0 for iOS and Android 13. https://github.com/user-attachments/assets/27ab3406-c7f1-4618-a981-6c86b53547ee We currently host two example apps demonstrating use cases of our library: + - examples/speech-to-text - Whisper and Moonshine models ready for transcription tasks - examples/computer-vision - computer vision related tasks - examples/llama - chat applications showcasing use of LLMs @@ -100,10 +111,10 @@ yarn expo run:ios ``` ### 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. +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. -## License +## License This library is licensed under [The MIT License](./LICENSE). diff --git a/docs/docs/fundamentals/getting-started.md b/docs/docs/fundamentals/getting-started.md index 025b085a..5be45a18 100644 --- a/docs/docs/fundamentals/getting-started.md +++ b/docs/docs/fundamentals/getting-started.md @@ -14,6 +14,12 @@ ExecuTorch is a novel AI framework developed by Meta, designed to streamline dep React Native ExecuTorch is our way of bringing ExecuTorch into the React Native world. Our API is built to be simple, declarative, and efficient. Plus, we’ll provide a set of pre-exported models for common use cases, so you won’t have to worry about handling exports yourself. With just a few lines of JavaScript, you’ll be able to run AI models (even LLMs 👀) right on your device—keeping user data private and saving on cloud costs. +## Compatibility + +React Native Executorch supports only the [New React Native architecture](https://reactnative.dev/architecture/landing-page). + +If your app still runs on the old architecture, please consider adopting the New Architecture. + ## Installation Installation is pretty straightforward, just use your favorite package manager. From 5dfe958b056bd0f0a944b5ae01eaf9746a40c644 Mon Sep 17 00:00:00 2001 From: Norbert Klockiewicz Date: Fri, 7 Mar 2025 15:36:51 +0100 Subject: [PATCH 2/2] docs: requested changes --- README.md | 2 +- docs/docs/fundamentals/getting-started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 29cf8a85..94d6c722 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ React Native Executorch supports only the [New React Native architecture](https://reactnative.dev/architecture/landing-page). -If your app still runs on the old architecture, please consider adopting the New Architecture. +If your app still runs on the old architecture, please consider upgrading to the New Architecture. ## Readymade models 🤖 diff --git a/docs/docs/fundamentals/getting-started.md b/docs/docs/fundamentals/getting-started.md index 5be45a18..d7fe5256 100644 --- a/docs/docs/fundamentals/getting-started.md +++ b/docs/docs/fundamentals/getting-started.md @@ -18,7 +18,7 @@ React Native ExecuTorch is our way of bringing ExecuTorch into the React Native React Native Executorch supports only the [New React Native architecture](https://reactnative.dev/architecture/landing-page). -If your app still runs on the old architecture, please consider adopting the New Architecture. +If your app still runs on the old architecture, please consider upgrading to the New Architecture. ## Installation