mlc-llm: [Question] error: package org.apache.tvm does not exist import org.apache.tvm.Device

While buidling apk from this project https://github.com/mlc-ai/mlc-llm/tree/main/android/ getting error /home/<user_name>/Downloads/mlc-llm/android/library/src/main/java/ai/mlc/mlcllm/ChatModule.java:3: error: package org.apache.tvm does not exist import org.apache.tvm.Device;

How to resolve this error.

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 5
  • Comments: 46

Most upvoted comments

@shalinsirwani @daniele777

After running prepare_libs.sh, a jar and a ARM lib will be copied to /library/built/output folder in Android project. (Note: NOT outputs , it’s output (singular))

That jar contains apache.tvm package

The problem is, if you “Clean/rebuild Project”, the Gradle is clearing the build/output folder !!!, so I can’t get the package !!!

I fixed this by copying the contents of ‘output’ folder to a new folder libs (/library/libs). image

Then went to the build.gradle in library folder and changed build/output in both JniLibs and dependenies like this

[build/output] ===> [libs]

Then Clean and rebuilt project

@NSTiwari Archive.zip you can try in another PCs if the script fails ?

@RageshAntonyHM: Is this zip file based on the updated JSON that I provided?

Thanks for the help, @RageshAntonyHM. Unfortunately, the app still crashes. image

I’ve created a new issue. Hopefully, the MLC team can check and help.

@NSTiwari Archive.zip

you can try in another PCs if the script fails ?

@RageshAntonyHM: Is this zip file based on the updated JSON that I provided?

@RageshAntonyHM: According to the documentation, the initial steps were to convert the model to sharded weights and then compile the model which generates a Android tar file.

These steps are already done by us. If you need the model file, you can find it here: https://huggingface.co/NSTiwari/scigemma_fine_tuned_quantized/tree/main

We’re only stuck at the last step where the Android tar file needs to be compiled using the prepare_libs.sh script by putting the tar file in the prebuilt_libs folder inside Android/library folder.