From ef93fc203bc44506e1bc997ea6e16669e6951781 Mon Sep 17 00:00:00 2001 From: chmjkb Date: Tue, 28 Jan 2025 10:16:54 +0100 Subject: [PATCH 1/2] docs: add LLM quickstart to README.md --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 005f074078..bd0d01cee1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,53 @@ 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** + +**Get started with AI-powered text generation in 3 easy steps!** + +### 1️⃣ **Installation** +```bash +# Install the package +yarn add react-native-executorch +cd ios && pod install && cd .. +``` + +--- + +### 2️⃣ **Setup & Initialization** +Add this to your component file: +```tsx +import { + LLAMA3_2_1B_QLORA, + LLAMA3_2_3B_TOKENIZER, + useLLM +} from 'react-native-executorch'; + +function MyComponent() { + // Initialize the model 🚀 + const llama = useLLM({ + modelSource: LLAMA3_2_1B_QLORA, + tokenizerSource: LLAMA3_2_1B_TOKENIZER + }); + // ... rest of your component +} +``` + +--- + +### 3️⃣ **Run the model!** +```tsx +const handleGenerate = async () => { + 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); +}; +``` + ## Minimal supported versions The minimal supported version is 17.0 for iOS and Android 13. From b4d2af52f633e34bb60e887c39478e69d16877a5 Mon Sep 17 00:00:00 2001 From: chmjkb Date: Tue, 28 Jan 2025 10:18:32 +0100 Subject: [PATCH 2/2] style: remove redundant newlinme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index bd0d01cee1..7505cfa6bb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ Take a look at how our library can help build you your React Native AI features https://docs.swmansion.com/react-native-executorch - # 🦙 **Quickstart - Running Llama** **Get started with AI-powered text generation in 3 easy steps!**