[misc] Compatible with an empty architectures field in config.json (#9709)

This commit is contained in:
Xunpeng Xiao
2026-01-04 12:11:35 +08:00
committed by GitHub
parent 355d5c5e5a
commit 0087bc253b

View File

@@ -138,13 +138,15 @@ def patch_config(
if getattr(config, "model_type", None) == "kimi_vl" and is_trainable:
setattr(config.text_config, "topk_method", "greedy")
if "InternVLChatModel" in getattr(config, "architectures", []):
architectures = getattr(config, "architectures", None)
if isinstance(architectures, (list, tuple)) and "InternVLChatModel" in architectures:
raise ValueError(
"Please download the internvl models in a Hugging Facecompatible format "
"(for example, https://huggingface.co/OpenGVLab/InternVL3-8B-hf)."
)
if "LlavaLlamaForCausalLM" in getattr(config, "architectures", []):
if isinstance(architectures, (list, tuple)) and "LlavaLlamaForCausalLM" in architectures:
raise ValueError("Please download llava models with hf-compatible format: https://huggingface.co/llava-hf")
if getattr(config, "model_type", None) == "internlm3" and not is_transformers_version_greater_than("4.47.1"):