Skip to content

Commit 2a98ffa

Browse files
authored
docs: Add a quickstart guide for Llama (#91)
## Description As discussed internally, adding a quickstart with running LLMs to the README - #17 ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [x] iOS - [x] Android ### Testing instructions <!-- Provide step-by-step instructions on how to test your changes. Include setup details if necessary. --> ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
1 parent cbe2b55 commit 2a98ffa

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,52 @@ To run any AI model in ExecuTorch, you need to export it to a `.pte` format. If
1515
Take a look at how our library can help build you your React Native AI features in our docs:
1616
https://docs.swmansion.com/react-native-executorch
1717

18+
19+
# 🦙 **Quickstart - Running Llama**
20+
21+
**Get started with AI-powered text generation in 3 easy steps!**
22+
23+
### 1️⃣ **Installation**
24+
```bash
25+
# Install the package
26+
yarn add react-native-executorch
27+
cd ios && pod install && cd ..
28+
```
29+
30+
---
31+
32+
### 2️⃣ **Setup & Initialization**
33+
Add this to your component file:
34+
```tsx
35+
import {
36+
LLAMA3_2_1B_QLORA,
37+
LLAMA3_2_3B_TOKENIZER,
38+
useLLM
39+
} from 'react-native-executorch';
40+
41+
function MyComponent() {
42+
// Initialize the model 🚀
43+
const llama = useLLM({
44+
modelSource: LLAMA3_2_1B_QLORA,
45+
tokenizerSource: LLAMA3_2_1B_TOKENIZER
46+
});
47+
// ... rest of your component
48+
}
49+
```
50+
51+
---
52+
53+
### 3️⃣ **Run the model!**
54+
```tsx
55+
const handleGenerate = async () => {
56+
const prompt = "The meaning of life is";
57+
58+
// Generate text based on your desired prompt
59+
const response = await llama.generate(prompt);
60+
console.log("Llama says:", response);
61+
};
62+
```
63+
1864
## Minimal supported versions
1965
The minimal supported version is 17.0 for iOS and Android 13.
2066

0 commit comments

Comments
 (0)