-
Notifications
You must be signed in to change notification settings - Fork 367
updating flatten/unflatten functions #3282
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3282
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit fd731af with merge base 9266734 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
83fdbdc to
bd6bbac
Compare
jerryzh168
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a test for the format as well? it's a bit surprising to see that format changes like this doesn't require any changes to the test
1539983 to
22d8c3a
Compare
1c695a1 to
cb2b13e
Compare
| result = {} | ||
|
|
||
| for tensor_name in tensor_names: | ||
| prefix = f"{tensor_name.rsplit('.', 1)[0]}._{tensor_name.rsplit('.', 1)[1]}_" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: split the tensor_name separate beforehand?
module_fqn, weight_name = tensor_name.rsplit(".", 1)
...
jerryzh168
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, although I think ideally this should be 2 PRs, future PRs should only contain a single change for easy review and clear purpose
cb2b13e to
fd731af
Compare
Summary
Updating
unflatten_tensor_state_dictandflatten_tensor_state_dictto only modify tensor subclasses. Also changing naming format so that we can directly assign module parameters.Testing
python test/prototype/safetensors/test_safetensors_support.py