Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions examples/qualcomm/oss_scripts/llama/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ python_library(
],
)

python_library(
name = "llama_lib",
srcs = ["llama.py"],
deps = [
"//caffe2:torch",
"//executorch/backends/qualcomm/partition:partition",
"//executorch/backends/qualcomm/quantizer:quantizer",
"//executorch/devtools:lib",
"//executorch/examples/models:models",
"//executorch/examples/qualcomm/oss_scripts/llama:static_llama",
"//executorch/examples/qualcomm:utils",
"//executorch/extension/export_util:export_util",
"//executorch/extension/llm/custom_ops:model_sharding_py",
"//executorch/extension/llm/export:export_lib",
"//executorch/extension/pybindings:aten_lib",
],
)

python_binary(
name = "llama",
srcs = ["llama.py"],
Expand Down
12 changes: 9 additions & 3 deletions examples/qualcomm/oss_scripts/llama/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def post_process():
logging.info(f"Results[{idx}]:\n{output}")


def main():
def _build_parser():
parser = setup_common_args_and_variables()
parser.add_argument(
"-a",
Expand Down Expand Up @@ -980,7 +980,13 @@ def main():
help="Fallback to cpu embedding operator and type of embedding quantization, '<bitwidth>,<groupsize>', e.g., '4,32'.",
)

args = parser.parse_args()
return parser


def main(args) -> None:
parser = _build_parser()

args = parser.parse_args(args)
if args.compile_only and args.pre_gen_pte:
exit("Cannot set both compile_only and pre_gen_pte as true")

Expand Down Expand Up @@ -1071,4 +1077,4 @@ def main():

# flake8: noqa: C901
if __name__ == "__main__":
main()
main(sys.argv[1:])
Loading