convert : fix no-lazy dtypes from direct safetensors

This commit is contained in:
Francis Couture-Harpin
2025-09-09 13:51:05 -04:00
parent 0edc189842
commit e582f1ac63

View File

@@ -209,7 +209,7 @@ class ModelBase:
data_gen = lambda data=data: LazyTorchTensor.from_local_tensor(data) # noqa: E731
else:
dtype = LazyTorchTensor._dtype_str_map[data.dtype]
data_gen = lambda data=data: torch.from_numpy(data.mmap_bytes()).view(dtype).reshape(data.shape) # noqa: E731
data_gen = lambda data=data, dtype=dtype: torch.from_numpy(data.mmap_bytes()).view(dtype).reshape(data.shape) # noqa: E731
else:
data_torch: Tensor = model_part[name]
if self.lazy: