Skip to content

Commit

Permalink
Merge pull request #11 from jrobles98/main
Browse files Browse the repository at this point in the history
Fix for Android OpenCL and added a couple of improvements
  • Loading branch information
cdiddy77 authored Sep 17, 2024
2 parents 4fdf6cb + cc5884d commit b1bd09c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:targetApi="31"
tools:ignore="GoogleAppIndexingWarning"/>
</manifest>
6 changes: 6 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Required to initialize the LlmInference -->
<uses-native-library
android:name="libOpenCL.so"
android:required="false"/>
<uses-native-library android:name="libOpenCL-car.so" android:required="false"/>
<uses-native-library android:name="libOpenCL-pixel.so" android:required="false"/>
</application>
</manifest>
3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"build:android": "cd android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
"build:clean": "cd android && ./gradlew clean",
"build:android": "cd android && ./gradlew clean && ./gradlew assembleRelease --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
"build:ios": "cd ios && xcodebuild -workspace LlmMediapipeExample.xcworkspace -scheme LlmMediapipeExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function App(): React.JSX.Element {
const llmInference = useLlmInference({
storageType: 'asset',
modelName: 'gemma-2b-it-cpu-int4.bin',
// 'gemma-1.1-2b-it-gpu-int4.bin' or the name of the model that
// you placed at android/app/src/main/assets/{MODEL_FILE}
});

const onSendPrompt = React.useCallback(async () => {
Expand Down

0 comments on commit b1bd09c

Please sign in to comment.