convert: prevent ndarray conversion in LazyChunkedTensor (#27869)

This commit is contained in:
Xuan-Son Nguyen
2026-08-28 11:46:30 +02:00
committed by GitHub
parent d077b4c214
commit b19cbe925b
2 changed files with 10 additions and 1 deletions
+4
View File
@@ -251,6 +251,10 @@ class LazyChunkedTensor:
def numpy(self) -> LazyChunkedTensor:
return self
def __array__(self, *args, **kwargs):
# numpy would otherwise make a 1-element object array of self, and write 8 bytes
raise TypeError("LazyChunkedTensor cannot become an ndarray, it is written in chunks")
def quantize(self, qtype: Any) -> LazyChunkedTensor:
from .constants import GGMLQuantizationType
from .quants import QuantError, quant_shape_to_byte_shape