diff --git a/vllm_ascend/utils.py b/vllm_ascend/utils.py index de0e5d12..a45834b6 100644 --- a/vllm_ascend/utils.py +++ b/vllm_ascend/utils.py @@ -1146,7 +1146,16 @@ def check_gdn_layer(vllm_config) -> bool: return False hf_config = model_config.hf_config - if not hasattr(hf_config, "layer_types"): - return False - return "linear_attention" in hf_config.layer_types + # Use `or []` to prevent errors when layer_types is None + layer_types = getattr(hf_config, "layer_types", None) or [] + if "linear_attention" in layer_types: + return True + + text_config = getattr(hf_config, "text_config", None) + if text_config: + text_layer_types = getattr(text_config, "layer_types", None) or [] + if "linear_attention" in text_layer_types: + return True + + return False