Update gguf-py/gguf/gguf_writer.py

Co-authored-by: compilade <git@compilade.net>
This commit is contained in:
Christian Zhou-Zheng 2024-06-10 14:55:14 -04:00 committed by GitHub
parent 05b183fe7b
commit e9895d2ce9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -358,8 +358,6 @@ class GGUFWriter:
# TODO: cleaner way to get the first key # TODO: cleaner way to get the first key
first_tensor_name = [name for name, _ in zip(self.tensors[file_id].keys(), range(1))][0] first_tensor_name = [name for name, _ in zip(self.tensors[file_id].keys(), range(1))][0]
ti = self.tensors[file_id].pop(first_tensor_name) ti = self.tensors[file_id].pop(first_tensor_name)
assert len(ti.shape) == len(tensor.shape)
assert all(dim1 == dim2 for dim1, dim2 in zip(ti.shape, tensor.shape))
assert ti.nbytes == tensor.nbytes assert ti.nbytes == tensor.nbytes
self.write_padding(fout, fout.tell()) self.write_padding(fout, fout.tell())