@@ -423,19 +423,19 @@ def load_hparams(dir_model: Path):
423
423
try :
424
424
# for security reason, we don't allow loading remote code by default
425
425
# 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 ()
427
427
except Exception as e :
428
428
logger .warning (f"Failed to load model config from { dir_model } : { e } " )
429
429
logger .warning ("Trying to load config.json instead" )
430
430
with open (dir_model / "config.json" , "r" , encoding = "utf-8" ) as f :
431
431
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
439
439
440
440
@classmethod
441
441
def register (cls , * names : str ) -> Callable [[AnyModel ], AnyModel ]:
@@ -1207,7 +1207,7 @@ def set_gguf_parameters(self):
1207
1207
self .gguf_writer .add_audio_block_count (self .find_aparam (self .n_block_keys ))
1208
1208
self .gguf_writer .add_audio_head_count (self .find_aparam (["num_attention_heads" ]))
1209
1209
1210
- else :
1210
+ if not self . has_vision_encoder and not self . has_audio_encoder :
1211
1211
raise ValueError ("MmprojModel must have either vision or audio encoder" )
1212
1212
1213
1213
def write_vocab (self ):
0 commit comments