Skip to content

Commit edea477

Browse files
pweglikJakubGoneraNorbertKlockiewiczchmjkbmkopcins
authored
Merge 0.4.0 (#314)
## Description <!-- Provide a concise and descriptive summary of the changes implemented in this PR. --> ### 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) - [ ] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [ ] iOS - [ ] 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 - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [ ] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. --> --------- Co-authored-by: Jakub Gonera <[email protected]> Co-authored-by: Norbert Klockiewicz <[email protected]> Co-authored-by: Jakub Chmura <[email protected]> Co-authored-by: Mateusz Kopcinski <[email protected]> Co-authored-by: Jakub Mroz <[email protected]> Co-authored-by: kopcion <[email protected]> Co-authored-by: Maciej Rys <[email protected]> Co-authored-by: Maciej Rys <maciej.rys@swmansioncom> Co-authored-by: Mateusz Sluszniak <[email protected]> Co-authored-by: Michał Dydek <[email protected]> Co-authored-by: Mateusz Kopciński <[email protected]> Co-authored-by: Patrycja Kalińska <[email protected]>
1 parent ba6dd3f commit edea477

File tree

627 files changed

+46891
-158372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

627 files changed

+46891
-158372
lines changed

.cspell-wordlist.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
swmansion
2+
executorch
3+
execu
4+
Execu
5+
torch
6+
huggingface
7+
bbox
8+
bboxes
9+
deeplab
10+
unsqueeze
11+
qlora
12+
spinquant
13+
efficientnet
14+
ssdlite
15+
udnie
16+
crnn
17+
mobilenet
18+
microcontrollers
19+
notimestamps
20+
seqs
21+
smollm
22+
qwen
23+
XNNPACK
24+
EFFICIENTNET
25+
SSDLITE
26+
MOBILENET
27+
UDNIE
28+
CRNN
29+
SPINQUANT
30+
QLORA
31+
GGUF
32+
deeplabv
33+
DEELABV
34+
ARGMAX
35+
Abaza
36+
Adyghe
37+
Chech
38+
Dargwa
39+
Ingush
40+
Karbadian
41+
Lezghian
42+
Occitan
43+
Tabassaran
44+
Sinhala
45+
Infima
46+
sublabel
47+
Aeonik
48+
Lexend
49+
finetuned
50+
MINILM
51+
MPNET

.cspell.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "0.2",
3+
"language": "en",
4+
"ignorePaths": ["**/node_modules", "**/Pods"],
5+
"dictionaryDefinitions": [
6+
{
7+
"name": "project-words",
8+
"path": ".cspell-wordlist.txt"
9+
}
10+
],
11+
"dictionaries": ["project-words"]
12+
}

.eslintrc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"parserOptions": {
3+
"requireConfigFile": false,
4+
"babelOptions": {
5+
"presets": [
6+
"@babel/preset-react"
7+
]
8+
}
9+
},
10+
"root": true,
11+
"extends": [
12+
"@react-native",
13+
"prettier",
14+
"plugin:@cspell/recommended"
15+
],
16+
"rules": {
17+
"react/react-in-jsx-scope": "off",
18+
"prettier/prettier": [
19+
"error",
20+
{
21+
"quoteProps": "consistent",
22+
"singleQuote": true,
23+
"tabWidth": 2,
24+
"trailingComma": "es5",
25+
"useTabs": false
26+
}
27+
],
28+
"@cspell/spellchecker": ["warn", { "customWordListFile": ".cspell-wordlist.txt" }],
29+
"camelcase": "error"
30+
},
31+
"plugins": [
32+
"eslint-plugin-prettier"
33+
],
34+
"ignorePatterns": [
35+
"node_modules/",
36+
"lib/"
37+
]
38+
}

