-
Notifications
You must be signed in to change notification settings - Fork 662
PT2ArchiveDataMap #13973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh/lucylq/103/base
Are you sure you want to change the base?
PT2ArchiveDataMap #13973
Conversation
This diff introduces the PT2ArchiveDataMap, which reads the weights in .pt2 archive files. 1. Open the archive file with miniz 2. There are two json config files (weights_config.json, constants_config.json) with information on weight name -> {weight path, weight metadata}. Open and extract weight information into unordered_maps; then free the json blobs. 3. For get_tensor_layout calls, return the json information. 4. For get_data calls, use miniz to calculate the offset + size and then use data loader. PT2 archive files are not compressed (to allow mmap-ing), so this is fine. PT2 archive format: https://docs.google.com/document/d/1xdx3I4zK6naPEWX3e49rCUccZeAC9zMLCFKXvUQFR7o/edit?tab=t.0 Serde: https://docs.google.com/document/d/11X-KsLPMJGdEr4sG4sCNLnGLhSKrc8utDGMQqFbZx9E/edit?tab=t.0#heading=h.tsw6d16xh497 --- TODO in subsequent diffs - convert stride to dim order - Additional testing; failure cases, model file with constants as well as weights, model with no weights. - CMake for OSS Differential Revision: [D81248896](https://our.internmc.facebook.com/intern/diff/D81248896/) [ghstack-poisoned]
This diff introduces the PT2ArchiveDataMap, which reads the weights in .pt2 archive files. 1. Open the archive file with miniz 2. There are two json config files (weights_config.json, constants_config.json) with information on weight name -> {weight path, weight metadata}. Open and extract weight information into unordered_maps; then free the json blobs. 3. For get_tensor_layout calls, return the json information. 4. For get_data calls, use miniz to calculate the offset + size and then use data loader. PT2 archive files are not compressed (to allow mmap-ing), so this is fine. PT2 archive format: https://docs.google.com/document/d/1xdx3I4zK6naPEWX3e49rCUccZeAC9zMLCFKXvUQFR7o/edit?tab=t.0 Serde: https://docs.google.com/document/d/11X-KsLPMJGdEr4sG4sCNLnGLhSKrc8utDGMQqFbZx9E/edit?tab=t.0#heading=h.tsw6d16xh497 --- TODO in subsequent diffs - convert stride to dim order - Additional testing; failure cases, model file with constants as well as weights, model with no weights. - CMake for OSS Differential Revision: [D81248896](https://our.internmc.facebook.com/intern/diff/D81248896/) ghstack-source-id: 307655657 Pull Request resolved: #13973
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13973
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 2 Unrelated FailuresAs of commit 16600d9 with merge base 151f3be ( NEW FAILURES - The following jobs have failed:
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. |
This pull request was exported from Phabricator. Differential Revision: D81248896 |
This PR needs a
|
This diff introduces the PT2ArchiveDataMap, which reads the weights in .pt2 archive files. 1. Open the archive file with miniz 2. There are two json config files (weights_config.json, constants_config.json) with information on weight name -> {weight path, weight metadata}. Open and extract weight information into unordered_maps; then free the json blobs. 3. For get_tensor_layout calls, return the json information. 4. For get_data calls, use miniz to calculate the offset + size and then use data loader. PT2 archive files are not compressed (to allow mmap-ing), so this is fine. PT2 archive format: https://docs.google.com/document/d/1xdx3I4zK6naPEWX3e49rCUccZeAC9zMLCFKXvUQFR7o/edit?tab=t.0 Serde: https://docs.google.com/document/d/11X-KsLPMJGdEr4sG4sCNLnGLhSKrc8utDGMQqFbZx9E/edit?tab=t.0#heading=h.tsw6d16xh497 --- TODO in subsequent diffs - convert stride to dim order - Additional testing; failure cases, model file with constants as well as weights, model with no weights. - CMake for OSS Differential Revision: [D81248896](https://our.internmc.facebook.com/intern/diff/D81248896/) [ghstack-poisoned]
Pull Request resolved: #13973 This diff introduces the PT2ArchiveDataMap, which reads the weights in .pt2 archive files. 1. Open the archive file with miniz 2. There are two json config files (weights_config.json, constants_config.json) with information on weight name -> {weight path, weight metadata}. Open and extract weight information into unordered_maps; then free the json blobs. 3. For get_tensor_layout calls, return the json information. 4. For get_data calls, use miniz to calculate the offset + size and then use data loader. PT2 archive files are not compressed (to allow mmap-ing), so this is fine. PT2 archive format: https://docs.google.com/document/d/1xdx3I4zK6naPEWX3e49rCUccZeAC9zMLCFKXvUQFR7o/edit?tab=t.0 Serde: https://docs.google.com/document/d/11X-KsLPMJGdEr4sG4sCNLnGLhSKrc8utDGMQqFbZx9E/edit?tab=t.0#heading=h.tsw6d16xh497 --- TODO in subsequent diffs - convert stride to dim order - Additional testing; failure cases, model file with constants as well as weights, model with no weights. - CMake for OSS ghstack-source-id: 308366584 @exported-using-ghexport Differential Revision: [D81248896](https://our.internmc.facebook.com/intern/diff/D81248896/)
This pull request was exported from Phabricator. Differential Revision: D81248896 |
Stack from ghstack (oldest at bottom):
This diff introduces the PT2ArchiveDataMap, which reads the weights in .pt2 archive files.
PT2 archive format: https://docs.google.com/document/d/1xdx3I4zK6naPEWX3e49rCUccZeAC9zMLCFKXvUQFR7o/edit?tab=t.0
Serde: https://docs.google.com/document/d/11X-KsLPMJGdEr4sG4sCNLnGLhSKrc8utDGMQqFbZx9E/edit?tab=t.0#heading=h.tsw6d16xh497
TODO in subsequent diffs
Differential Revision: D81248896