Skip to content
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

Print delegation info in export_llama in verbose #7803

Merged
merged 1 commit into from
Jan 22, 2025
Merged

Conversation

iseeyuan
Copy link
Contributor

Summary

For better dev and debugging experience, add delegation info prints in verbose in export_llama. It only shows up with -v option.

Test plan

python -m examples.models.llama.export_llama \
  --model "llama3_2" \
  --checkpoint "${LLAMA_CHECKPOINT:?}" \
  --params "${LLAMA_PARAMS:?}" \
  -kv \
  --use_sdpa_with_kv_cache \
  -X \
  -d bf16 \
  --metadata '{"get_bos_id":128000, "get_eos_ids":[128009, 128001]}' \
  --output_name="llama3_2.pte"
  -v

Copy link

pytorch-bot bot commented Jan 21, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7803

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 21, 2025
@iseeyuan iseeyuan requested a review from Olivia-liu January 21, 2025 20:27
@@ -816,6 +818,13 @@ def _export_llama(args) -> LLMEdgeManager: # noqa: C901

builder = builder.to_executorch(passes=additional_passes)

if args.verbose:
graph_module = builder.edge_manager.exported_program().graph_module
Copy link
Contributor

@tarun292 tarun292 Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EdgeManager is modified inplace, so after to_executorch it inserts memory.alloc nodes for out variant ops. These memory.alloc nodes are not generated in the final PTE file but only used for memory allocation for out tensor of out-variant ops, so the delegation count given here will be inaccurate. I think we should print this right after to_backend above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Let me update it. Thanks @tarun292 !

@iseeyuan
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@iseeyuan
Copy link
Contributor Author

@pytorchbot merge

Copy link

pytorch-bot bot commented Jan 22, 2025

Mergebot is not configured for this repository. Please use the merge button provided by GitHub.

@iseeyuan iseeyuan merged commit 99912cd into main Jan 22, 2025
41 checks passed
@iseeyuan iseeyuan deleted the delegate_info branch January 22, 2025 21:29
SS-JIA added a commit that referenced this pull request Jan 27, 2025
## Context

#7803 added an import to export_llama but did not add it to the buck target.

Differential Revision: [D68716129](https://our.internmc.facebook.com/intern/diff/D68716129/)

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request Jan 27, 2025
## Context

#7803 added an import to export_llama but did not add it to the buck target.

Differential Revision: [D68716129](https://our.internmc.facebook.com/intern/diff/D68716129/)

ghstack-source-id: 263234883
Pull Request resolved: #7963
kirklandsign pushed a commit that referenced this pull request Jan 27, 2025
## Context

#7803 added an import to export_llama but did not add it to the buck target.

Differential Revision: [D68716129](https://our.internmc.facebook.com/intern/diff/D68716129/)

ghstack-source-id: 263234883
Pull Request resolved: #7963

Co-authored-by: Stephen Jia <[email protected]>
YIWENX14 pushed a commit that referenced this pull request Jan 28, 2025
YIWENX14 pushed a commit that referenced this pull request Jan 28, 2025
## Context

#7803 added an import to export_llama but did not add it to the buck target.

Differential Revision: [D68716129](https://our.internmc.facebook.com/intern/diff/D68716129/)

ghstack-source-id: 263234883
Pull Request resolved: #7963

Co-authored-by: Stephen Jia <[email protected]>
zonglinpeng pushed a commit to zonglinpeng/executorch that referenced this pull request Jan 30, 2025
zonglinpeng pushed a commit to zonglinpeng/executorch that referenced this pull request Jan 30, 2025
## Context

pytorch#7803 added an import to export_llama but did not add it to the buck target.

Differential Revision: [D68716129](https://our.internmc.facebook.com/intern/diff/D68716129/)

ghstack-source-id: 263234883
Pull Request resolved: pytorch#7963

Co-authored-by: Stephen Jia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants