Repository navigation
pip: allow torch<2.12 and add amd/huggingfacenotorch extras (fixes AMD install clobber) - #7278
danielhanchen wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces two new dependency groups, huggingfacenotorch and amd, to the pyproject.toml configuration. The huggingfacenotorch group defines a comprehensive list of machine learning and utility packages, while the amd group bundles these dependencies along with platform-specific bitsandbytes requirements. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
fcacbf0 to
01dc92a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69195bb8dc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "pyyaml", | ||
| "nest-asyncio", | ||
| ] | ||
| huggingfacenotorch = [ |
There was a problem hiding this comment.
Make the no-torch extra actually no-torch
For installs that request the new unsloth[huggingfacenotorch] or unsloth[amd] path, pip still installs this package's base [project].dependencies before adding extra dependencies; in this release snapshot those hard deps still include torch, torchvision, xformers, and triton on the relevant platforms. Since extras are additive and cannot subtract hard dependencies, the new no-torch/AMD extra does not provide a torch-free ROCm-safe install path in environments that do not already have the full matching ROCm stack installed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
A PyPI extra is additive and cannot subtract the package's base deps (torch, torchvision, xformers, triton), so huggingfacenotorch cannot be torch-free by construction. The clobber this targets is handled by the torch cap bump (a pre-installed ROCm torch 2.11 satisfies <2.12.0 so it is not reinstalled), and the Studio installer consumes this extra with --no-deps. The extra mirrors main. Not actionable in pyproject.
| "diffusers", | ||
| "transformers>=4.51.3,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3,!=4.53.0,!=4.54.0,!=4.55.0,!=4.55.1,!=4.57.0,!=4.57.4,!=4.57.5,!=5.0.0,!=5.1.0,<=5.5.0", | ||
| "trl>=0.18.2,!=0.19.0,<=0.24.0", | ||
| "sentence-transformers", |
There was a problem hiding this comment.
Drop torch-transitive deps from the no-torch extra
Even if the hard base deps are fixed, this extra still cannot be used as a normal pip no-torch install because sentence-transformers is installed with its own dependencies and pulls torch transitively; the repo's studio/backend/requirements/no-torch-runtime.txt:1-3 explicitly uses --no-deps to avoid transitive torch resolution from packages including sentence-transformers. As a result, pip install unsloth[huggingfacenotorch] and the new amd extra can still resolve a PyPI torch over a preinstalled ROCm torch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct that sentence-transformers pulls torch transitively, but a pip extra cannot express --no-deps (the installer's no-torch-runtime.txt does), and torch already comes from the base deps on this branch regardless. No minimal pyproject fix; the extra mirrors main.
| "bitsandbytes>=0.49.1 ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64' or platform_machine == 'aarch64')", | ||
| "bitsandbytes>=0.49.1 ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')", |
There was a problem hiding this comment.
Avoid the known-broken AMD bitsandbytes fallback
For direct pip install 'unsloth[amd]' users this resolves the same PyPI bitsandbytes>=0.49.1 fallback that the installer only uses after warning that 4-bit decode is broken on ROCm; studio/install_python_stack.py:365-368 documents that bnb <=0.49.2 NaNs on every AMD GPU and uses a continuous-release wheel instead. Until the extra excludes the broken PyPI range or otherwise requires a fixed release, AMD users can get an install that succeeds but corrupts 4-bit generation/training results.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine footgun but not fixable here: bitsandbytes <=0.49.2 has the AMD 4-bit NaN decode bug and the fix ships only in the non-PyPI continuous-release wheel, so a bare pip install 'unsloth[amd]' resolves 0.49.2. Excluding it makes the extra uninstallable (no working bnb on PyPI) and extras cannot reference a URL wheel; the supported AMD path (Studio installer + docs) force-reinstalls the fixed wheel post-install. The extra mirrors main, so this is not a regression from this PR.
69195bb to
cd50f9e
Compare
The released torch>=2.4.0,<2.11.0 pin excludes the AMD 2.11.0+rocm wheel, so a follow-up pip resolve downgrades torch to 2.10.0 and breaks the ROCm install (#7275). Raise the ceiling to <2.12.0 so the ROCm 2.11 wheel is preserved, and add an amd extra (pulls huggingfacenotorch, no torch pin) plus a torch-free huggingfacenotorch extra so AMD users keep their ROCm torch. [pre-commit.ci skip]
Resolves 85 conflicted files, all of which trace to the branch's pre-commit.ci commit 18673a5 rather than to any change this PR authored. Why the code side takes 'pip': At the merge base the pip branch's [tool.ruff] table had no line-length, so ruff-format fell back to its 88 column default and the pre-commit.ci run reformatted 682 files to 88 columns. Since then 3455b45 ("pip: track main's packaging and tooling config") added line-length = 100 to pip, matching main. The bot commit is therefore churn produced under a tooling config the base branch has since corrected, and re-running the hook on the merged tree reproduces pip's 100 column formatting, not the branch's. It also carries no behaviour: all 682 files it touches are .py, and every one of them is AST identical before and after, so dropping the reformat drops formatting only. The resolved tree is byte identical to pip everywhere except pyproject.toml. pyproject.toml (no textual conflict, but two semantic points): - torch>=2.4.0,<2.11.0 -> <2.12.0 was made independently on both sides, by this PR in cd50f9e and on pip in b22b243, with the identical value. The merged file keeps <2.12.0, so neither side is undone. This also matches the exclusive _TORCH_CEILING="2.12.0" that #7256 introduces in install.sh, which expands to torch>=2.4,<2.12.0. - The huggingfacenotorch and amd extras are this PR's remaining novel content; pip has neither. They are re-applied on top of pip's file. The one deliberate rewrite is huggingfacenotorch's unsloth_zoo floor, from >=2026.7.4 to >=2026.7.6: b22b243 raised every other unsloth_zoo pin on pip to 2026.7.6, and main's own huggingfacenotorch already says 2026.7.6, so keeping 2026.7.4 would have reintroduced a stale floor that the base branch had just retired. The amd extra is unchanged from main. Line level preservation was checked in both directions: all 90477 lines pip added since the merge base survive, and all 26 lines this branch added survive except the single unsloth_zoo floor noted above.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ab9e7dbd4
ℹ️ 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".
| "sentence-transformers", | ||
| ] | ||
| amd = [ | ||
| "unsloth[huggingfacenotorch]", |
There was a problem hiding this comment.
Keep base hardware dependencies out of AMD installs
When a user runs pip install 'unsloth[amd]', this self-reference cannot make the installation torch-free: extras are additive, so pip still processes the unconditional project.dependencies, including torch, torchvision, bitsandbytes, and the platform-selected xformers/triton packages. Consequently the new AMD path can still resolve hardware packages from the default index and replace or conflict with the preinstalled ROCm stack—the exact clobber this extra is intended to prevent. The no-torch installation needs to avoid those base requirements rather than reference another extra of the same distribution.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The mechanism is right, extras are additive and cannot subtract base deps. The conclusion doesn't hold on this branch though. With the base cap at torch<2.12.0, a preinstalled ROCm torch 2.11.0+rocm7.x satisfies the base pin; xformers requires torch>=2.10, satisfied; and torchvision's exact torch==2.11.0 pin also matches, because PEP 440 ignores the local version segment when the specifier has none. I checked all three with packaging rather than by eye. Nothing re-resolves torch, so the clobber this extra targets does not reappear.
The change being described here means moving torch/torchvision/xformers/triton out of [project].dependencies entirely, which redefines pip install unsloth for every CUDA and CPU user. That isn't something a release-snapshot patch can do. The supported torch-free path remains the Studio installer, which consumes this extra with --no-deps. The extra mirrors main.
| "bitsandbytes>=0.49.1 ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64' or platform_machine == 'aarch64')", | ||
| "bitsandbytes>=0.49.1 ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')", |
There was a problem hiding this comment.
Install the ROCm-fixed bitsandbytes build
On a clean Linux or Windows AMD installation that uses 4-bit generation, this constraint selects the current PyPI 0.49.x build rather than the continuous ROCm build used by the repository's installers. install.sh:260-263 and studio/install_python_stack.py:391-393 explicitly document that bitsandbytes through 0.49.2 produces NaNs at decode shape on every AMD GPU and that the required GEMV fix is only in the post-0.49.2 continuous build until 0.50 reaches PyPI. Thus the new AMD extra can install successfully while producing corrupted 4-bit outputs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1e3190e: the floor is now bitsandbytes>=0.50.0, which excludes the NaN-at-decode range outright.
bnb 0.50.0 shipped to PyPI on 2026-07-24, and PR bitsandbytes#1887's merge commit is an ancestor of the 0.50.0 tag, so the ROCm GEMV fix is in the release. The PyPI wheels also carry the ROCm binaries for the platforms these markers select: libbitsandbytes_rocm{64,70,71,714,72}.so on manylinux x86_64, libbitsandbytes_rocm{72,714}.dll on win_amd64. 0.49.1 already required Python >=3.10, same as 0.50.0, so the Python floor is unchanged.
One correction to the finding: on Windows the old floor could not silently corrupt 4-bit output, because bnb 0.49.2's win_amd64 wheel ships no ROCm binary at all. ROCm wheels for Windows first appear in 0.50.0. The corruption scenario is real on Linux, where 0.49.2 does ship rocm62-rocm72 and can load and NaN.
Verified both directions: the built wheel's METADATA emits >=0.50.0 on both marker lines with no 0.49.x surviving, and 0.50.0 itself runs clean on a gfx1200 with ROCm torch 2.11.0+rocm7.13.0 (NF4 and FP4, batches 1/2/8/64, all finite, batch=1 in line with the rest).
install.sh and studio/install_python_stack.py still use the continuous-release wheel. That condition ("drop the pin once bnb 0.50+ ships on PyPI") is now true, but it's installer runtime behaviour rather than packaging, so it's going in a separate PR.
Edited: the bnb references above were bare #NNNN, which GitHub autolinked to unrelated unslothai/unsloth issues rather than the bitsandbytes PRs. Now full URLs.
bnb <= 0.49.2 NaNs at decode shape on every AMD GPU. The ROCm 4-bit GEMV fix (bnb PR #1887) merged after 0.49.2 and its merge commit is an ancestor of the 0.50.0 tag, so 0.50.0 is the first PyPI release carrying it. The PyPI wheels ship the ROCm binaries for the platforms these markers select: libbitsandbytes_rocm{64,70,71,714,72}.so on manylinux x86_64 and libbitsandbytes_rocm{72,714}.dll on win_amd64. 0.49.1 already required Python >=3.10, same as 0.50.0, so the Python floor is unchanged.
|
Pushed bitsandbytes 0.50.0 landed on PyPI on 2026-07-24. The ROCm 4-bit GEMV fix (bitsandbytes#1887) merged 2026-03-09, after 0.49.2, and its merge commit is an ancestor of the 0.50.0 tag, so 0.50.0 is the first PyPI release carrying it. That release also adds the fused 4-bit SIMT GEMM on ROCm and marks AMD ROCm stable. The old Checked the published wheels rather than assuming: Two checks, covering different halves. Packaging, which is what this diff actually changes: built the wheel from this branch and read its Runtime, i.e. whether the thing the extra now asks for actually works: bitsandbytes 0.50.0 installed directly with One correction to the finding as written: on Windows the old floor could not produce silently corrupted 4-bit output, because bnb 0.49.2's On the additive-extras P1: with the base cap at
On CI as of the previous head Edited: the bnb references above were bare |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e3190e2e2
ℹ️ 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".
| # bnb <= 0.49.2 NaNs at decode shape on every AMD GPU; the ROCm 4-bit GEMV | ||
| # fix (bnb PR #1887) first ships in 0.50.0, which is now on PyPI. | ||
| "bitsandbytes>=0.50.0 ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64' or platform_machine == 'aarch64')", | ||
| "bitsandbytes>=0.50.0 ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')", |
There was a problem hiding this comment.
Preserve the ROCm bitsandbytes wheel on Windows
On Windows ROCm, this marker requests the public bitsandbytes>=0.50.0, but the installer explicitly notes that the PyPI wheel contains only CUDA DLLs and force-installs the ROCm prerelease instead (studio/install_python_stack.py:1180-1203,1691-1695). That ROCm wheel reports 0.50.0.dev0, which does not satisfy this final-release floor, so a subsequent pip install "unsloth[amd]" can replace it with the incompatible PyPI wheel and make bitsandbytes fail on AMD. The Windows dependency needs to retain the ROCm-specific wheel path rather than requesting the public release.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The mechanism is right but the version string isn't, and the finding doesn't survive contact with the actual wheel.
I downloaded the artifact the installer pins (bitsandbytes-1.33.7.preview-py3-none-win_amd64.whl, the win_amd64 entry in _BNB_ROCM_PRERELEASE_URLS). Its metadata reports 0.50.1.dev0, not 0.50.0.dev0:
dist-info: bitsandbytes-0.50.1.dev0.dist-info
Name: bitsandbytes
Version: 0.50.1.dev0
0.50.1.dev0 is a dev release of the next patch, so it sorts above 0.50.0 and satisfies the floor. Checked with packaging rather than by eye: 0.50.1.dev0 → True, 0.50.0.dev0 (as this finding assumes) → False, 1.33.7rc0 (the filename reading) → True. Both readings of that deliberately-mismatched wheel keep it, so pip install 'unsloth[amd]' reports it already satisfied rather than replacing it. The Linux x86_64 prerelease is the same build and also reports 0.50.1.dev0, so that path behaves identically.
The 0.50.0.dev0 figure comes from the docstring at studio/install_python_stack.py:1185, which is stale: the continuous-release_main wheel is rolling and has since bumped.
The second premise is stale as well. install_python_stack.py:1694-1695 says the PyPI wheel ships only CUDA DLLs, which was true of 0.49.x. The published bitsandbytes-0.50.0-py3-none-win_amd64.whl ships libbitsandbytes_rocm714.dll and libbitsandbytes_rocm72.dll alongside the CUDA DLLs, so even in the counterfactual where a replacement did happen the result would still be ROCm-capable.
Both stale comments are going in the installer PR that drops the continuous-release pin, not here.
| "pyyaml", | ||
| "nest-asyncio", | ||
| ] | ||
| huggingfacenotorch = [ |
There was a problem hiding this comment.
Make the no-torch extra actually omit torch
For a normal pip install "unsloth[huggingfacenotorch]"—and therefore [amd] through line 173—optional dependencies are additive, while [project].dependencies still mandates torch, torchvision, xformers, bitsandbytes, and triton (pyproject.toml:27-41). Several entries in this extra also require torch transitively; the repository's actual no-torch installer explicitly uses --no-deps to prevent that resolution (studio/backend/requirements/no-torch-runtime.txt:1-7). Consequently this newly exposed pip extra always resolves torch rather than providing the promised torch-free stack, so it cannot protect an absent or incompatible ROCm/MLX installation; the package needs a minimal base plus a no-deps or constraints-based installation path instead of an additive extra.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same point as the two P2s on 69195bb8 and the P1 on 5ab9e7db, so the same answer.
Extras are additive and cannot subtract [project].dependencies — agreed, and that is exactly why this extra is not a torch-free path for a bare pip install. It is not presented as one. The clobber in #7275 is fixed by the base cap moving to torch<2.12.0: a preinstalled ROCm torch 2.11.0+rocm7.x satisfies the base pin, xformers wants torch>=2.10, and torchvision's exact torch==2.11.0 pin matches too, since PEP 440 ignores the local version segment when the specifier has none. Verified all three with packaging. Nothing re-resolves torch.
The shape being suggested — a minimal base plus a no-deps or constraints-based path — means removing torch/torchvision/xformers/triton from [project].dependencies, which redefines pip install unsloth for every CUDA and CPU user. That is not something a release-snapshot patch can carry. The torch-free path stays the Studio installer, which consumes this extra with --no-deps.
Re: P1 "Preserve the ROCm bitsandbytes wheel on Windows"The mechanism is sound but the version string is wrong, and the finding collapses on the real wheel. I downloaded the exact artifact the installer pins (
Both readings of that deliberately-mismatched wheel keep it. Whether pip records the dist-info version ( The The second premise is also stale. The comment at Both stale comments go in the installer PR with the Re: P1 "Make the no-torch extra actually omit torch"Same finding as the two P2s on The suggested change — a minimal base plus a no-deps or constraints path — means removing torch/torchvision/xformers/triton from Final review of
|
|
Updated the branch: merged base Both P1s from the On CI, one correction lands in this PR's favour.
The remaining items from my review are all outside this diff and are going into separate PRs: main's A fresh CI run is going on |
The comment credited bnb PR #1887 as "the ROCm 4-bit GEMV fix" for every AMD GPU. #1887 decouples blocksize from warp size and fixes a hardcoded warp size of 32 in kgemm_4bit_inference_naive, which is a CDNA problem by construction. The RDNA-side work is #1979 (fused 4-bit SIMT GEMM) and #2012 (RDNA3/4 workgroup resonance). All three first ship in 0.50.0, so the >=0.50.0 floor is unchanged; only the justification was wrong.
|
Correcting a comment, not the floor. The comment credited bitsandbytes#1887 as "the ROCm 4-bit GEMV fix" that makes bnb All three land in 0.50.0 and none are in 0.49.2, so the floor holds either way — 0.50.0 remains the first PyPI release with the complete ROCm 4-bit path. My gfx1200 run was exercising bitsandbytes#1979 and bitsandbytes#2012, not bitsandbytes#1887. I should also be straight that I never verified the "every AMD GPU" part. I confirmed 0.50.0 works on gfx1200; I never ran 0.49.2 to watch it fail. That phrasing came from The original phrasing still lives in On sourcing, since bare numbers were the wrong way to cite this: all three are AMD's own ROCm work in bitsandbytes, authored by sstamenk, and the 0.50.0 release notes say it plainly: "Stability and performance improvements bring AMD ROCm support out of preview; it is now considered stable." That page is the citation I should have led with. Edited: the bnb references above were bare |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 910a657d80
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "sentence-transformers", | ||
| ] | ||
| amd = [ | ||
| "unsloth[huggingfacenotorch]", |
There was a problem hiding this comment.
Keep the AMD extra from pulling core torch deps
When a ROCm user installs the new unsloth[amd] extra as the AMD/no-torch path, this self-reference is still only additive: pip also installs the package's [project].dependencies, which already include torch, torchvision, xformers, and triton. That means the new AMD extra can still trigger normal PyPI torch-stack resolution instead of preserving the ROCm stack it is meant to protect; the torch-bearing deps need to be moved out of the base metadata or this path needs to use an explicit no-deps/no-torch install mechanism.
Useful? React with 👍 / 👎.
| "protobuf", | ||
| "sentencepiece>=0.2.0", | ||
| "datasets>=3.4.1,!=4.0.*,!=4.1.0,<4.4.0", | ||
| "accelerate>=0.34.1", |
There was a problem hiding this comment.
Avoid resolving torch transitively in the no-torch extra
For installs that use this new huggingfacenotorch/amd extra to preserve a preinstalled ROCm torch, pip will still follow the dependencies of these HF packages; the repo's no-torch requirements explicitly install with --no-deps because packages like accelerate, peft, trl, and sentence-transformers trigger transitive torch resolution (studio/backend/requirements/no-torch-runtime.txt lines 1-3). As a result, even after removing direct torch entries from this extra, pip install unsloth[huggingfacenotorch] or unsloth[amd] can still ask the resolver for a PyPI torch and clobber the ROCm wheel.
Useful? React with 👍 / 👎.
…NaNs) (#7535) * amd: require bitsandbytes>=0.50.0 in the amd extra bnb <= 0.49.2 NaNs at decode shape on every AMD GPU. The ROCm 4-bit GEMV fix (bnb PR #1887) first ships in 0.50.0, on PyPI since 2026-07-24, so the old >=0.49.1 floor could still resolve the broken range. Mirrors the same change made on the pip release branch in #7278. * amd: cite the 0.50.0 ROCm work accurately in the bnb floor comment The comment credited bnb PR #1887 as "the ROCm 4-bit GEMV fix" for every AMD GPU. #1887 decouples blocksize from warp size and fixes a hardcoded warp size of 32 in kgemm_4bit_inference_naive, which is a CDNA problem by construction. The RDNA-side work is #1979 (fused 4-bit SIMT GEMM) and #2012 (RDNA3/4 workgroup resonance). All three first ship in 0.50.0, so the >=0.50.0 floor is unchanged; only the justification was wrong. * amd: raise the installer bitsandbytes fallback floors to 0.50.0 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * amd: stop reporting the bitsandbytes PyPI fallback as broken * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten AMD bnb floor comments * Keep the amd extra citation and the AMD install guide reference * amd: do not promise aarch64 a ROCm 4-bit backend it never gets * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * amd: fall back to the PyPI bitsandbytes floor on Windows ROCm too * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…re (#7536) * amd: require bitsandbytes>=0.50.0 in the amd extra bnb <= 0.49.2 NaNs at decode shape on every AMD GPU. The ROCm 4-bit GEMV fix (bnb PR #1887) first ships in 0.50.0, on PyPI since 2026-07-24, so the old >=0.49.1 floor could still resolve the broken range. Mirrors the same change made on the pip release branch in #7278. * tests: pin the amd/huggingfacenotorch extras and name the audit failure security-audit.yml builds its hf-stack scan set by indexing [huggingfacenotorch] out of pyproject.toml with no guard. The pip release branch never had that extra, so advisory audit and the three pip scan-packages jobs died on a bare KeyError from at least 2026-07-08 to 2026-07-27 without anyone reading it as a missing extra. Add a contract test for both extras (existence, torch-free, bnb floor excludes the NaN-at-decode range) plus a check that every extra the workflow indexes actually exists, and give the workflow a message that names the problem instead of a raw traceback. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * amd: cite the 0.50.0 ROCm work accurately in the bnb floor comment The comment credited bnb PR #1887 as "the ROCm 4-bit GEMV fix" for every AMD GPU. #1887 decouples blocksize from warp size and fixes a hardcoded warp size of 32 in kgemm_4bit_inference_naive, which is a CDNA problem by construction. The RDNA-side work is #1979 (fused 4-bit SIMT GEMM) and #2012 (RDNA3/4 workgroup resonance). All three first ship in 0.50.0, so the >=0.50.0 floor is unchanged; only the justification was wrong. * tests: match the corrected bnb 0.50.0 justification Drops the unverified "NaNs on every AMD GPU" phrasing and the single-PR attribution from the test's comments and assertion message. The floor itself is unchanged. * Let the torchcodec audit contract read the guarded extra lookup test_security_audit_covers_every_installable_torchcodec_line asserts that both halves of security-audit.yml index the audio-torch211 extra, by counting the literal subscript. Routing the lookups through the guarded extra() helper drops that count to zero and fails a test that is really about coverage, not spelling. Count either shape. A lookup that names a group the workflow no longer indexes still fails the assertion, which is what it is there to catch. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments this change adds for PR #7536 * Check the extras guards structurally with an AST walk for PR #7536 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Parse the unquoted python heredocs in the guard test too for PR #7536 * Read extra names structurally and run the contract when the audit workflow changes for PR #7536 * Check the whole bitsandbytes floor and require a KeyError handler in the guard test for PR #7536 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]>
…re (unslothai#7536) * amd: require bitsandbytes>=0.50.0 in the amd extra bnb <= 0.49.2 NaNs at decode shape on every AMD GPU. The ROCm 4-bit GEMV fix (bnb PR unslothai#1887) first ships in 0.50.0, on PyPI since 2026-07-24, so the old >=0.49.1 floor could still resolve the broken range. Mirrors the same change made on the pip release branch in unslothai#7278. * tests: pin the amd/huggingfacenotorch extras and name the audit failure security-audit.yml builds its hf-stack scan set by indexing [huggingfacenotorch] out of pyproject.toml with no guard. The pip release branch never had that extra, so advisory audit and the three pip scan-packages jobs died on a bare KeyError from at least 2026-07-08 to 2026-07-27 without anyone reading it as a missing extra. Add a contract test for both extras (existence, torch-free, bnb floor excludes the NaN-at-decode range) plus a check that every extra the workflow indexes actually exists, and give the workflow a message that names the problem instead of a raw traceback. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * amd: cite the 0.50.0 ROCm work accurately in the bnb floor comment The comment credited bnb PR unslothai#1887 as "the ROCm 4-bit GEMV fix" for every AMD GPU. unslothai#1887 decouples blocksize from warp size and fixes a hardcoded warp size of 32 in kgemm_4bit_inference_naive, which is a CDNA problem by construction. The RDNA-side work is unslothai#1979 (fused 4-bit SIMT GEMM) and unslothai#2012 (RDNA3/4 workgroup resonance). All three first ship in 0.50.0, so the >=0.50.0 floor is unchanged; only the justification was wrong. * tests: match the corrected bnb 0.50.0 justification Drops the unverified "NaNs on every AMD GPU" phrasing and the single-PR attribution from the test's comments and assertion message. The floor itself is unchanged. * Let the torchcodec audit contract read the guarded extra lookup test_security_audit_covers_every_installable_torchcodec_line asserts that both halves of security-audit.yml index the audio-torch211 extra, by counting the literal subscript. Routing the lookups through the guarded extra() helper drops that count to zero and fails a test that is really about coverage, not spelling. Count either shape. A lookup that names a group the workflow no longer indexes still fails the assertion, which is what it is there to catch. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments this change adds for PR unslothai#7536 * Check the extras guards structurally with an AST walk for PR unslothai#7536 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Parse the unquoted python heredocs in the guard test too for PR unslothai#7536 * Read extra names structurally and run the contract when the audit workflow changes for PR unslothai#7536 * Check the whole bitsandbytes floor and require a KeyError handler in the guard test for PR unslothai#7536 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]>
What
Two changes to the released (
pip)pyproject.tomlso AMD installs work from PyPI:torch>=2.4.0,<2.11.0to<2.12.0.amdandhuggingfacenotorchextras (present onmain, missing on the release branch).Why the torch bump
AMD ROCm wheels are
2.11.0+rocm7.x. The old<2.11.0cap rejects them, so:pip install unslothon an AMD box, andunslothinstall step (which runs after ROCm torch is placed),both re-resolve torch down to
2.10.0from PyPI, clobbering the ROCm build. Import then fails onc10.dllinit (WinError 1114) - this is unsloth#7275 on 780M/gfx1103, and would hit every AMD arch on the same install path.Bumping to
<2.12.0lets the already-installed2.11.0+rocmsatisfy the base constraint, so it is left in place (no clobber). torch 2.11 is already exercised on ROCm; discrete CUDA/CPU users simply gain access to 2.11.x. This is a global torch-resolution change, not AMD-only - calling that out explicitly.Why the extras
amdpullsunsloth[huggingfacenotorch](the HF training stack without torch/torchvision, so it never drags a PyPI torch over the ROCm one) plus ROCm-erabitsandbytes>=0.49.1. Copied verbatim frommain; both extras are URL-free.Notes
The branch was rebuilt directly on top of the
piprelease snapshot, so the diff is exactly one file (pyproject.toml, +26/-1). Verified withtomllib: base torch<2.12.0,amdpresent,huggingfacenotorchpresent and torch-free.