Skip to content

Conversation

@JacobSzwejbka
Copy link
Contributor

Summary:
Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

Differential Revision: D67992901

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 22, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit c35b15e with merge base 1f1a96f (image):
💚 Looks good so far! There are no failures yet. 💚

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

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

@JacobSzwejbka JacobSzwejbka added the release notes: api Changes to public facing apis (any interfaces, pybinded runtime methods, etc.) label Jan 22, 2025
JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 23, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

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

Thanks for the changes -- the tests look great

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 24, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

@JacobSzwejbka JacobSzwejbka requested a review from dbort January 24, 2025 18:36
Copy link
Contributor

@dbort dbort left a comment

Choose a reason for hiding this comment

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

Thanks for all of the changes -- looks great apart from the new bugs.

Comment on lines 94 to 99
if (i != 1) {
// Precalculate the size of the data blob.
total_segment_size += aligned_size(tensor.nbytes(), tensor_alignment);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing the --i like in the loop below. Please add a test that would have caught these issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah the existing test does catch this bug. I ran the wrong test (python) before pushing this version

# points to all the data segments. It will be serialized to flatbuffer.
flat_tensor = FlatTensor(
version=0,
version=0, # Keep in sync with c++ version number in serialize.h
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a top-level _SCHEMA_VERSION: int = 0 to raise visibility of this, and to make it map more clearly to the C++ equivalent.

JacobSzwejbka added a commit to JacobSzwejbka/executorch-1 that referenced this pull request Jan 24, 2025
Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

Summary:

Leverage the flatbuffer builder apis to generate a .ptd on device. This will be used by training for checkpointing.

No other use cases really exist for generating a .ptd on device right now, so I didnt worry about making this more easily extensible by coming up with a cpp equivalent of a cord or by trying to think ahead of how this might integrate with delegates.

Later if we add support for delegates owning the weights under ET training we can revisit this.

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

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

@facebook-github-bot facebook-github-bot merged commit 5761083 into pytorch:main Jan 25, 2025
46 of 47 checks passed
YIWENX14 pushed a commit that referenced this pull request Jan 28, 2025
Differential Revision: D67992901

Pull Request resolved: #7841
zonglinpeng pushed a commit to zonglinpeng/executorch that referenced this pull request Jan 30, 2025
Differential Revision: D67992901

Pull Request resolved: pytorch#7841
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 release notes: api Changes to public facing apis (any interfaces, pybinded runtime methods, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants