hiyouga/LlamaFactory · error · ImportError
Qwen3.5 packing-seq forwarding requires `flash-linear-attent
Error message
Qwen3.5 packing-seq forwarding requires `flash-linear-attention>=0.4.1` (provides `fla.modules.convolution.causal_conv1d` and `fla.ops.gated_delta_rule.{chunk,fused_recurrent}_gated_delta_rule`). Please install/upgrade it. What it means
Error "Qwen3.5 packing-seq forwarding requires `flash-linear-attention>=0.4.1` (provides `fla.modules.convolution.causal_conv1d` and `fla.ops.gated_delta_rule.{chunk,fused_recurrent}_gated_delta_rule`). Please install/upgrade it." thrown in hiyouga/LlamaFactory.
Source
Thrown at src/llamafactory/model/patcher.py:80
def _check_fla_dependencies() -> None:
"""Check that the FLA dependencies required for varlen GDN forwarding are available.
Requires ``flash-linear-attention >= 0.4.1`` (which exposes the varlen
``causal_conv1d`` under ``fla.modules.convolution`` and the
``chunk_gated_delta_rule`` / ``fused_recurrent_gated_delta_rule`` kernels
under ``fla.ops.gated_delta_rule``). Raises ``ImportError`` with an
actionable message otherwise.
"""
try:
from fla.modules.convolution import causal_conv1d # noqa: F401
from fla.ops.gated_delta_rule import ( # noqa: F401
chunk_gated_delta_rule,
fused_recurrent_gated_delta_rule,
)
except ImportError as exc:
raise ImportError(
"Qwen3.5 packing-seq forwarding requires `flash-linear-attention>=0.4.1` "
"(provides `fla.modules.convolution.causal_conv1d` and "
"`fla.ops.gated_delta_rule.{chunk,fused_recurrent}_gated_delta_rule`). "
"Please install/upgrade it."
) from exc
def patch_qwen3_5_forward_npu(model: "PreTrainedModel") -> None:
"""Patch for Qwen3.5 models on NPU by importing torch_npu to enable torch.cuda compatibility.
On NPU, torch.cuda operations will fail unless torch_npu is imported.
torch_npu provides compatibility layer that maps torch.cuda calls to NPU operations.
Also replaces chunk_gated_delta_rule with NPU-compatible implementation.
"""
import importlib.metadata
if "Ascend910" not in torch.npu.get_device_name(0):View on GitHub (pinned to f28afaf635)
Solutions
- Install or upgrade the flash-linear-attention package: pip install 'flash-linear-attention>=0.4.1'.
- If installation fails, disable Qwen3.5 packing-seq forwarding (do not enable packed/packing training for Qwen3.5) so the fla imports are not required.
Example fix
pip install 'flash-linear-attention>=0.4.1'
When it happens
Trigger: Thrown at src/llamafactory/model/patcher.py:80 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hiyouga/LlamaFactory@f28afaf635 (2026-08-14).
Data as JSON: /api/errors/e60468cabe68f6b8.
Report an issue: GitHub.