1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

make tensors contiguous before passing to safetensors (#10761)

fix contiguous bug
This commit is contained in:
Fanli Lin
2025-02-13 14:27:53 +08:00
committed by GitHub
parent 051ebc3c8d
commit 97abdd2210

View File

@@ -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