tidy up
This commit is contained in:
parent
69d6e7a8e9
commit
0779f2f74f
2 changed files with 9 additions and 7 deletions
|
@ -2891,13 +2891,14 @@ def main() -> None:
|
|||
model_instance.gguf_writer.add_quantization_version(gguf.GGML_QUANT_VERSION)
|
||||
|
||||
if args.vocab_only:
|
||||
logger.info(f"Exporting model vocab to '{model_instance.fname_out}'")
|
||||
logger.info(f"Exporting model vocab...")
|
||||
model_instance.write_vocab()
|
||||
logger.info(f"Model vocab successfully exported.")
|
||||
else:
|
||||
logger.info(f"Exporting model to '{model_instance.fname_out}'")
|
||||
logger.info(f"Exporting model...")
|
||||
model_instance.write()
|
||||
logger.info(f"Model successfully exported.")
|
||||
|
||||
logger.info(f"Model successfully exported to '{model_instance.fname_out}'")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -95,7 +95,7 @@ class GGUFWriter:
|
|||
fout: list[BufferedWriter | None] | None
|
||||
path: os.PathLike[str] | str | None
|
||||
temp_file: tempfile.SpooledTemporaryFile[bytes] | None
|
||||
tensors: list[dict[str, TensorInfo]]
|
||||
tensors: list[dict[str, TensorInfo | np.ndarray[Any, Any]]]
|
||||
kv_data: list[dict[str, GGUFValue]]
|
||||
state: WriterState
|
||||
_simple_value_packing = {
|
||||
|
@ -182,7 +182,7 @@ class GGUFWriter:
|
|||
def print_plan(self) -> None:
|
||||
logger.info("Writing the following files:")
|
||||
for i in range(len(self.fout)):
|
||||
logger.info(f" {self.fout[i].name}: n_tensors = {len(self.tensors[i])}, total_size = {GGUFWriter.format_n_bytes_to_str(GGUFWriter.get_tensors_total_size(self.tensors[i].values()))}")
|
||||
logger.info(f"{self.fout[i].name}: n_tensors = {len(self.tensors[i])}, total_size = {GGUFWriter.format_n_bytes_to_str(GGUFWriter.get_tensors_total_size(self.tensors[i].values()))}")
|
||||
|
||||
if self.split_arguments.dry_run:
|
||||
logger.info("Dry run, not writing files")
|
||||
|
@ -327,8 +327,9 @@ class GGUFWriter:
|
|||
if self.state is not WriterState.NO_FILE:
|
||||
raise ValueError(f'Expected output file to be not yet opened, got {self.state}')
|
||||
|
||||
if name in self.tensors:
|
||||
raise ValueError(f'Duplicated tensor name {name!r}')
|
||||
for i in range(len(self.tensors)):
|
||||
if name in self.tensors[i]:
|
||||
raise ValueError(f'Duplicated tensor name {name!r}')
|
||||
|
||||
if raw_dtype is None:
|
||||
if tensor_dtype == np.float16:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue