About the Google AI Edge category

Discuss the full AI edge stack, including LiteRT, MediaPipe, and Model Explorer.

From high level APIs and a performant runtime with CPU/GPU/NPU acceleration, to developer-friendly tooling to convert and optimize models for deployment on devices, Google AI Edge is a leading stack to deploy AI to devices.

26 Likes

Can anyone point me to the location on the android device which the ai edge gallery app saves the LiteRT model .task files to?

It seems in ModelMangaerViewModel.kt at line 149, the ā€˜externalFilesDir’ variable is defined by executing the getExternalFilesDir method on the ApplicationContext object. I don’t understand how one can determine the true value of the ā€˜externalFilesDir’ variable…

I’m trying to run this app on a disconnected android device, but the app immediately throws an error ā€œFailed to load model listā€ so I’m trying to manually copy the model .task files to the android device to resolve this issue. I don’t know where on the device the model file should be loaded, though.

I’ve already tried copying a LiteRT .task model file to the sdcard/Download directory, but the gallery app still throws this error.

Any suggestions? Thanks!

2 Likes

Hi @No_Thanks,

Welcome to the Google AI for Developers Forum. Also, thanks @system for creating this space for Google AI Edge discussions. Sorry for my late reply/suggestion here.

You have spotted the line code accurately. It is natural to get confuse, this confusion stems from how the android handing the getExternalFilesDir, it does not save to any public folders like Downloads but it will point to the package specified sandbox which is probably hidden from the UIs. The sdcard/Download path will not be read, and let me suggest you some steps to get the path that high chances to work. I see that you ran the app offline.

Getting the package app name, you can get it from source it was built - check for build.gradle applicationId. The Gallery app pkg name may look like something like - com.google.ai.edge.gallery

Then next push the model, you can use the adb commands. For example -


# creatign folder if it is not present

adb shell

mkdir -p /storage/emulated/0/Android/data/com.google.ai.edge.gallery/files/

# then just push your model file

adb push any_name_file.task /storage/emulated/0/Android/data/com.google.ai.edge.gallery/files/

# then pls see if the file is pushed and found at that path now...

adb shell ls -l /storage/emulated/0/Android/data/com.google.ai.edge.gallery/files/

Now that you have tried the other workarounds, I suggest you to put models.json file locally in the same path as your tasks file. Reason why I say this is sometimes the app might download the json from internet even before you look for the task file local paths.

Looks like this will work, waiting for your reply.

2 Likes