| 481 | |
| 482 | |
| 483 | def load_unquantized(lazy_tensor: LazyTensor, expected_dtype: Any = None, convert: bool = False) -> NDArray: |
| 484 | tensor = lazy_tensor.load() |
| 485 | assert isinstance(tensor, UnquantizedTensor) |
| 486 | |
| 487 | # double-check: |
| 488 | actual_shape = list(tensor.ndarray.shape) |
| 489 | assert actual_shape == lazy_tensor.shape, (actual_shape, lazy_tensor.shape) |
| 490 | if expected_dtype is not None and expected_dtype != tensor.ndarray.dtype: |
| 491 | if convert: |
| 492 | tensor.ndarray = tensor.ndarray.astype(expected_dtype) |
| 493 | else: |
| 494 | raise ValueError(f'expected this tensor to have dtype {expected_dtype}, got {tensor.ndarray.dtype}') |
| 495 | |
| 496 | return tensor.ndarray |
| 497 | |
| 498 | |
| 499 | GGMLCompatibleTensor = UnquantizedTensor |