gguf-py : cleaner way to get the first key (#20727)

This commit is contained in:
Sigbjørn Skjæret 2026-03-18 23:21:42 +01:00 committed by GitHub
parent 5744d7ec43
commit d13d60af1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -425,8 +425,7 @@ class GGUFWriter:
fout = self.fout[file_id]
# pop the first tensor info
# 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 = next(iter(self.tensors[file_id]))
ti = self.tensors[file_id].pop(first_tensor_name)
assert ti.nbytes == tensor.nbytes