{"record":{"id":"0eb15cd7f20ca68d","repo":"hiyouga/LlamaFactory","slug":"fla-operator-op-name-did-not-match-any-model-m","errorCode":null,"errorMessage":"FLA operator `{op_name}` did not match any model module attributes.","messagePattern":"FLA operator `(.+?)` did not match any model module attributes\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/v1/plugins/model_plugins/kernels/ops/linear_attention/fla.py","lineNumber":99,"sourceCode":"            raise ValueError(f\"chunk_size must be one of {SUPPORTED_CHUNK_SIZES}, got {chunk_size!r}.\")\n\n        from fsdp_turbo.ops.registry import get_op\n        from fsdp_turbo.utils.patch import patch_model_members\n\n        patched = 0\n        named_modules = tuple(model.named_modules())\n        for op_name in selected:\n            module_attribute = FLA_MODULE_ATTRIBUTES[op_name]\n            op = get_op(op_name)\n            configured_op = partial(op, chunk_size=chunk_size) if op_name == CHUNK_GATED_DELTA_RULE else op\n            targets = {\n                f\"{type(module).__module__}.{type(module).__name__}.{module_attribute}\"\n                for _, module in named_modules\n                if callable(getattr(module, module_attribute, None))\n            }\n            matched = patch_model_members(model, sorted(targets), configured_op) if targets else 0\n            if matched == 0:\n                raise RuntimeError(f\"FLA operator `{op_name}` did not match any model module attributes.\")\n            patched += matched\n\n        logger.info_rank0(f\"Flash Linear Attention kernels updated {patched} module callables: {selected}.\")\n        return model\n","sourceCodeStart":81,"sourceCodeEnd":104,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/v1/plugins/model_plugins/kernels/ops/linear_attention/fla.py#L81-L104","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before (Llama model, no FLA layers)\nkernels: [fla]\nkernel_config:\n  include_kernels: \"auto\"\n\n# after\nkernels: []  # fla only for FLA-architecture models","handlingStrategy":"validation","validationCode":"has_fla = any(\n    callable(getattr(m, attr, None))\n    for _, m in model.named_modules()\n    for attr in FLA_MODULE_ATTRIBUTES.values()\n)\nif not has_fla:\n    raise ValueError(\"model has no FLA layers; remove the fla kernel plugin\")","typeGuard":null,"tryCatchPattern":"try:\n    apply_fla_kernel(model, config=kernel_config)\nexcept RuntimeError as e:\n    if \"did not match any model module attributes\" in str(e):\n        logger.warning(\"skipping fla plugin for %s\", type(model).__name__)\n    else:\n        raise","preventionTips":["Only enable fla kernels for linear-attention architectures","Smoke-test kernel application on one batch before long runs"],"tags":["runtime","model-mismatch","kernel-plugin","version-skew"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}