Skip to content

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Nov 19, 2025

Summary:
Create pybindings around the FlatTensorDataMap::load function

This allows us to use the low-level program data separation APIs in pybindings, through program/method as well as Module.

Use py::capsule to capture the type const NamedDataMap* that is passed into method_load.

Example usage:

 >>> inputs = (torch.randn(3),)
 >>> program = _load_program_from_buffer(program_buffer)
 >>> data_map = _load_flat_tensor_data_map("model.ptd")
 >>> method = program.load_method("forward", data_map.get_named_data_map())
 >>> outputs = method(inputs)[0]

Differential Revision: D87461455

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 19, 2025

🔗 Helpful Links

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

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

❌ 4 New Failures, 1 Unrelated Failure

As of commit 49cc0e9 with merge base ee236cb (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness 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 19, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 19, 2025

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

@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.

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

Create pybindings around the FlatTensorDataMap::load function

This allows us to use the low-level program data separation APIs in pybindings, through program/method as well as Module.

Use `py::capsule` to capture the type `const NamedDataMap*` that is passed into method_load.

Example usage:
```
 >>> inputs = (torch.randn(3),)
 >>> program = _load_program_from_buffer(program_buffer)
 >>> data_map = _load_flat_tensor_data_map("model.ptd")
 >>> method = program.load_method("forward", data_map.get_named_data_map())
 >>> outputs = method(inputs)[0]
```

Differential Revision: D87461455
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Dec 2, 2025
Summary:

Create pybindings around the FlatTensorDataMap::load function

This allows us to use the low-level program data separation APIs in pybindings, through program/method as well as Module.

Use `py::capsule` to capture the type `const NamedDataMap*` that is passed into method_load.

Example usage:
```
 >>> inputs = (torch.randn(3),)
 >>> program = _load_program_from_buffer(program_buffer)
 >>> data_map = _load_flat_tensor_data_map("model.ptd")
 >>> method = program.load_method("forward", data_map.get_named_data_map())
 >>> outputs = method(inputs)[0]
```

Differential Revision: D87461455
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Dec 3, 2025
Summary:

Create pybindings around the FlatTensorDataMap::load function

This allows us to use the low-level program data separation APIs in pybindings, through program/method as well as Module.

Use `py::capsule` to capture the type `const NamedDataMap*` that is passed into method_load.

Example usage:
```
 >>> inputs = (torch.randn(3),)
 >>> program = _load_program_from_buffer(program_buffer)
 >>> data_map = _load_flat_tensor_data_map("model.ptd")
 >>> method = program.load_method("forward", data_map.get_named_data_map())
 >>> outputs = method(inputs)[0]
```

Differential Revision: D87461455
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Dec 10, 2025
Summary:

Create pybindings around the FlatTensorDataMap::load function

This allows us to use the low-level program data separation APIs in pybindings, through program/method as well as Module.

Use `py::capsule` to capture the type `const NamedDataMap*` that is passed into method_load.

Example usage:
```
 >>> inputs = (torch.randn(3),)
 >>> program = _load_program_from_buffer(program_buffer)
 >>> data_map = _load_flat_tensor_data_map("model.ptd")
 >>> method = program.load_method("forward", data_map.get_named_data_map())
 >>> outputs = method(inputs)[0]
```

Reviewed By: JacobSzwejbka

Differential Revision: D87461455
Summary:

Create pybindings around the FlatTensorDataMap::load function

This allows us to use the low-level program data separation APIs in pybindings, through program/method as well as Module.

Use `py::capsule` to capture the type `const NamedDataMap*` that is passed into method_load.

Example usage:
```
 >>> inputs = (torch.randn(3),)
 >>> program = _load_program_from_buffer(program_buffer)
 >>> data_map = _load_flat_tensor_data_map("model.ptd")
 >>> method = program.load_method("forward", data_map.get_named_data_map())
 >>> outputs = method(inputs)[0]
```

Reviewed By: JacobSzwejbka

Differential Revision: D87461455
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