Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transformers/pytorch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def id_tensor_storage(tensor: torch.Tensor) -> tuple[torch.device, int, int]:

if isinstance(tensor, DTensor):
local_tensor = tensor.to_local()
return tensor.device, local_tensor.storage().data_ptr(), tensor.nbytes
return tensor.device, local_tensor.untyped_storage().data_ptr(), tensor.untyped_storage().nbytes()

if tensor.device.type == "xla" and is_torch_xla_available():
# NOTE: xla tensors dont have storage
Expand Down