move add_type to __init__

This commit is contained in:
ngxson 2024-07-15 17:22:38 +02:00
parent 0ba23bad6f
commit b1c4069502
2 changed files with 3 additions and 1 deletions

View file

@ -99,6 +99,7 @@ class Model:
self.fname_out = fname_out.parent / fname_out.name.format(ftype_lw, outtype=ftype_lw, ftype=ftype_lw, OUTTYPE=ftype_up, FTYPE=ftype_up)
self.gguf_writer = gguf.GGUFWriter(path=None, arch=gguf.MODEL_ARCH_NAMES[self.model_arch], endianess=self.endianess, use_temp_file=self.use_temp_file,
split_max_tensors=split_max_tensors, split_max_size=split_max_size, dry_run=dry_run, small_first_shard=small_first_shard)
self.gguf_writer.add_type(gguf.GGUFType.MODEL)
@classmethod
def __init_subclass__(cls):
@ -186,7 +187,6 @@ class Model:
return new_name
def set_gguf_parameters(self):
self.gguf_writer.add_type(gguf.GGUFType.MODEL)
self.gguf_writer.add_name(self.dir_model.name if self.model_name is None else self.model_name)
self.gguf_writer.add_block_count(self.block_count)

View file

@ -129,10 +129,12 @@ class Keys:
# recommended mapping of model tensor names for storage in gguf
#
class GGUFType:
MODEL = "model"
ADAPTER = "adapter"
class MODEL_ARCH(IntEnum):
LLAMA = auto()
FALCON = auto()