Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/diffusers/utils/remote_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def prepare_decode(
headers["Accept"] = "image/png"
elif output_type == "mp4":
headers["Accept"] = "text/plain"
tensor_data = safetensors.torch._tobytes(tensor, "tensor")
tensor_data = safetensors.torch._to_ndarray(tensor)[0].tobytes()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be version guarded?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since https://github.com/huggingface/diffusers/blob/main/setup.py#L126, in 0.8.0rc0 it's already the new api

return {"data": tensor_data, "params": parameters, "headers": headers}


Expand Down Expand Up @@ -369,7 +369,7 @@ def prepare_encode(
if shift_factor is not None:
parameters["shift_factor"] = shift_factor
if isinstance(image, torch.Tensor):
data = safetensors.torch._tobytes(image.contiguous(), "tensor")
data = safetensors.torch._to_ndarray(image.contiguous())[0].tobytes()
parameters["shape"] = list(image.shape)
parameters["dtype"] = str(image.dtype).split(".")[-1]
else:
Expand Down
Loading