fix gguf_writer placement and remove comments

This commit is contained in:
Christian Zhou-Zheng 2024-06-03 19:34:01 -04:00
parent a9c7703c12
commit efead0408c
2 changed files with 2 additions and 12 deletions

View file

@ -56,11 +56,11 @@ class Model:
part_names: list[str] part_names: list[str]
is_safetensors: bool is_safetensors: bool
hparams: dict[str, Any] hparams: dict[str, Any]
gguf_writer: gguf.GGUFManager
block_count: int block_count: int
tensor_map: gguf.TensorNameMap tensor_map: gguf.TensorNameMap
tensor_names: set[str] | None tensor_names: set[str] | None
fname_out: Path fname_out: Path
gguf_writer: gguf.GGUFManager
# subclasses should define this! # subclasses should define this!
model_arch: gguf.MODEL_ARCH model_arch: gguf.MODEL_ARCH

View file

@ -305,20 +305,10 @@ class GGUFManager:
tensor.byteswap(inplace=True) tensor.byteswap(inplace=True)
# TODO reimplement temp file # TODO reimplement temp file
#if self.use_temp_file and self.temp_file is None: # I'm pretty sure it gets handled per shard?
# fp = tempfile.SpooledTemporaryFile(mode="w+b", max_size=256 * 1024 * 1024)
# fp.seek(0)
# self.temp_file = fp
self.tensors.append((name, tensor, raw_dtype)) self.tensors.append((name, tensor, raw_dtype))
#if self.temp_file is None:
# self.tensors.append(tensor)
# return
#tensor.tofile(self.temp_file)
#self.write_padding(self.temp_file, tensor.nbytes)
def close(self) -> None: def close(self) -> None:
for _, _, writer in self.split_strategy: for _, _, writer in self.split_strategy:
writer.close() writer.close()