Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions convert_hf_to_gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,17 @@ def get_audio_config(self) -> dict[str, Any] | None:
def set_type(self):
self.gguf_writer.add_type(gguf.GGUFType.MMPROJ)

def prepare_metadata(self, vocab_only: bool):
super().prepare_metadata(vocab_only=vocab_only)

output_type: str = self.ftype.name.partition("_")[2]

if self.fname_out.is_dir():
fname_default: str = gguf.naming_convention(self.metadata.name, self.metadata.basename, self.metadata.finetune, self.metadata.version, size_label=None, output_type=output_type, model_type=None)
self.fname_out = self.fname_out / f"mmproj-{fname_default}.gguf"
else:
self.fname_out = self.fname_out.parent / gguf.fill_templated_filename(self.fname_out.name, output_type)

def set_gguf_parameters(self):
self.gguf_writer.add_file_type(self.ftype)

Expand Down Expand Up @@ -9722,10 +9733,6 @@ def main() -> None:

logger.info(f"Loading model: {dir_model.name}")

if args.mmproj:
if "mmproj" not in fname_out.name:
fname_out = ModelBase.add_prefix_to_filename(fname_out, "mmproj-")

is_mistral_format = args.mistral_format
if is_mistral_format and not _mistral_common_installed:
raise ImportError(_mistral_import_error_msg)
Expand Down