Repository navigation
Conversation
The KDA layers (tensorrt_llm/_torch/modules/kimi_kda) import flash-linear-attention's ShortConvolution when they load and run its chunked KDA for prefill batches below four 64-token chunks, but flash-linear-attention is listed only in requirements-dev.txt. CI installs that file, so every test passes, while a plain pip install of the wheel, and the release container, which installs the wheel with its runtime requirements only, cannot load either model: No module named 'fla'. Require fla-core, the distribution that provides fla.modules and fla.ops, at the version requirements-dev.txt already installs through flash-linear-attention 0.5.2. Its only base dependency, einops, is a runtime requirement already. A CPU test checks that every package the KDA layers import when they load is a runtime requirement. Signed-off-by: Vasanth Sabavat <[email protected]>
jiaganc
reviewed
Oct 7, 2026
| peft>=0.18.1,<0.19.0 | ||
| patchelf | ||
| einops | ||
| fla-core==0.5.2 # the Kimi Linear / Kimi K3 KDA layers import fla.modules and fla.ops when they load |
Collaborator
There was a problem hiding this comment.
I suggest to move the whole flash-linear-attention==0.5.2 to here and remove it from requirements-dev.txt.
Collaborator
Author
There was a problem hiding this comment.
Thanks. I'd keep fla-core here rather than the full flash-linear-attention:
- The runtime needs only fla-core. Outside the tests,
flais imported only asfla.modules(kimi_kda_mixer.py)
andfla.ops(fla.ops.kda,fla.ops.utils.index), and both are in fla-core. flash-linear-attention adds only
fla.layersandfla.models, which nothing in the repo imports, tests included. - The full package changes what
import fladoes. fla-core'sfla/__init__.pyimportsfla.layersand
fla.modelswhenever they are installed.fla.modelsthen registers 35 model types with
AutoConfig/AutoModel/AutoModelForCausalLM, withexist_ok=True.- Checked in the 1.3.0rc28 image with transformers 5.5.4: with the full package installed,
from fla.modules import ShortConvolutionreplaces transformers' ownmambaandmamba2configs.
AutoConfigthen returnsfla.models.mamba2.configuration_mamba2.Mamba2Configformamba2. - With fla-core alone, nothing is registered.
- That would happen in every process that loads the KDA layers.
- Checked in the 1.3.0rc28 image with transformers 5.5.4: with the full package installed,
- Otherwise the two are equivalent. flash-linear-attention 0.5.2's only extra base requirement is
transformers>=4.45.0, which is already pinned, and both are MIT.
If you'd like one pin in one place, I can drop flash-linear-attention from requirements-dev.txt in this PR instead.
The tests also import only fla.modules / fla.ops, so CI would then install exactly what the runtime does.
1 task done
Collaborator
Author
|
Superseded by the consolidated draft PR: #19988. Source commits and follow-ups are retained; prior reviews remain historical evidence, not approval of the replacement heads. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What goes wrong. The Kimi Delta Attention layers of Kimi Linear and Kimi K3
(
tensorrt_llm/_torch/modules/kimi_kda/) need flash-linear-attention at runtime:kimi_kda_mixer.pyimportsfla.modules.ShortConvolutionwhen it loads (and builds its short convolutions withit);
fla.ops.kda.chunk_kda, and the decode / verify fallbacksfla.ops.kda.fused_recurrent_kda.flash-linear-attention is listed only in
requirements-dev.txt. CI installs that file in every test stage, so alltests pass. A plain
pip installof the wheel does not, and neither does the release container, which installs thewheel with its runtime requirements. There, loading either model fails with
ModuleNotFoundError: No module named 'fla'. Checked in the 1.3.0rc28 release container: it shipskimi_kda_mixer.pywith that import at line 26 and noflapackage.Fix. Require
fla-core==0.5.2:fla.modulesandfla.ops;requirements-dev.txtalready installs throughflash-linear-attention==0.5.2, so CI'senvironments do not change;
einops, is a runtime requirement already;fla_core-0.5.2-py3-none-any.whl). Its Triton kernels use thetritonandtorchthis package already requires.Test Coverage
tests/unittest/others/test_kimi_kda_runtime_dependencies.py(CPU;l0_cpu.ymlcollectsunittest/others):distributions that provide it, and requires one of them in
requirements.txt;flato be mappable, so it cannot pass vacuously.Results, in the trtllm container with main's own build:
requirements.txtthe test fails:kimi_kda_mixer.py imports fla, provided by fla-core, flash-linear-attention;PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title. (No API change.)Any new dependencies have been scanned for license and vulnerabilities (New runtime dependency
fla-core==0.5.2, MIT; already installed in CI throughrequirements-dev.txt. The license / vulnerability scan is for the maintainers' tooling.)CODEOWNERS updated if ownership changes (No ownership change.)
Documentation updated as needed (No documentation change;
ATTRIBUTIONS-Python.mdis generated.)Update tava architecture diagram if there is a significant design change in PR. (No design change.)
The reviewers assigned automatically/manually are appropriate for the PR. (To check once the PR is open.)
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.