Skip to content

Commit df95a3a

Browse files
committed
correct metadata.name
1 parent 3a3682d commit df95a3a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

convert_hf_to_gguf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class Model:
6565
model_name: str | None
6666
metadata_override: Path | None
6767
dir_model_card: Path
68+
remote_hf_model_id: str | None
6869

6970
# subclasses should define this!
7071
model_arch: gguf.MODEL_ARCH
@@ -84,6 +85,7 @@ def __init__(self, dir_model: Path, ftype: gguf.LlamaFileType, fname_out: Path,
8485
self.endianess = gguf.GGUFEndian.BIG if is_big_endian else gguf.GGUFEndian.LITTLE
8586
self.use_temp_file = use_temp_file
8687
self.lazy = not eager or (remote_hf_model_id is not None)
88+
self.remote_hf_model_id = remote_hf_model_id
8789
if remote_hf_model_id is not None:
8890
self.is_safetensors = True
8991

@@ -405,6 +407,10 @@ def prepare_metadata(self, vocab_only: bool):
405407

406408
self.metadata = gguf.Metadata.load(self.metadata_override, self.dir_model_card, self.model_name, total_params)
407409

410+
# If we are using HF model id, set the metadata name to the model id
411+
if self.remote_hf_model_id:
412+
self.metadata.name = self.remote_hf_model_id
413+
408414
# Fallback to model directory name if metadata name is still missing
409415
if self.metadata.name is None:
410416
self.metadata.name = self.dir_model.name

0 commit comments

Comments
 (0)