| 623 | |
| 624 | |
| 625 | def load_unquantized(lazy_tensor: LazyTensor, expected_dtype: Any = None, convert: bool = False) -> NDArray: |
| 626 | tensor = lazy_tensor.load() |
| 627 | assert isinstance(tensor, UnquantizedTensor) |
| 628 | |
| 629 | # double-check: |
| 630 | actual_shape = list(tensor.ndarray.shape) |
| 631 | assert actual_shape == lazy_tensor.shape, (actual_shape, lazy_tensor.shape) |
| 632 | if expected_dtype is not None and expected_dtype != tensor.ndarray.dtype: |
| 633 | if convert: |
| 634 | tensor.ndarray = tensor.ndarray.astype(expected_dtype) |
| 635 | else: |
| 636 | raise ValueError(f'expected this tensor to have dtype {expected_dtype}, got {tensor.ndarray.dtype}') |
| 637 | |
| 638 | return tensor.ndarray |
| 639 | |
| 640 | |
| 641 | GGMLCompatibleTensor = UnquantizedTensor |