Repository navigation
Block compile: import large_head_attention by its written-out name (Source lint red on main) - #17838
Merged
Merged
Conversation
#17817 loaded the band-attention kernel module through importlib.import_module(_LH_MODULE). The risky-loader lint flags a dynamic import whose name is not written at the call site, so Source lint has been red on main since it merged. The module name is a constant, so a plain from-import is equivalent and keeps the lazy, exception-guarded load inside _band_kernel_check.
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
Source linthas been red onmainsince #17817 merged (also seen on the staging run of #17835):_band_kernel_checkloads the band-attention kernel module throughimportlib.import_module(_LH_MODULE). The risky-loader lint flags a dynamic import whose module name is not written at the call site. Here the name is the constant"unsloth.kernels.large_head_attention", so nothing is actually dynamic.Change
from unsloth.kernels import large_head_attention as lhreplaces theimportlibcall. It stays in the same place, so the module is still loaded lazily, only for a layer whose sliding-window head dim qualifies, and still inside thetry/exceptthat falls back to the stock attention path. No baseline entry is needed.sys.modules[_LH_MODULE]lookups elsewhere are unchanged.Verification
On a clean export of the tree:
scripts/lint_risky_loaders.py_block_compile.py:1364)tests/test_block_compile.py tests/test_large_head_attention.py tests/security/test_lint_risky_loaders.py: 120 passed, 68 skipped (CUDA-only cases).