Skip to content

Commit 123fe91

Browse files
authored
Run Qwen script with Buck
Differential Revision: D79386256 Pull Request resolved: #13114
1 parent 07b6059 commit 123fe91

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

examples/qualcomm/oss_scripts/llama/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ python_library(
2626
"//executorch/devtools/backend_debug:delegation_info",
2727
"//executorch/devtools:lib",
2828
"//executorch/examples/models:models",
29+
"//executorch/examples/models/llama:hf_download",
2930
"//executorch/examples/qualcomm/oss_scripts/llama:static_llama",
3031
"//executorch/examples/qualcomm:utils",
3132
"//executorch/extension/export_util:export_util",

examples/qualcomm/oss_scripts/llama/llama.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -350,24 +350,15 @@ def compile(args, pte_filename, tokenizer):
350350
start_ts = time.time()
351351

352352
kv_config, prefill_config = None, None
353-
params_path = ""
354353
if args.params:
355-
params_path = args.params
356-
else:
357-
if args.decoder_model == "qwen2_5":
358-
cur_dir = os.path.dirname(__file__)
359-
params_path = os.path.join(
360-
cur_dir,
361-
"..",
362-
"..",
363-
"..",
364-
"models",
365-
"qwen2_5",
366-
"config",
367-
"0_5b_config.json",
368-
)
369-
with open(params_path) as f:
370-
kv_config = ModelArgs(**json.load(f))
354+
with open(args.params) as f:
355+
kv_config = ModelArgs(**json.load(f))
356+
elif args.decoder_model == "qwen2_5":
357+
from importlib.resources import files
358+
359+
data_dir = files("executorch").joinpath("examples/models/qwen2_5/config")
360+
config_file = data_dir.joinpath("0_5b_config.json")
361+
kv_config = ModelArgs(**json.loads(config_file.read_text()))
371362

372363
# TODO: support batch inputs if necessary
373364
kv_config.max_batch_size = 1
@@ -505,7 +496,7 @@ def permute(w, heads):
505496
apply_spinquant(
506497
model,
507498
use_r1=True,
508-
use_r2=True,
499+
use_r2=False,
509500
use_r4=False,
510501
pretrained_rotation_path=None,
511502
qkv_split=True,

0 commit comments

Comments
 (0)