+
Skip to content

Conversation

liangel-02
Copy link
Contributor

@liangel-02 liangel-02 commented Sep 4, 2025

Summary

save_tensor_state_dict and load_tensor_state_dict was previously responsible for directly calling safetensors.save_file and savetensors.load_file.

we've now refactored that functionality so that these two functions (renamed to unflatten_tensor_state_dict and flatten_tensor_state_dict respectively) only flattens/unflattens tensor subclass state dict so that it is compatible with huggingface interface.

Test Plan
python test/prototype/safetensors/test_safetensors_support.py

updated test file to include utility function that calls savetensors.load_file and handles specific loading logic.

Copy link

pytorch-bot bot commented Sep 4, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2936

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

✅ No Failures

As of commit 8708caf with merge base f35ae41 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Sep 4, 2025
@liangel-02 liangel-02 added topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories) module: rocm ciflow/rocm ciflow/4xh100 labels Sep 4, 2025
@liangel-02 liangel-02 marked this pull request as ready for review September 4, 2025 00:11
@liangel-02 liangel-02 force-pushed the safetensors_refactoring branch 3 times, most recently from cb0854f to 8d6f745 Compare September 4, 2025 00:51
@liangel-02 liangel-02 force-pushed the safetensors_refactoring branch 2 times, most recently from e3a6d23 to afb5270 Compare September 4, 2025 15:16
@liangel-02 liangel-02 force-pushed the safetensors_refactoring branch from afb5270 to bdab1d2 Compare September 4, 2025 17:36
@liangel-02 liangel-02 changed the title refactoring functions for huggingface integration [safetensors enablement] refactoring for huggingface integration Sep 4, 2025
@liangel-02 liangel-02 force-pushed the safetensors_refactoring branch from bdab1d2 to 60bb577 Compare September 4, 2025 17:56
@liangel-02 liangel-02 force-pushed the safetensors_refactoring branch from 60bb577 to f4951c5 Compare September 4, 2025 18:01
@liangel-02 liangel-02 force-pushed the safetensors_refactoring branch from f4951c5 to 8708caf Compare September 4, 2025 18:48
@liangel-02 liangel-02 merged commit 7b81460 into main Sep 5, 2025
20 of 21 checks passed
@liangel-02 liangel-02 deleted the safetensors_refactoring branch September 5, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rocm ciflow/4xh100 CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: rocm topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载