You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taken from https://github.com/huggingface/safetensors/blob/08db34094e9e59e2f9218f2df133b7b4aaff5a99/bindings/python/py_src/safetensors/torch.py#L31C1-L41C59
755
764
"""
765
+
try:
766
+
fromtorch.distributed.tensorimportDTensor
767
+
768
+
ifisinstance(tensor, DTensor):
769
+
# this returns the size of the FULL tensor in bytes
770
+
returntensor.nbytes
771
+
exceptImportError:
772
+
pass
773
+
756
774
try:
757
775
# for torch 2.1 and above we can also handle tensor subclasses
0 commit comments