Skip to content

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Nov 18, 2025

Summary: Adding a Callable option in the config, so we can customize the nodes to save, and the filenames to save to.
The pass is applied in _program.py, it's hard to do this on the eager model (like we do with delegates) as we have to run the pass after SpecPropPass.

Differential Revision: D87280747

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 18, 2025

🔗 Helpful Links

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

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

❌ 3 New Failures, 1 Cancelled Job, 4 Unrelated Failures

As of commit 96efb61 with merge base d2c011e (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

@meta-cla meta-cla 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 Nov 18, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 18, 2025

@lucylq has exported this pull request. If you are a Meta employee, you can view the originating Diff in D87280747.

@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for customizing external constant tensor storage by allowing a Callable option in the ExecutorchBackendConfig.external_constants field. Previously, this field only accepted a boolean value to determine whether all constants should be externalized. Now it can also accept a function that determines which constants to externalize and which filename to use for storage.

Key changes:

  • Extended external_constants to accept either bool or Callable[[torch.fx.Node], Optional[str]]
  • Updated the conditional logic in to_executorch() to handle both bool and callable cases
  • Added test coverage for the custom callable scenario

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
exir/capture/_config.py Extended type annotation and documentation for external_constants to support Callable option
exir/program/_program.py Updated conditional logic to handle both bool and callable external_constants values
exir/emit/test/test_emit.py Added test case for custom callable external_constants behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Nov 18, 2025
Summary:

Adding a Callable option in the config, so we can customize the nodes to save, and the filenames to save to. 

The pass is applied in _program.py, it's hard to do this on the eager model (like we do with delegates) as we have to run the pass after SpecPropPass.

Differential Revision: D87280747
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Nov 18, 2025
Summary:

Adding a Callable option in the config, so we can customize the nodes to save, and the filenames to save to. 

The pass is applied in _program.py, it's hard to do this on the eager model (like we do with delegates) as we have to run the pass after SpecPropPass.

Differential Revision: D87280747
Summary:

Adding a Callable option in the config, so we can customize the nodes to save, and the filenames to save to. 

The pass is applied in _program.py, it's hard to do this on the eager model (like we do with delegates) as we have to run the pass after SpecPropPass.

Reviewed By: ethansfng

Differential Revision: D87280747
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Nov 20, 2025
Summary:

Adding a Callable option in the config, so we can customize the nodes to save, and the filenames to save to. 

The pass is applied in _program.py, it's hard to do this on the eager model (like we do with delegates) as we have to run the pass after SpecPropPass.

Reviewed By: ethansfng

Differential Revision: D87280747
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Nov 20, 2025
Summary:

Adding a Callable option in the config, so we can customize the nodes to save, and the filenames to save to. 

The pass is applied in _program.py, it's hard to do this on the eager model (like we do with delegates) as we have to run the pass after SpecPropPass.

Reviewed By: ethansfng

Differential Revision: D87280747
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. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants