Skip to content

Conversation

lucylq
Copy link
Contributor

@lucylq lucylq commented Sep 2, 2025

Summary: Add support for optional data path for pybindings.

Differential Revision: D76353209

@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 Sep 2, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76353209

Copy link

github-actions bot commented Sep 2, 2025

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.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76353209

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Sep 2, 2025
Summary:
Pull Request resolved: pytorch#13886

Add support for optional data path for pybindings.

Differential Revision: D76353209
Copy link

pytorch-bot bot commented Sep 2, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 8eb077b with merge base fbda3a9 (image):

NEW FAILURE - The following job has failed:

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

tensor_data = bytes(exec_program._tensor_data.pop("_default_external_constant"))
ptd.write(tensor_data)

executorch_program = self.runtime._load_for_executorch(pte_file, ptd_file)
Copy link
Contributor

Choose a reason for hiding this comment

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

probably need to update the pyi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated!

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

Add support for optional data path for pybindings.

Differential Revision: D76353209
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76353209

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

Add support for optional data path for pybindings.

Differential Revision: D76353209
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76353209

)
ptd.write(tensor_data)

executorch_program = self.runtime._load_for_executorch(pte_file, ptd_file)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine to update the legacy API (methods that start with _) but we have modern pybindings APIs that we want users to use.

https://colab.research.google.com/drive/1qpxrXC3YdJQzly3mRg-4ayYiOjC6rue3?usp=sharing#scrollTo=Kp-MxVVHkirE

Don't we need to update runtime.load_program(pte, ptd) too?

Copy link
Contributor Author

@lucylq lucylq Sep 8, 2025

Choose a reason for hiding this comment

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

Thanks Mergen, sorry for the late response. I think runtime.load_program is only intended to take a PTE file --> it understands and deserializes the PTE file format (not PTD). The C++ Program object doesn't hold a PTD file.

We can potentially support this in load_method, which takes a NamedDataMap (from PTD) as an optional argument. We'd need to add pybindings on extension/flat_tensor to load the PTD file for this.

Having it in Module may be OK at the moment, let me know what you think (I can add pybindings for extension/flat_tensor in a separate PR).

Copy link
Contributor

@mergennachin mergennachin left a comment

Choose a reason for hiding this comment

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

def load_program(
self,
data: Union[bytes, bytearray, BinaryIO, Path, str],
*,
verification: Verification = Verification.InternalConsistency,
) -> Program:

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

Add support for optional data path for pybindings.

Reviewed By: JacobSzwejbka

Differential Revision: D76353209
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Sep 8, 2025
Summary:

Add support for optional data path for pybindings.

Reviewed By: JacobSzwejbka

Differential Revision: D76353209
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76353209

Summary:
Pull Request resolved: pytorch#13886

Pull request resolved: pytorch#13886

Add support for optional data path for pybindings.

Reviewed By: JacobSzwejbka

Differential Revision: D76353209
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76353209

@facebook-github-bot facebook-github-bot merged commit 6c12956 into pytorch:main Sep 8, 2025
116 of 118 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants