Skip to content

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Jul 17, 2025

Add examples on how to generate PTE, PTD files, and how to run them in ExecuTorch via Module.

Note: I created a separate ET submodule --> we need the changes from 0.7 for this. However, I'm not sure we should be creating a new submodule for each project.

Issue: pytorch/executorch#12215

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 17, 2025
@lucylq lucylq force-pushed the lfq.program-data-separation-example branch 6 times, most recently from 11059f6 to bd2e5c2 Compare July 17, 2025 21:43
@lucylq lucylq marked this pull request as ready for review July 17, 2025 21:43
@lucylq lucylq requested a review from mergennachin July 17, 2025 21:44
@lucylq lucylq force-pushed the lfq.program-data-separation-example branch from bd2e5c2 to 588ae93 Compare July 17, 2025 21:49
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.

See inline

const char *data_path = FLAGS_data_path.c_str();

// Load the model.
Module module(model_path, data_path);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!!

Copy link
Contributor

Choose a reason for hiding this comment

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

@shoumikhin , @kirklandsign

do we have support for swift and java bindings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added support for java bindings in the LLM runner. Outside of that, I don't think there is support yet.

* LICENSE file in the root directory of this source tree.
*/

#include <executorch/extension/module/module.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me add these

Comment on lines +103 to +109
with open(pte_file, "wb") as fp:
executorch_program.write_to_file(fp)
if executorch_program._tensor_data.get("_default_external_constant"):
executorch_program._tensor_data[model_name] = (
executorch_program._tensor_data.pop("_default_external_constant")
)
executorch_program.write_tensor_data_to_file(args.outdir)
Copy link
Contributor

Choose a reason for hiding this comment

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

where are these AOT APIs document?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lucylq lucylq force-pushed the lfq.program-data-separation-example branch from 588ae93 to 76175cd Compare July 23, 2025 00:51
@lucylq lucylq requested a review from mergennachin July 23, 2025 16:11
@lucylq lucylq merged commit 34f605b into main Jul 23, 2025
1 check passed
@kirklandsign kirklandsign deleted the lfq.program-data-separation-example branch September 24, 2025 18:03
@mergennachin mergennachin mentioned this pull request Oct 18, 2025
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 Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants