Unverified Commit 97abdd22 authored by Fanli Lin's avatar Fanli Lin Committed by GitHub
Browse files

make tensors contiguous before passing to safetensors (#10761)

fix contiguous bug
parent 051ebc3c
......@@ -549,7 +549,7 @@ class ModelMixin(torch.nn.Module, PushToHubMixin):
os.remove(full_filename)
for filename, tensors in state_dict_split.filename_to_tensors.items():
shard = {tensor: state_dict[tensor] for tensor in tensors}
shard = {tensor: state_dict[tensor].contiguous() for tensor in tensors}
filepath = os.path.join(save_directory, filename)
if safe_serialization:
# At some point we will need to deal better with save_function (used for TPU and other distributed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment