Skip to content

Error when exporting Llama3.2-3B-Instruct for Android using QNN #11126

@moxprox

Description

@moxprox

I have setup QNN backend and I am able to export sample model with it. However when exporting Llama-3.2-3B-Instruct for Android SA8295 with this command:

export KV_UPDATER="smart_mask"
export LLAMA_P="/home/moxprox/execu-torch-dev/models/Llama-3.2-3B-Instruct/original/"
python executorch/examples/qualcomm/oss_scripts/llama/llama.py \
-b build-android/ -m SA8295 --ptq 16a4w \
--checkpoint ${LLAMA_P}/consolidated.00.pth \
--params ${LLAMA_P}/params.json \
--tokenizer_model ${LLAMA_P}/tokenizer.model \
--prefill_ar_len 64 --max_seq_len 1024 --prompt "Once upon a time" \
--compile_only --llama_model llama3_2 --model_mode hybrid \
--kv_updater ${KV_UPDATER} --num_sharding 4

I get this weird error:

    flat_args_with_path = _check_inputs_match(args, kwargs, self._in_spec)
  File "/root/miniconda3/envs/executorch/lib/python3.10/site-packages/torch/export/_unlift.py", line 63, in _check_inputs_match
    raise ValueError(  # noqa: B904
torch._dynamo.exc.InternalTorchDynamoError: ValueError: Trying to flatten user inputs with exported input tree spec:
TreeSpec(tuple, None, [TreeSpec(tuple, None, [*,
    *,
    *,
    *]),
  TreeSpec(dict, [], [])])
but actually got inputs with tree spec of:
TreeSpec(tuple, None, [TreeSpec(tuple, None, [*,
    *,
    *,
    *,
    *,
    *]),
  TreeSpec(dict, [], [])]).
Please check that the inputs have the same number and type of args and kwargs as the ones you used when tracing.

from user code:
   File "/root/executorch/backends/qualcomm/utils/utils.py", line 1036, in forward
    ret = lower_module(*inp)
  File "/root/miniconda3/envs/executorch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
  File "/root/executorch/exir/lowered_backend_module.py", line 359, in forward
    return executorch_call_delegate(self, *args)

I cloned the model from HuggingFace, no changes have been made to model config. Could you provide some insight on how to fix this issue?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions