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

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:

  1. Install TVM Unity Compiler

python -m pip install --pre -U -f https://mlc.ai/wheels mlc-ai-nightly-cpu

  1. Install MLC LLM Python Package

python -m pip install --pre -U -f https://mlc.ai/wheels mlc-llm-nightly-cpu mlc-ai-nightly-cpu

  1. Convert Model Weights

  2. Compile Model Libraries

  3. 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"
    }
}
  1. Build export MLC_LLM_SOURCE_DIR=/path/to/mlc-llm mlc_llm package

  2. Build Android App

  3. 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?

please first see if you can compile model following the official instruction, the main reason of this error is because the tvm4j library is not bundled correctly Android SDK — mlc-llm 0.1.0 documentation

Thank you for reply. I am able to compile the model normally, and the generated files also appear to be normal.

└── lib
    └── mlc4j
        ├── build.gradle
        ├── output
        │   ├── arm64-v8a
        │   │   └── libtvm4j_runtime_packed.so
        │   └── tvm4j_core.jar
        └── src
            ├── cpp
            │   └── tvm_runtime.h
            └── main
                ├── AndroidManifest.xml
                ├── assets
                │   └── mlc-app-config.json
                └── java
                    └── ai
                        └── mlc
                            └── mlcllm
                                ├── JSONFFIEngine.java
                                ├── MLCEngine.kt
                                └── OpenAIProtocol.kt

However, the previous issue still exists.