Skip to content

Running dlc models? Invalid ELF header on InceptionV3 on 6490 #23

@janjongboom

Description

@janjongboom

According to the docs inception_v3 should run on 6490... I grabbed it from AI Hub (https://aihub.qualcomm.com/models/inception_v3?searchTerm=inception) in w8a8 and float format; then try to use it like this:

import os
from qai_appbuilder import (QNNContext, Runtime, LogLevel, ProfilingLevel, PerfProfile, QNNConfig)

curr_dir = os.path.dirname(os.path.realpath(__file__))
# Download w8a8 Qualcomm AI Runtime binary from https://aihub.qualcomm.com/models/inception_v3?searchTerm=inception
MODEL_FILE = os.path.join(curr_dir, 'inception_v3-inception-v3-w8a8.dlc')

# InceptionV3 class which inherited from the class QNNContext.
class InceptionV3(QNNContext):
    def Inference(self, input_data):
        input_datas=[input_data]
        output_data = super().Inference(input_datas)[0]
        return output_data

# Config AppBuilder environment (/usr/lib contains all my .so files; and I run other models (eg TFLite w/ QNN delegates; or LLMs w/ the QAI AppBuilder Genie bindings) fine)
QNNConfig.Config('/usr/lib', Runtime.HTP, LogLevel.WARN, ProfilingLevel.BASIC)

# Instance for InceptionV3 objects.
inceptionV3 = InceptionV3("inceptionV3", MODEL_FILE)

This yields:

     0.4ms [ ERROR ] Unable to load model. pal::dynamicloading::dlError(): /home/ubuntu/context-binary-demo/inception_v3-inception-v3-w8a8.dlc: invalid ELF header
     0.4ms [ ERROR ] Error initializing QNN Function Pointers: could not load model: /home/ubuntu/context-binary-demo/inception_v3-inception-v3-w8a8.dlc
Error initializing QNN Function Pointers: could not load model: /home/ubuntu/context-binary-demo/inception_v3-inception-v3-w8a8.dlc

Any idea?

EfficientNetB0 has the same issue (also with qnn-net-run):

(.venv) ubuntu@ubuntu:~/context-binary-demo$ qnn-net-run --backend libQnnHtp.so --model efficientnet_b0-efficientnet-b0-w8a16.dlc
qnn-net-run pid:7300
qnn-net-run build version: v2.35.0.250530123435_121478
     0.6ms [ ERROR ] Unable to load model. dlerror(): efficientnet_b0-efficientnet-b0-w8a16.dlc: invalid ELF header
     0.6ms [ ERROR ] Failed to load ModelLib!
     0.6ms [ ERROR ] Could not load model : efficientnet_b0-efficientnet-b0-w8a16.dlc!
Initialization failure

dlc looks like a zip file:

(.venv) ubuntu@ubuntu:~/context-binary-demo$ file efficientnet_b0-efficientnet-b0-w8a16.dlc
efficientnet_b0-efficientnet-b0-w8a16.dlc: Zip archive data, at least v4.5 to extract, compression method=store

And it extracts (but throws some CRC errors).

(.venv) ubuntu@ubuntu:~/context-binary-demo$ unzip -d inception inception_v3-inception-v3-w8a8.dlc
Archive:  inception_v3-inception-v3-w8a8.dlc
 extracting: inception/dlc.metadata2.1.0   bad CRC 05688358  (should be 00000000)
 extracting: inception/model          bad CRC 0f32a6ff  (should be 00000000)
 extracting: inception/model.params   bad CRC c8758672  (should be 00000000)
 extracting: inception/model.params.bin   bad CRC b2f93d75  (should be 00000000)

I guess I need a bin file? From reading the example, but how can I get this bin file? The model.params.bin file at least does not work.

ChatGPT suggested this:

(.venv) ubuntu@ubuntu:~/context-binary-demo$ qnn-net-run --backend /usr/lib/libQnnHtp.so --model /usr/lib/libQnnModelDlc.so --dlc_path $PWD/inception_v3-inception-v3-w8a8.dlc
qnn-net-run pid:8095
qnn-net-run build version: v2.35.0.250530123435_121478
 <W> Initializing HtpProvider
qnn-net-run log level is : QNN_LOG_LEVEL_ERROR
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.35.0/release/snpe_src/avante-tools/prebuilt/dsp/hexagon-sdk-5.4.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpc
Composing Graphs
   162.6ms [ ERROR ] Failed to create dlc handle with code 1002 for dlc file at /home/ubuntu/context-binary-demo/inception_v3-inception-v3-w8a8.dlc.
   162.6ms [ ERROR ] ComposeGraphs Failed with error = 1
Graph Prepare failure
 <W> Backend 1 free cleanup called during process exit
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
 <E> exits with 2147483647, undefined m_mutex handle object
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.35.0/release/snpe_src/avante-tools/prebuilt/dsp/hexagon-sdk-5.4.0/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc

^ Also fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions