Skip to content

Commit 37467de

Browse files
authored
update safetensors.torch._tobytes to safetensors.torch._to_ndarray (#13770)
since the api is changed in safetensors 0.8.0rc0 Signed-off-by: Wang, Yi <yi.a.wang@intel.com>
1 parent 9c4e201 commit 37467de

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/diffusers/utils/remote_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def prepare_decode(
183183
headers["Accept"] = "image/png"
184184
elif output_type == "mp4":
185185
headers["Accept"] = "text/plain"
186-
tensor_data = safetensors.torch._tobytes(tensor, "tensor")
186+
tensor_data = safetensors.torch._to_ndarray(tensor)[0].tobytes()
187187
return {"data": tensor_data, "params": parameters, "headers": headers}
188188

189189

@@ -369,7 +369,7 @@ def prepare_encode(
369369
if shift_factor is not None:
370370
parameters["shift_factor"] = shift_factor
371371
if isinstance(image, torch.Tensor):
372-
data = safetensors.torch._tobytes(image.contiguous(), "tensor")
372+
data = safetensors.torch._to_ndarray(image.contiguous())[0].tobytes()
373373
parameters["shape"] = list(image.shape)
374374
parameters["dtype"] = str(image.dtype).split(".")[-1]
375375
else:

0 commit comments

Comments
 (0)