react-native-litert-lm 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -8
- package/android/CMakeLists.txt +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +12 -5
package/README.md
CHANGED
|
@@ -82,8 +82,6 @@ The `example/` directory contains a fully functional test app with a dark-themed
|
|
|
82
82
|
npm install
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
> **Important:** Use `npm` (not `pnpm`) for the example app. The library is linked via `file:..`, and npm creates a symlink so the iOS XCFramework is visible to CocoaPods. pnpm copies files based on the `files` array and misses `ios/Frameworks/`.
|
|
86
|
-
|
|
87
85
|
3. **Create a development build and run:**
|
|
88
86
|
|
|
89
87
|
```bash
|
|
@@ -311,11 +309,11 @@ const buffer = tracker.getNativeBuffer();
|
|
|
311
309
|
|
|
312
310
|
Download `.litertlm` models automatically using the exported URL constants, or manually from [HuggingFace](https://huggingface.co/litert-community):
|
|
313
311
|
|
|
314
|
-
| Constant | Model
|
|
315
|
-
| :--------------------- |
|
|
316
|
-
| `GEMMA_4_E2B_IT` | Gemma 4 E2B (Multimodal, IT)
|
|
317
|
-
| `GEMMA_4_E4B_IT` | Gemma 4 E4B (Higher Quality)
|
|
318
|
-
| `GEMMA_3N_E2B_IT_INT4` | Gemma 3n E2B (Int4, Multimodal)
|
|
312
|
+
| Constant | Model | Size | Min RAM | Auth Required |
|
|
313
|
+
| :--------------------- | :------------------------------ | :------ | :------ | :------------- |
|
|
314
|
+
| `GEMMA_4_E2B_IT` | Gemma 4 E2B (Multimodal, IT) | 2.58 GB | 4 GB+ | ❌ No |
|
|
315
|
+
| `GEMMA_4_E4B_IT` | Gemma 4 E4B (Higher Quality) | 3.65 GB | 6 GB+ | ❌ No |
|
|
316
|
+
| `GEMMA_3N_E2B_IT_INT4` | Gemma 3n E2B (Int4, Multimodal) | ~1.3 GB | 4 GB+ | ✅ HuggingFace |
|
|
319
317
|
|
|
320
318
|
> **Recommended:** Use `GEMMA_4_E2B_IT` for most use cases. It's multimodal (text + vision + audio) and downloads directly from HuggingFace without requiring an account.
|
|
321
319
|
>
|
|
@@ -454,7 +452,7 @@ const prompt = applyGemmaTemplate(
|
|
|
454
452
|
| react-native-nitro-modules | 0.35.0+ |
|
|
455
453
|
| Android API | 26+ (ARM64) |
|
|
456
454
|
| iOS | 15.0+ (ARM64) |
|
|
457
|
-
| LiteRT-LM Engine
|
|
455
|
+
| LiteRT-LM Engine | 0.10.2 |
|
|
458
456
|
|
|
459
457
|
## Platform Support
|
|
460
458
|
|
package/android/CMakeLists.txt
CHANGED
|
@@ -19,7 +19,7 @@ add_library(
|
|
|
19
19
|
# loads the NitroModules shared library. This is required because we're
|
|
20
20
|
# building a library that depends on NitroModules symbols which are only
|
|
21
21
|
# available at runtime.
|
|
22
|
-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-shlib-undefined")
|
|
22
|
+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-shlib-undefined,-z,max-page-size=16384")
|
|
23
23
|
|
|
24
24
|
# Include Nitrogen autolinking - this adds all generated sources and links
|
|
25
25
|
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/LiteRTLM+autolinking.cmake)
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -103,13 +103,20 @@ async function main() {
|
|
|
103
103
|
|
|
104
104
|
log('iOS frameworks installed successfully.');
|
|
105
105
|
} catch (err) {
|
|
106
|
-
// Don't fail the install — iOS frameworks are optional (Android-only users)
|
|
107
|
-
log(`Warning: Could not download iOS frameworks: ${err.message}`);
|
|
108
|
-
log('iOS builds will not work until frameworks are available.');
|
|
109
|
-
log('Run: scripts/download-ios-frameworks.sh to download manually.');
|
|
110
|
-
|
|
111
106
|
// Cleanup partial download
|
|
112
107
|
try { fs.unlinkSync(tmpZip); } catch {}
|
|
108
|
+
|
|
109
|
+
log(`Error: Could not download iOS frameworks: ${err.message}`);
|
|
110
|
+
log('iOS builds will not work until frameworks are available.');
|
|
111
|
+
log('Run: ./scripts/download-ios-frameworks.sh to download manually,');
|
|
112
|
+
log(' or: ./scripts/build-ios-engine.sh to build from source.');
|
|
113
|
+
|
|
114
|
+
// Fail fast on macOS so users discover the problem now, not at Xcode link time.
|
|
115
|
+
// Skip SKIP_IOS_FRAMEWORK_DOWNLOAD is already checked above.
|
|
116
|
+
if (process.platform === 'darwin') {
|
|
117
|
+
log('Set SKIP_IOS_FRAMEWORK_DOWNLOAD=1 to suppress this error (e.g. Android-only builds).');
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
|