Skip to content

Commit

Permalink
make tensors contiguous before passing to safetensors (#10761)
Browse files Browse the repository at this point in the history
fix contiguous bug
  • Loading branch information
faaany authored Feb 13, 2025
1 parent 051ebc3 commit 97abdd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/diffusers/models/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def save_pretrained(
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
Expand Down

0 comments on commit 97abdd2

Please sign in to comment.