Skip to content

update export_llama #1565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 9 additions & 1 deletion examples/models/llama2/export_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import torch
from executorch.exir.capture._config import EdgeCompileConfig, ExecutorchBackendConfig
from executorch.exir.passes.sym_shape_eval_pass import ConstraintBasedSymShapeEvalPass

from ...portable.utils import export_to_edge, save_pte_program

Expand Down Expand Up @@ -54,7 +55,14 @@ def main() -> None:
)

export_program = edge_manager.to_executorch(
ExecutorchBackendConfig(extract_constant_segment=True)
ExecutorchBackendConfig(
extract_constant_segment=True,
sym_shape_eval_pass=ConstraintBasedSymShapeEvalPass(),
)
)
print(
"Required memory for activation in bytes: ",
export_program._emitter_output.program.execution_plan[0].non_const_buffer_sizes,
)
save_pte_program(export_program.buffer, "llama2", args.output_dir)
# model.forward(input)
Expand Down