hiyouga/LlamaFactory · error · ValueError
kernel_config.include_kernels must select at least one FLA k
Error message
kernel_config.include_kernels must select at least one FLA kernel.
What it means
After parsing `include_kernels`, the FLA plugin verifies that at least one kernel name was actually selected. A string that contains only commas, whitespace, or is empty produces an empty selection list, and the plugin raises a ValueError rather than silently patching nothing.
Source
Thrown at src/llamafactory/v1/plugins/model_plugins/kernels/ops/linear_attention/fla.py:75
except ImportError as exc:
raise RuntimeError("Flash Linear Attention and FSDPTurbo are required for this kernel.") from exc
@staticmethod
def _apply(**kwargs) -> HFModel:
model = kwargs["model"]
config = kwargs.get("config") or {}
include_kernels = config.get("include_kernels", "auto")
chunk_size = config.get("chunk_size", 64)
if include_kernels == "auto" or include_kernels is True:
selected = list(FLASH_LINEAR_ATTENTION_KERNELS)
elif isinstance(include_kernels, str):
selected = [name.strip() for name in include_kernels.split(",") if name.strip()]
else:
raise TypeError("kernel_config.include_kernels must be 'auto' or a comma-separated string.")
if not selected:
raise ValueError("kernel_config.include_kernels must select at least one FLA kernel.")
unsupported = set(selected).difference(FLASH_LINEAR_ATTENTION_KERNELS)
if unsupported:
raise ValueError(f"Unsupported Flash Linear Attention kernels: {sorted(unsupported)}")
if isinstance(chunk_size, bool) or not isinstance(chunk_size, int) or chunk_size not in SUPPORTED_CHUNK_SIZES:
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}"View on GitHub (pinned to f28afaf635)
Solutions
- Remove the include_kernels key entirely so the default "auto" applies
- Or set it to at least one valid FLA kernel name
- Audit templated/interpolated configs for blank values reaching kernel_config
Example fix
# before kernel_config: include_kernels: "" # after kernel_config: include_kernels: "auto"
Defensive patterns
Strategy: validation
Validate before calling
names = [n.strip() for n in include_kernels.split(",") if n.strip()]
assert names, "include_kernels selected nothing; use 'auto' or real kernel names" Prevention
- Omit include_kernels to get the 'auto' default
- Lint configs for blank string values before runs
When it happens
Trigger: Passing include_kernels as "" (empty string), " ", or ",, ," — strings that split into zero non-empty names. The strip/filter step removes every token, leaving `selected == []`.
Common situations: Empty YAML value that parses to an empty string instead of the default 'auto' (e.g. `include_kernels:` with no value in some loaders), templated configs where a variable interpolates to blank, or hand-edited configs where names were deleted but the key remained.
Related errors
- Unsupported Flash Linear Attention kernels: {sorted(unsuppor
- chunk_size must be one of {SUPPORTED_CHUNK_SIZES}, got {chun
- Unknown backend: {model_args.infer_backend}
- Plugin configuration must have a 'name' field.
- kernel_config.include_kernels must be 'auto' or a comma-sepa
AI-assisted analysis of hiyouga/LlamaFactory@f28afaf635 (2026-08-14).
Data as JSON: /api/errors/1f9641852d2506fc.
Report an issue: GitHub.