gguf : free tensors as they are written
This commit is contained in:
parent
d97afcfc02
commit
389d2e6b9e
1 changed files with 5 additions and 1 deletions
|
@ -863,7 +863,11 @@ class GGUFWriter:
|
||||||
self.write_padding(self.fout, self.fout.tell())
|
self.write_padding(self.fout, self.fout.tell())
|
||||||
|
|
||||||
if self.temp_file is None:
|
if self.temp_file is None:
|
||||||
for tensor in self.tensors:
|
while True:
|
||||||
|
try:
|
||||||
|
tensor = self.tensors.pop(0)
|
||||||
|
except IndexError:
|
||||||
|
break
|
||||||
tensor.tofile(self.fout)
|
tensor.tofile(self.fout)
|
||||||
self.write_padding(self.fout, tensor.nbytes)
|
self.write_padding(self.fout, tensor.nbytes)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue