microsoft / microsoft/onnxruntime-inference-examples

Android - App crash when using Phi-3

Open
#444 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.7k
Forks
414
Avg merge
1d 6h
Merged PRs (30d)
14

Description

After compiling the example Android app for Phi-3 I've downloaded the model file from hugging face seperately and placed it in /data/data/.../files, however when trying to run the app always crashes it says something about "downloading model for app..." Then goes to "model exists skipping download" then immediately crashes. Using logcat of Android studio I've narrowed the error down to this line in the log:

Deserialize tensor model.layers.31.mlp.up_proj.MatMul.weight_Q4 failed.tensorprotoutils.cc:904 GetExtDataFromTensorProto External initializer: model.layers.31.mlp.up_proj.MatMul.weight_Q4 offset: 2628268032 size to read: 12582912 given file_length: 2354700288 are out of bounds or can not be read in full.

Any ideas on how I can fix it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the Android example's model-download and model-existence handling, then compare the Phi-3 file's size with logcat's reported file_length, offset, and read size. Reproduce the failure in Android Studio using logcat; done means the app loads Phi-3 without the tensor deserialization or out-of-bounds crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, machine-learning
Domain
machine-learning, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.