convert: prevent ndarray conversion in LazyChunkedTensor (#27869)
This commit is contained in:
@@ -467,10 +467,15 @@ class GGUFWriter:
|
||||
shard_bar.reset(total=(total if total > 0 else None))
|
||||
|
||||
# relying on the fact that Python dicts preserve insertion order (since 3.7)
|
||||
for ti in tensors.values():
|
||||
for name, ti in tensors.items():
|
||||
assert ti.tensor is not None # can only iterate once over the tensors
|
||||
assert ti.tensor.nbytes == ti.nbytes
|
||||
start = fout.tell()
|
||||
ti.tensor.tofile(fout)
|
||||
# a short write here would only surface as a corrupt file at load time
|
||||
if fout.tell() - start != ti.nbytes:
|
||||
raise ValueError(
|
||||
f"tensor {name!r} wrote {fout.tell() - start} bytes, expected {ti.nbytes}")
|
||||
if shard_bar is not None:
|
||||
shard_bar.update(ti.nbytes)
|
||||
if bar is not None:
|
||||
|
||||
Reference in New Issue
Block a user