Skip to content

Commit 24fe99c

Browse files
shewu-quicfacebook-github-bot
authored andcommitted
Qualcomm AI Engine Direct - Fixed the bug in dummy_llama2 script (#2587)
Summary: bypass-github-export-checks bypass-github-executorch-ci-checks - Add compile only argument in dummy_llama2 Pull Request resolved: #2587 Reviewed By: kirklandsign Differential Revision: D55248247 Pulled By: cccclai fbshipit-source-id: cc11560b30223f425ef71391f0b43dbde25c1126
1 parent 1d934f0 commit 24fe99c

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

examples/qualcomm/scripts/dummy_llama2.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import json
88
import os
99
import re
10+
import sys
1011
from multiprocessing.connection import Client
1112

1213
import numpy as np
@@ -71,20 +72,6 @@ def create_device_inputs(example_inputs, use_kv_cache):
7172
default="8a8w",
7273
)
7374

74-
# QNN_SDK_ROOT might also be an argument, but it is used in various places.
75-
# So maybe it's fine to just use the environment.
76-
if "QNN_SDK_ROOT" not in os.environ:
77-
raise RuntimeError("Environment variable QNN_SDK_ROOT must be set")
78-
print(f"QNN_SDK_ROOT={os.getenv('QNN_SDK_ROOT')}")
79-
80-
if "LD_LIBRARY_PATH" not in os.environ:
81-
print(
82-
"[Warning] LD_LIBRARY_PATH is not set. If errors like libQnnHtp.so "
83-
"not found happen, please follow setup.md to set environment."
84-
)
85-
else:
86-
print(f"LD_LIBRARY_PATH={os.getenv('LD_LIBRARY_PATH')}")
87-
8875
args = parser.parse_args()
8976

9077
# ensure the working directory exist.
@@ -120,6 +107,10 @@ def create_device_inputs(example_inputs, use_kv_cache):
120107
custom_annotations=(),
121108
quant_dtype=quant_dtype,
122109
)
110+
111+
if args.compile_only:
112+
sys.exit(0)
113+
123114
adb = SimpleADB(
124115
qnn_sdk=os.getenv("QNN_SDK_ROOT"),
125116
artifact_path=f"{args.build_folder}",

0 commit comments

Comments
 (0)