From 0087bc253b3da1803809013a4cb8b8c49f66e026 Mon Sep 17 00:00:00 2001 From: Xunpeng Xiao <124695565+tangefly@users.noreply.github.com> Date: Sun, 4 Jan 2026 12:11:35 +0800 Subject: [PATCH] [misc] Compatible with an empty architectures field in config.json (#9709) --- src/llamafactory/model/patcher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/llamafactory/model/patcher.py b/src/llamafactory/model/patcher.py index 67eee886b..d89cd6091 100644 --- a/src/llamafactory/model/patcher.py +++ b/src/llamafactory/model/patcher.py @@ -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 Face–compatible 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"):