| 809 | |
| 810 | |
| 811 | def load_unquantized(lazy_tensor: LazyTensor, expected_dtype: Any = None, convert: bool = False) -> NDArray: |
| 812 | tensor = lazy_tensor.load() |
| 813 | assert isinstance(tensor, UnquantizedTensor) |
| 814 | |
| 815 | # double-check: |
| 816 | actual_shape = list(tensor.ndarray.shape) |
| 817 | assert actual_shape == lazy_tensor.shape, (actual_shape, lazy_tensor.shape) |
| 818 | if expected_dtype is not None and expected_dtype != tensor.ndarray.dtype: |
| 819 | if convert: |
| 820 | tensor.ndarray = tensor.ndarray.astype(expected_dtype) |
| 821 | else: |
| 822 | raise ValueError(f'expected this tensor to have dtype {expected_dtype}, got {tensor.ndarray.dtype}') |
| 823 | |
| 824 | return tensor.ndarray |
| 825 | |
| 826 | |
| 827 | GGMLCompatibleTensor = UnquantizedTensor |