pytorch / pytorch/executorch

Error from LLaMA 3.2 3B Instruct Model generation (.pte)

Open
#6,388 19 comments 0 reactions 1 assignee View on GitHub

@cccclai is already working on this.

Since Oct 21, 2024.

module: qnn partner: qualcomm triaged
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🐛 Describe the bug

Currently I'm trying to test LLaMA 3.2 3B Instruct Model as you guided.
but, I faced some issues during pte generation for LLaMA 3.2 3B Instruct Model with QNN @ On Device side.

I tried just this command as you guided.

python -m examples.models.llama2.export_llama -c "${LLAMA_CHECKPOINT:?}" -p "${LLAMA_PARAMS:?}" -kv --disable_dynamic_shape --qnn -d fp32 --metadata '{"append_eos_to_prompt": 0, "get_bos_id":128000, "get_eos_ids":[128009, 128001], "get_n_bos": 0, "get_n_eos": 0}' --output_name="llama3_2_3b_qnn_Instruct_noquan.pte"

the error logs are as below.

[ERROR] [Qnn ExecuTorch]: graph_prepare.cc:6004:ERROR:couldn't insert overall len

[ERROR] [Qnn ExecuTorch]: QnnDsp Graph executorch serialization failed

[ERROR] [Qnn ExecuTorch]: QnnDsp Failed to serialize graph executorch

[ERROR] [Qnn ExecuTorch]: QnnDsp Context binary serialization failed

[ERROR] [Qnn ExecuTorch]: QnnDsp Get context blob failed.

[ERROR] [Qnn ExecuTorch]: QnnDsp Failed to get serialized binary

[ERROR] [Qnn ExecuTorch]: QnnDsp Failed to get context binary with err 0x138f

[ERROR] [Qnn ExecuTorch]: Can't get graph binary to be saved to cache. Error 5007
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/root/executorch/examples/models/llama2/export_llama.py", line 30, in
main() # pragma: no cover
File "/root/executorch/examples/models/llama2/export_llama.py", line 26, in main
export_llama(modelname, args)
File "/root/executorch/examples/models/llama2/export_llama_lib.py", line 411, in export_llama
builder = _export_llama(modelname, args)
File "/root/executorch/examples/models/llama2/export_llama_lib.py", line 596, in _export_llama
builder = builder_exported_to_edge.to_backend(partitioners)
File "/root/executorch/extension/llm/export/builder.py", line 363, in to_backend
self.edge_manager = self.edge_manager.to_backend(partitioner)
File "/root/executorch/exir/program/_program.py", line 1291, in to_backend
new_edge_programs[name] = to_backend(program, partitioner)
File "/usr/lib/python3.10/functools.py", line 889, in wrapper
return dispatch(args[0].class)(*args, **kw)
File "/root/executorch/exir/backend/backend_api.py", line 396, in _
tagged_graph_module = _partition_and_lower(
File "/root/executorch/exir/backend/backend_api.py", line 319, in _partition_and_lower
partitioned_module = _partition_and_lower_one_graph_module(
File "/root/executorch/exir/backend/backend_api.py", line 249, in _partition_and_lower_one_graph_module
lowered_submodule = to_backend(
File "/usr/lib/python3.10/functools.py", line 889, in wrapper
return dispatch(args[0].class)(*args, **kw)
File "/root/executorch/exir/backend/backend_api.py", line 113, in _
preprocess_result: PreprocessResult = cls.preprocess(
File "/root/executorch/backends/qualcomm/qnn_preprocess.py", line 111, in preprocess
assert len(qnn_context_binary) != 0, "Failed to generate Qnn context binary."
AssertionError: Failed to generate Qnn context binary.

Versions

cc @cccclai @winskuo-quic @shewu-quic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.