Skip to content

Commit

Permalink
android sdk upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryT9 committed Dec 2, 2024
1 parent 26f5a5a commit 089eec1
Show file tree
Hide file tree
Showing 114 changed files with 882 additions and 508 deletions.
2 changes: 2 additions & 0 deletions android/llama.android/.gitignore → android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.gradle/
build/

.idea

# Local configuration file (sdk path, etc)
local.properties

Expand Down
7 changes: 6 additions & 1 deletion android/llama.android/README.md → android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ Open the [android test project](./app-java) folder in Android Studio and run the

## Download Models

You can download models from the [Nexa AI ModelHub](https://nexa.ai/models).
You can download models from the [Nexa AI ModelHub](https://nexa.ai/models).

## How to estimate power usage

- ```adb shell dumpsys batterystats --reset```
- ```adb shell dumpsys batterystats > batterystats.txt```
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
Expand All @@ -12,6 +12,9 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
android:largeHeap="true"
android:hardwareAccelerated="true"
tools:replace="android:largeHeap"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ai.nexa.app_java;

import android.content.Context;
import com.nexa.NexaVlmInference;
import com.nexa.NexaOmniVlmInference;
import android.util.Log;

import java.io.IOException;
Expand Down Expand Up @@ -29,7 +29,7 @@ public class LlamaBridge {
private final MessageHandler messageHandler;
private final VlmModelManager modelManager;
private final ImagePathHelper imagePathHelper;
private NexaVlmInference nexaVlmInference;
private NexaOmniVlmInference nexaVlmInference;
private boolean isModelLoaded = false;

private final KotlinFlowHelper flowHelper = new KotlinFlowHelper();
Expand Down Expand Up @@ -73,7 +73,7 @@ public void loadModel() {
Log.d(TAG, "Loading projector from: " + projectorPath);

// Create with default values for optional parameters
nexaVlmInference = new NexaVlmInference(
nexaVlmInference = new NexaOmniVlmInference(
modelPath, // modelPath
projectorPath, // projectorPath
"", // imagePath (empty string as default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
public class VlmModelManager {
private static final String TAG = "LlamaBridge";
private static final String MODELS_DIR = "models";
private static final String MODEL_TEXT_FILENAME = "nanollava-text-model-q4_0.gguf";
private static final String MODEL_MMPROJ_FILENAME = "nanollava-mmproj-f16.gguf";
// private static final String MODEL_TEXT_FILENAME = "nanollava-text-model-q4_0.gguf";
// private static final String MODEL_MMPROJ_FILENAME = "nanollava-mmproj-f16.gguf";

private static final String MODEL_TEXT_FILENAME = "model-q8_0.gguf";
private static final String MODEL_MMPROJ_FILENAME = "projector-q8_0.gguf";

// private static final String MODEL_TEXT_FILENAME = "nano-vlm-instruct-llm-F16.gguf";
// private static final String MODEL_MMPROJ_FILENAME = "nano-vlm-instruct-mmproj-F16.gguf";


private final Context context;
private File textModelFile;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xms1024m -Xmx4g -XX:MaxDirectMemorySize=3g -Dsun.nio.MaxDirectMemorySize=3g -Dfile.encoding=UTF-8 -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand All @@ -21,3 +21,6 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

android.enableR8.fullMode=true
android.debug.obsoleteApi=true
File renamed without changes.
File renamed without changes.
33 changes: 0 additions & 33 deletions android/llama.android/llama/src/main/cpp/common.cpp

This file was deleted.

Loading

0 comments on commit 089eec1

Please sign in to comment.