Skip to content

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 EmmaNingMS, edgchen1 and skottmckay and removed request for EmmaNingMS, edgchen1 and skottmckay 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