Repository navigation
Install kernels with unsloth install-kernels - #385
Conversation
Replace the hand-written wheel picks in the Colab install cells with the
unsloth CLI, which resolves the prebuilt wheel for the installed torch and
CUDA (or installs nothing and keeps the torch fallback):
- xformers: drop the torch probe, the version map, the CUDA 13 URL line
and {xformers}; run `!unsloth install-kernels xformers` after unsloth
is installed (default, Gemma 4, DiffusionGemma, QAT and the
hand-maintained notebooks).
- Qwen3.5 / Qwen3.6: replace the causal_conv1d URL template, which 404s
on Colab's torch 2.11, and the fla uninstall with
`!unsloth install-kernels causal_conv1d`. unsloth_zoo's vendored fla
already wins over an older pip install.
- Qwen3.8: drop the fla uninstall and the uv install it needed. The
Kaggle GRPO notebook's pinned causal_conv1d URL becomes the same line.
- AMD cells are unchanged: the composer maps the new line back to the fla
uninstall and the causal_conv1d source build.
- molab: strip the line before marimo conversion, so it no longer leaves
an empty `import subprocess` cell behind.
Needs an unsloth release that ships install-kernels (unslothai/unsloth#12732).
`unsloth install-kernels` with no names installs xformers, flash-attn, causal_conv1d and mamba_ssm, each skipped when no wheel matches the torch (unslothai/unsloth#12744), so every Colab cell now runs the bare form. - Granite 4.0 / Nemotron Nano: keep the resident torch instead of pinning torch 2.7.1 for mamba_ssm 2.2.5 wheels, and drop the --no-build-isolation install that took ~30 minutes on Blackwell. Wheels exist for every torch these cells see (2.7, 2.10 cp312, 2.11, 2.13). - Falcon H1, LFM2 and Granite 4.0 350M templates and the hand-maintained Falcon H1 / LFM2 notebooks: replace the pinned or git-main kernel builds with named install-kernels lines. - AMD notebooks are unchanged: ROCm has no wheels, so the composer maps each kernel line back to the line it read before, and install-kernels counts as install code when it collects install cells. - molab: the kernel install becomes its own runtime cell, so molab gets wheels for its torch (still pinned to 2.7.1 for the Mamba hybrids) instead of the old pins in the PEP 723 header.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsBlocking findings (1)
ℹ️ 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0580c2f40
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| !pip install --no-deps unsloth_zoo bitsandbytes accelerate peft trl triton unsloth | ||
| __KERNELS_INSTALL__ |
There was a problem hiding this comment.
Require the new CLI version before invoking it
When a Colab runtime already contains an older Unsloth release, the preceding pip install --no-deps ... unsloth treats that installation as satisfying the unversioned requirement and does not upgrade it. The argument-free form was only added in the Oct. 6 upstream change, so an older CLI either lacks this subcommand or still requires explicit kernel names; because the output is captured, the notebooks then continue without installing xformers after its explicit install was removed. Require unsloth>=2026.10.1 or force an upgrade before running the command.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this one. The unversioned install only keeps an older unsloth if one is already present, and neither target runtime ships it: the Colab image has no unsloth (the Colab runs for this PR all logged Successfully installed ... unsloth-2026.10.1), and Kaggle's kaggle_requirements.txt in Kaggle/docker-python has no unsloth either (Kaggle also takes the pip install unsloth branch, not this one). That leaves a user who hand-installed an older unsloth in the same session, and there a missing subcommand only means no xformers, which is optional: Unsloth falls back to torch SDPA. A version floor on every notebook's install line is not worth that.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: c0580c2f40
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
| ) | ||
| # Every prebuilt kernel (xformers, flash-attn, causal_conv1d, mamba_ssm) for the resident torch + | ||
| # CUDA, each skipped when no wheel matches. Runs the `unsloth` CLI, so it must follow the unsloth install. | ||
| KERNELS_INSTALL = "!unsloth install-kernels" |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Security: Install only required, integrity-pinned kernel wheels
If a compatible Colab/molab user runs a notebook while any newly added kernel release is compromised, this no-argument command installs all four kernels—not just the prior xformers—and the upstream installer imports each native extension during validation (implementation). The change emits it into 142 default notebook cells and 123 molab scripts, so compromise of flash-attn/causal_conv1d/mamba_ssm now yields runtime code execution with access to tokens and private data even where those kernels are not needed. Pass explicit required names and verify immutable hashes before loading wheels.
Useful? React with 👍 / 👎.
Replaces the hand-written kernel install lines in the Colab / Kaggle install cells with one line:
The command shipped in unsloth 2026.10.1 (unslothai/unsloth#12732, #12744, #12828). It installs the prebuilt xformers, flash-attn, causal_conv1d and mamba_ssm wheels that match the resident torch / CUDA / Python. It uses
--no-deps, so torch is never touched. Each kernel is skipped, with exit 0, when no wheel matches: flash-attn below sm80, and anything without a published wheel. It never builds from source.What it replaces
{xformers}in thepip install --no-depsline.--no-build-isolationsource builds ofmamba_ssm/causal_conv1d, thecausal_conv1d1.7.0 wheel template, and the flash-linear-attention uninstall. They now use the same one line.Generator changes (
update_all_notebooks.py)KERNELS_INSTALL = "!unsloth install-kernels"goes right after the unsloth install line in the default, Gemma 4, DiffusionGemma, EmbeddingGemma 2 and QAT blocks. An assert checks it always follows a line that installs unsloth, since the CLI only exists after that.subprocess.run(["unsloth", "install-kernels"]).original_template: the Falcon H1, Granite 4.0 350M and LFM2 kernel cells now use the same line.Testing
tests/test_install_kernels_line.py, added to the notebook tests workflow. It checks that:nb/In every run, the only cells without output are the
if False:save blocks at the end.