Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phi-3 Vision Android App #456

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

fionabos
Copy link
Contributor

@fionabos fionabos commented Aug 9, 2024

Added Phi-3 Vision support to "Local Chatbot on Android with Phi-3, ONNX Runtime Mobile and ONNX Runtime Generate() API" project using the generate() Java API.

Main changes:

  • replaced Tokenizer class usage with MultiModalProcessor class
  • updated prompt template to include imaging
  • added download progress bar so user can see when model download is complete

@fionabos fionabos marked this pull request as ready for review August 12, 2024 08:18
@fionabos fionabos marked this pull request as draft August 12, 2024 08:18
@fionabos fionabos marked this pull request as ready for review August 12, 2024 08:22
@fionabos fionabos marked this pull request as draft August 12, 2024 08:22
@fionabos fionabos closed this Aug 12, 2024
@fionabos fionabos reopened this Aug 12, 2024
@fionabos fionabos closed this Aug 12, 2024
@fionabos fionabos reopened this Aug 12, 2024
@natke natke requested review from skottmckay, edgchen1 and EmmaNingMS and removed request for skottmckay, edgchen1 and EmmaNingMS August 13, 2024 21:53


inputTensors = multiModalProcessor.processImages(promptQuestion_formatted, images);
generatorParams.setInput(inputTensors);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to update this to get it to build:

Suggested change
generatorParams.setInput(inputTensors);
generatorParams.setInputs(inputTensors);

FileOutputStream out = new FileOutputStream(filename);
bmp.compress(Bitmap.CompressFormat.PNG, 100, out); // bmp is your Bitmap instance
// PNG is a lossless format, the compression factor (100) is ignored
images = new Images(filename);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, was running into an error here:
java.lang.UnsatisfiedLinkError: No implementation found for long ai.onnxruntime.genai.Images.loadImages(java.lang.String) (tried Java_ai_onnxruntime_genai_Images_loadImages and Java_ai_onnxruntime_genai_Images_loadImages__Ljava_lang_String_2) - is the library loaded, e.g. System.loadLibrary?

this ort-genai PR should fix it:
microsoft/onnxruntime-genai#797

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants