Skip to content

Commit 6972404

Browse files
committed
Fix lazy on scalars
1 parent 90f052d commit 6972404

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

convert_hf_to_gguf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8964,7 +8964,7 @@ def meta_with_dtype_and_shape(cls, dtype: torch.dtype, shape: tuple[int, ...]) -
89648964
def from_safetensors_slice(cls, st_slice: Any) -> Tensor:
89658965
dtype = cls._dtype_str_map[st_slice.get_dtype()]
89668966
shape: tuple[int, ...] = tuple(st_slice.get_shape())
8967-
lazy = cls(meta=cls.meta_with_dtype_and_shape(dtype, shape), args=(st_slice,), func=lambda s: s[:])
8967+
lazy = cls(meta=cls.meta_with_dtype_and_shape(dtype, shape), args=(st_slice,), func=lambda s: s[...] if len(s.get_shape()) == 0 else s[:])
89688968
return cast(torch.Tensor, lazy)
89698969

89708970
@classmethod

0 commit comments

Comments
 (0)