Skip to content

Commit 7da190a

Browse files
Michael Gschwindfacebook-github-bot
authored andcommitted
Add new tests: 4b dq, kv sdpa (#2378)
Summary: Add new tests: 4b dq, kv sdpa Reviewed By: manuelcandales Differential Revision: D54806721
1 parent 42eeebc commit 7da190a

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

examples/models/llama2/export_llama_lib.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,20 @@ def _export_llama(modelname, args) -> str: # noqa: C901
476476
if builder.dtype == DType.fp16:
477477
modelname = f"{modelname}_h"
478478

479-
builder.save_to_pte(modelname)
480-
481479
if args.output_name:
482480
modelname = args.output_name
483-
if modelname[-4:] == ".pte":
481+
if modelname.endswith(".pte"):
482+
output_file = modelname
484483
modelname = modelname[:-4]
484+
print(f"modelname: {modelname}")
485+
print(f"output_file: {output_file}")
486+
else:
487+
output_file = f"{builder.output_dir}/{modelname}.pte"
488+
print(f"modelname: {modelname}")
489+
print(f"output_file: {output_file}")
490+
else:
491+
output_file = f"{builder.output_dir}/{modelname}.pte"
485492

486-
output_file = f"{builder.output_dir}/{modelname}.pte"
493+
builder.save_to_pte(output_file)
487494

488495
return output_file

examples/portable/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ def export_to_exec_prog(
101101
def save_pte_program(
102102
prog: ExecutorchProgramManager, model_name: str, output_dir: str = ""
103103
) -> None:
104-
filename = os.path.join(output_dir, f"{model_name}.pte")
104+
if model_name.endswith(".pte"):
105+
filename = model_name
106+
else:
107+
filename = os.path.join(output_dir, f"{model_name}.pte")
108+
105109
try:
106110
with open(filename, "wb") as file:
107111
prog.write_to_file(file)

0 commit comments

Comments
 (0)