I used the MLC tool on my Mac to compile a large model, then compiled it into an Android app. When running it on my phone, I encountered the following error:
org.apache.tvm.Base$TVMError: TVMError: Binary was created using {relax.VMExecutable} but a loader of that name is not registered. Available loaders are relax.Executable, opencl. Perhaps you need to recompile with this runtime enabled.
Here are my specific steps:
- Install TVM Unity Compiler
python -m pip install --pre -U -f https://mlc.ai/wheels mlc-ai-nightly-cpu
- Install MLC LLM Python Package¶
python -m pip install --pre -U -f https://mlc.ai/wheels mlc-llm-nightly-cpu mlc-ai-nightly-cpu
-
Convert Model Weights
-
Compile Model Libraries
-
Update mlc-llm/android/MLCChat/mlc-package-config.json
{ "device": "android", "model_list": [ { "model": "../../../../android/dist/deepseek-r1-1.5b-q4f16_1-MLC/", "model_lib": "qwen2_q4f16_1", "estimated_vram_bytes": 1537736704, "model_id": "deepseek-r1-1.5b-q4f16_1-MLC", "overrides": { "prefill_chunk_size": 768 }, "bundle_weight": true } ], "model_lib_path_for_prepare_libs": { "qwen2_q4f16_1": "../../../../android/dist/libs/deepseek-r1-1.5b-q4f16_1-android.tar" } }
-
Build export MLC_LLM_SOURCE_DIR=/path/to/mlc-llm mlc_llm package
-
Build Android App
-
Install APK
python bundle_weight.py --apk-path app/release/app-release.apk
When running on the phone, the following error occurs:
org.apache.tvm.Base$TVMError: TVMError: Binary was created using {relax.VMExecutable} but a loader of that name is not registered. Available loaders are relax.Executable, opencl. Perhaps you need to recompile with this runtime enabled.
What could be the reason?