From 03cfe9cbb7575a170d494bfb468f4c05aec9f245 Mon Sep 17 00:00:00 2001 From: "Wang, Yi" Date: Wed, 20 May 2026 15:58:40 +0800 Subject: [PATCH] update safetensors.torch._tobytes to safetensors.torch._to_ndarray since the api is changed in safetensors 0.8.0rc0 Signed-off-by: Wang, Yi --- src/diffusers/utils/remote_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffusers/utils/remote_utils.py b/src/diffusers/utils/remote_utils.py index 2580bbf5dda9..d109e697dd11 100644 --- a/src/diffusers/utils/remote_utils.py +++ b/src/diffusers/utils/remote_utils.py @@ -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() return {"data": tensor_data, "params": parameters, "headers": headers} @@ -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: