hiyouga/LlamaFactory · error · RuntimeError
FLA operator `{op_name}` did not match any model module attr
Error message
FLA operator `{op_name}` did not match any model module attributes. What it means
For each selected FLA kernel, the plugin scans the model's modules for a callable attribute matching FLA_MODULE_ATTRIBUTES[op_name] and patches them via patch_model_members. If zero modules match, the patch would be a no-op, so it raises RuntimeError naming the operator that found no targets.
Source
Thrown at src/llamafactory/v1/plugins/model_plugins/kernels/ops/linear_attention/fla.py:99
raise ValueError(f"chunk_size must be one of {SUPPORTED_CHUNK_SIZES}, got {chunk_size!r}.")
from fsdp_turbo.ops.registry import get_op
from fsdp_turbo.utils.patch import patch_model_members
patched = 0
named_modules = tuple(model.named_modules())
for op_name in selected:
module_attribute = FLA_MODULE_ATTRIBUTES[op_name]
op = get_op(op_name)
configured_op = partial(op, chunk_size=chunk_size) if op_name == CHUNK_GATED_DELTA_RULE else op
targets = {
f"{type(module).__module__}.{type(module).__name__}.{module_attribute}"
for _, module in named_modules
if callable(getattr(module, module_attribute, None))
}
matched = patch_model_members(model, sorted(targets), configured_op) if targets else 0
if matched == 0:
raise RuntimeError(f"FLA operator `{op_name}` did not match any model module attributes.")
patched += matched
logger.info_rank0(f"Flash Linear Attention kernels updated {patched} module callables: {selected}.")
return model
View on GitHub (pinned to f28afaf635)
Solutions
- Confirm the model actually uses Flash Linear Attention layers before enabling the fla plugin
- Use include_kernels: "auto" only on FLA-based models; remove the plugin for standard attention models
- Check FLA_MODULE_ATTRIBUTES against type(module).__module__/__name__ of your model's layers; align transformers/fsdp_turbo versions with what the mapping expects
- If a specific op never matches your architecture, exclude it from include_kernels
Example fix
# before (Llama model, no FLA layers) kernels: [fla] kernel_config: include_kernels: "auto" # after kernels: [] # fla only for FLA-architecture models
Defensive patterns
Strategy: validation
Validate before calling
has_fla = any(
callable(getattr(m, attr, None))
for _, m in model.named_modules()
for attr in FLA_MODULE_ATTRIBUTES.values()
)
if not has_fla:
raise ValueError("model has no FLA layers; remove the fla kernel plugin") Try / catch
try:
apply_fla_kernel(model, config=kernel_config)
except RuntimeError as e:
if "did not match any model module attributes" in str(e):
logger.warning("skipping fla plugin for %s", type(model).__name__)
else:
raise Prevention
- Only enable fla kernels for linear-attention architectures
- Smoke-test kernel application on one batch before long runs
When it happens
Trigger: Running the FLA kernel plugin on a model that does not use Flash Linear Attention layers (e.g. a standard transformer with softmax attention), or a linear-attention model whose class/attribute layout differs from what FLA_MODULE_ATTRIBUTES expects (transformers version mismatch).
Common situations: Enabling fla kernels in kernel_config for a non-FLA model (Llama, Qwen, etc.); upgrading transformers so FLA layer class names or module paths changed; selecting an op whose attribute only exists on some FLA architectures.
Related errors
- Unsupported Flash Linear Attention kernels: {sorted(unsuppor
- Unexpected missing keys when loading checkpoint model weight
- kernel_config.include_kernels must be 'auto' or a comma-sepa
- kernel_config.include_kernels must select at least one FLA k
- chunk_size must be one of {SUPPORTED_CHUNK_SIZES}, got {chun
AI-assisted analysis of hiyouga/LlamaFactory@f28afaf635 (2026-08-14).
Data as JSON: /api/errors/0eb15cd7f20ca68d.
Report an issue: GitHub.