From 8d313a677a4551414989010fc0a4d916650c8c55 Mon Sep 17 00:00:00 2001 From: City <125218114+city96@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:17:49 +0100 Subject: [PATCH] Unused/old logic --- tools/convert.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tools/convert.py b/tools/convert.py index aa6c961..3015abf 100644 --- a/tools/convert.py +++ b/tools/convert.py @@ -140,7 +140,7 @@ def load_model(path): writer = gguf.GGUFWriter(path=None, arch=model_arch.arch) return (writer, state_dict, model_arch) -def handle_tensors(args, writer, state_dict, model_arch): +def handle_tensors(writer, state_dict, model_arch): name_lengths = tuple(sorted( ((key, len(key)) for key in state_dict.keys()), key=lambda item: item[1], @@ -175,18 +175,6 @@ def handle_tensors(args, writer, state_dict, model_arch): for dim_size in data_shape: n_params *= dim_size - # keys to keep as max precision - blacklist = { - "time_embedding.", - "add_embedding.", - "time_in.", - "txt_in.", - "vector_in.", - "img_in.", - "guidance_in.", - "final_layer.", - } - if old_dtype in (torch.float32, torch.bfloat16): if n_dims == 1: # one-dimensional tensors should be kept in F32 @@ -197,9 +185,6 @@ def handle_tensors(args, writer, state_dict, model_arch): # very small tensors data_qtype = gguf.GGMLQuantizationType.F32 - elif ".weight" in key and any(x in key for x in blacklist): - data_qtype = gguf.GGMLQuantizationType.F32 - if (model_arch.shape_fix # NEVER reshape for models such as flux and n_dims > 1 # Skip one-dimensional tensors and n_params >= REARRANGE_THRESHOLD # Only rearrange tensors meeting the size requirement @@ -241,7 +226,7 @@ if __name__ == "__main__": if os.path.isfile(out_path): input("Output exists enter to continue or ctrl+c to abort!") - handle_tensors(path, writer, state_dict, model_arch) + handle_tensors(writer, state_dict, model_arch) writer.write_header_to_file(path=out_path) writer.write_kv_data_to_file() writer.write_tensors_to_file(progress=True)