| 502 | |
| 503 | |
| 504 | def load_unquantized(lazy_tensor: LazyTensor, expected_dtype: Any = None, convert: bool = False) -> NDArray: |
| 505 | tensor = lazy_tensor.load() |
| 506 | assert isinstance(tensor, UnquantizedTensor) |
| 507 | |
| 508 | # double-check: |
| 509 | actual_shape = list(tensor.ndarray.shape) |
| 510 | assert actual_shape == lazy_tensor.shape, (actual_shape, lazy_tensor.shape) |
| 511 | if expected_dtype is not None and expected_dtype != tensor.ndarray.dtype: |
| 512 | if convert: |
| 513 | tensor.ndarray = tensor.ndarray.astype(expected_dtype) |
| 514 | else: |
| 515 | raise ValueError(f'expected this tensor to have dtype {expected_dtype}, got {tensor.ndarray.dtype}') |
| 516 | |
| 517 | return tensor.ndarray |
| 518 | |
| 519 | |
| 520 | GGMLCompatibleTensor = UnquantizedTensor |