.github/workflows/build-android-llama-example.yml renamed to .github/workflows/build-android-llm-example.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
name: Llama Example app Android build check
1+
name: LLM Example app Android build check
22
on:
33
pull_request:
44
paths:
5-
- .github/workflows/build-android-llama-example.yml
5+
- .github/workflows/build-android-llm-example.yml
66
- android/**
77
- third-party/android/**
8-
- examples/llama/package.json
9-
- examples/llama/android/**
8+
- examples/llm/package.json
9+
- examples/llm/android/**
1010
push:
1111
branches:
1212
- main
1313
paths:
14-
- .github/workflows/build-android-llama-example.yml
14+
- .github/workflows/build-android-llm-example.yml
1515
- android/**
1616
- third-party/android/**
17-
- examples/llama/package.json
18-
- examples/llama/android/**
17+
- examples/llm/package.json
18+
- examples/llm/android/**
1919
workflow_dispatch:
2020
jobs:
2121
build:
2222
if: github.repository == 'software-mansion/react-native-executorch'
2323
runs-on: ubuntu-latest
2424
env:
25-
WORKING_DIRECTORY: examples/llama
25+
WORKING_DIRECTORY: examples/llm
2626
concurrency:
2727
group: android-${{ github.ref }}
2828
cancel-in-progress: true
@@ -35,6 +35,7 @@ jobs:
3535
distribution: 'zulu'
3636
java-version: 17
3737
- name: Install node dependencies
38+
working-directory: ${{ env.WORKING_DIRECTORY }}
3839
run: yarn install --immutable
3940
- name: Build app
4041
working-directory: ${{ env.WORKING_DIRECTORY }}/android

.github/workflows/build-ios-llama-example.yml renamed to .github/workflows/build-ios-llm-example.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
name: Llama Example app iOS build check
1+
name: LLM Example app iOS build check
22
on:
33
push:
44
branches:
55
- main
66
paths:
7-
- '.github/workflows/build-ios-llama-example.yml'
7+
- '.github/workflows/build-ios-llm-example.yml'
88
- '*.podspec'
9-
- 'examples/llama/ios/**'
10-
- 'examples/llama/package.json'
9+
- 'examples/llm/ios/**'
10+
- 'examples/llm/package.json'
1111
pull_request:
1212
paths:
13-
- '.github/workflows/build-ios-llama-example.yml'
13+
- '.github/workflows/build-ios-llm-example.yml'
1414
- '*.podspec'
15-
- 'examples/llama/ios/**'
16-
- 'examples/llama/package.json'
15+
- 'examples/llm/ios/**'
16+
- 'examples/llm/package.json'
1717
workflow_dispatch:
1818
jobs:
1919
build:
@@ -23,20 +23,23 @@ jobs:
2323
group: ios-${{ github.ref }}
2424
cancel-in-progress: true
2525
steps:
26+
- uses: maxim-lobanov/setup-xcode@v1
27+
with:
28+
xcode-version: latest-stable
2629
- name: Check out Git repository
2730
uses: actions/checkout@v4
2831
- name: Install node dependencies
29-
working-directory: examples/llama
32+
working-directory: examples/llm
3033
run: yarn
3134
- name: Install pods
32-
working-directory: examples/llama/ios
35+
working-directory: examples/llm/ios
3336
run: pod install
3437
- name: Build app
35-
working-directory: examples/llama/ios
38+
working-directory: examples/llm/ios
3639
run: |
3740
set -o pipefail && xcodebuild \
38-
-workspace llama.xcworkspace \
39-
-scheme llama \
41+
-workspace llm.xcworkspace \
42+
-scheme llm \
4043
-sdk iphonesimulator \
4144
-configuration Debug \
4245
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,7 @@ lib/
8080
# React Native Codegen
8181
ios/generated
8282
android/generated
83+
84+
# custom
85+
*.tgz
86+
Makefile

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "executorch"]
2+
path = third-party/executorch
3+
url = https://github.com/software-mansion-labs/executorch
4+
[submodule "tokenizers-cpp"]
5+
path = third-party/tokenizers-cpp
6+
url = https://github.com/software-mansion-labs/tokenizers-cpp

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"quoteProps": "consistent",
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"useTabs": false
7+
}

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,25 @@
88

99
**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.
1010

11+
**Table of contents:**
12+
13+
- [Compatibility](#compatibility)
14+
- [Ready-made models 🤖](#readymade-models-)
15+
- [Documentation 📚](#documentation-)
16+
- [🦙 Quickstart - Running Llama](#-quickstart---running-llama)
17+
- [Minimal supported versions](#minimal-supported-versions)
18+
- [Examples 📲](#examples-)
19+
- [Warning](#warning)
20+
- [License](#license)
21+
- [What's next?](#whats-next)
22+
1123
## Compatibility
1224

1325
React Native Executorch supports only the [New React Native architecture](https://reactnative.dev/architecture/landing-page).
1426

1527
If your app still runs on the old architecture, please consider upgrading to the New Architecture.
1628

17-
## Readymade models 🤖
29+
## Ready-made models 🤖
1830

1931
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.
2032

@@ -43,16 +55,17 @@ Add this to your component file:
4355

4456
```tsx
4557
import {
46-
LLAMA3_2_3B_QLORA,
47-
LLAMA3_2_3B_TOKENIZER,
4858
useLLM,
59+
LLAMA3_2_1B,
60+
LLAMA3_2_TOKENIZER_CONFIG,
4961
} from 'react-native-executorch';
5062

5163
function MyComponent() {
5264
// Initialize the model 🚀
5365
const llama = useLLM({
54-
modelSource: LLAMA3_2_3B_QLORA,
55-
tokenizerSource: LLAMA3_2_3B_TOKENIZER,
66+
modelSource: LLAMA3_2_1B,
67+
tokenizerSource: LLAMA3_2_TOKENIZER,
68+
tokenizerConfigSource: LLAMA3_2_TOKENIZER_CONFIG,
5669
});
5770
// ... rest of your component
5871
}
@@ -64,11 +77,14 @@ function MyComponent() {
6477

6578
```tsx
6679
const handleGenerate = async () => {
67-
const prompt = 'The meaning of life is';
68-
69-
// Generate text based on your desired prompt
70-
const response = await llama.generate(prompt);
71-
console.log('Llama says:', response);
80+
const chat = [
81+
{ role: 'system' content: 'You are a helpful assistant' }
82+
{ role: 'user', content: 'What is the meaning of life?' }
83+
];
84+
85+
// Chat completion
86+
await llm.generate(chat);
87+
console.log('Llama says:', llm.response);
7288
};
7389
```
7490

@@ -82,11 +98,12 @@ https://github.com/user-attachments/assets/27ab3406-c7f1-4618-a981-6c86b53547ee
8298

8399
We currently host a few example apps demonstrating use cases of our library:
84100

101+
- examples/llm - chat application showcasing use of LLMs
85102
- examples/speech-to-text - Whisper and Moonshine models ready for transcription tasks
86103
- examples/computer-vision - computer vision related tasks
87-
- examples/llama - chat applications showcasing use of LLMs
104+
- examples/text-embeddings - computing text representations for semantic search
88105

89-
If you would like to run it, navigate to it's project directory, for example `examples/llama` from the repository root and install dependencies with:
106+
If you would like to run it, navigate to it's project directory, for example `examples/llm` from the repository root and install dependencies with:
90107

91108
```bash
92109
yarn

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ dependencies {
103103
implementation "com.facebook.react:react-android:+"
104104
implementation 'org.opencv:opencv:4.10.0'
105105
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
106-
implementation 'com.github.software-mansion:react-native-executorch:main-SNAPSHOT'
106+
implementation(files("libs/executorch.aar"))
107107
implementation 'org.opencv:opencv:4.10.0'
108108
implementation("com.squareup.okhttp3:okhttp:4.9.2")
109109
}

0 commit comments

Comments
 (0)