8000 convert : fix qwen omni conversion (#13859) · ggml-org/llama.cpp@a3938fb · GitHub
[go: up one dir, main page]

Skip to content

Commit a3938fb

Browse files
authored
convert : fix qwen omni conversion (#13859)
* convert : fix qwen omni conversion * fix typo
1 parent f7873fc commit a3938fb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

convert_hf_to_gguf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,19 +423,19 @@ def load_hparams(dir_model: Path):
423423
try:
424424
# for security reason, we don't allow loading remote code by default
425425
# if a model need remote code, we will fallback to config.json
426-
return AutoConfig.from_pretrained(dir_model, trust_remote_code=False).to_dict()
426+
config = AutoConfig.from_pretrained(dir_model, trust_remote_code=False).to_dict()
427427
except Exception as e:
428428
logger.warning(f"Failed to load model config from {dir_model}: {e}")
429429
logger.warning("Trying to load config.json instead")
430430
with open(dir_model / "config.json", "r", encoding="utf-8") as f:
431431
config = json.load(f)
432-
if "llm_config" in config:
433-
# rename for InternVL
434-
config["text_config"] = config["llm_config"]
435-
if "thinker_config" in config:
436-
# rename for Qwen2.5-Omni
437-
config["text_config"] = config["thinker_config"]["text_config"]
438-
return config
432+
if "llm_config" in config:
433+
# rename for InternVL
434+
config["text_config"] = config["llm_config"]
435+
if "thinker_config" in config:
436+
# rename for Qwen2.5-Omni
437+
config["text_config"] = config["thinker_config"]["text_config"]
438+
return config
439439

440440
@classmethod
441441
def register(cls, *names: str) -> Callable[[AnyModel], AnyModel]:
@@ -1207,7 +1207,7 @@ def set_gguf_parameters(self):
12071207
self.gguf_writer.add_audio_block_count(self.find_aparam(self.n_block_keys))
12081208
self.gguf_writer.add_audio_head_count(self.find_aparam(["num_attention_heads"]))
12091209

1210-
else:
1210+
if not self.has_vision_encoder and not self.has_audio_encoder:
12111211
raise ValueError("MmprojModel must have either vision or audio encoder")
12121212

12131213
def write_vocab(self):

0 commit comments

Comments
 (0)
0