Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix the prebuilt wheel publish step and shorten the release notes to one sentence (#12068)

Daniel Hanbbe44abed8fb
diff --git a/.github/scripts/prebuilt_wheels.py b/.github/scripts/prebuilt_wheels.py
index e403ac03b31..70f09e49515 100644
--- a/.github/scripts/prebuilt_wheels.py
+++ b/.github/scripts/prebuilt_wheels.py
@@ -295,126 +295,33 @@ def parse_wheel_name(name: str) -> dict | None:
}
-NOTES_PREAMBLE = """\
-Prebuilt Linux x86_64 CUDA 13 wheels for flash-attn, causal-conv1d and mamba-ssm, built against \
-PyTorch 2.13 and 2.14.
-
-### Why these exist
-
-Upstream publishes prebuilt wheels for these three packages, but only against PyTorch 2.10 and \
-2.11. Those wheels were ABI compatible through torch 2.12 and stopped being so at 2.13:
-
-- `torch 2.13` changed `c10::impl::cow::materialize_cow_storage` and the signature of \
-`c10::cuda::c10_cuda_check_implementation`, so an upstream wheel imports on 2.13 as \
-`ImportError: undefined symbol: ...`.
-- `torch 2.14` changed it again, so a 2.13 wheel is not usable on 2.14 either.
-
-There is no version of these wheels that covers several torch minors from 2.13 on. Every torch \
-minor needs its own build, which is what this release is: one wheel per (package, torch minor, \
-interpreter), named so it cannot be installed against the wrong one.
-
-Building them from source instead takes roughly five hours of nvcc for flash-attn alone, needs \
-the CUDA toolkit present, and is out of reach on most machines that want to run the result.
-
-### Compatibility
-
-| | |
-| --- | --- |
-| Platform | Linux x86_64 only |
-| CUDA | 13.0 toolkit, `cu13` wheels, usable with any CUDA 13.x runtime |
-| PyTorch | exactly the minor in the filename, any patch level of it |
-| GPU architectures | sm_80, sm_86, sm_89, sm_90, sm_100, sm_120 |
-| C++11 ABI | `TRUE`, matching every PyTorch pip wheel from 2.7 on |
-| glibc | 2.35 or newer (built on Ubuntu 22.04) |
-
-sm_86 and sm_89 are covered by the sm_80 cubin, which is forward compatible across the minor \
-versions of its major. Newer architectures fall back to the embedded PTX and JIT on first use.
-
-Not covered: Windows, macOS, ROCm, CUDA 12 or earlier, aarch64, and free-threaded interpreters.
-
-### Installing
-
-```
-pip install https://github.com/{repo}/releases/download/{tag}/<wheel>
-```
-
-The `+cu13torch2.13cxx11abiTRUE` segment in each filename is a PEP 440 local version. pip \
-refuses to install a wheel whose local version does not match the environment it was built \
-for, so picking the wrong torch is a clean install error rather than an `undefined symbol` \
-traceback the first time a kernel is called.
-
-### Verifying
-
-Every wheel is signed with [Sigstore](https://www.sigstore.dev/) through GitHub OIDC, with the \
-bundle published beside it as `<wheel>.sigstore.json`, and carries an \
-[SLSA build provenance](https://slsa.dev/) attestation.
-
-Sigstore, which proves the wheel was produced by this workflow in this repository:
-
-```
-python -m pip install sigstore
-python -m sigstore verify identity \\
- --cert-identity "https://github.com/{repo}/.github/workflows/prebuilt-cuda-wheels.yml@refs/heads/main" \\
- --cert-oidc-issuer https://token.actions.githubusercontent.com \\
- --bundle <wheel>.sigstore.json \\
- <wheel>
-```
-
-`verify identity` rather than `verify github`, because it takes both the identity and the issuer \
-on every sigstore-python version; `verify github` dropped `--cert-oidc-issuer` in 4.0 and takes \
-`--repository` and `--ref` instead. Use whichever your installed version accepts.
-
-Build provenance, which reports the exact run, commit and workflow that produced it. Needs \
-GitHub CLI 2.49 or newer:
-
-```
-gh attestation verify <wheel> --repo {repo}
-```
-
-Digests, which is the cheap check and still worth doing:
-
-```
-sha256sum -c SHA256SUMS --ignore-missing
-```
-
-### Wheels
-"""
+def _join(items: list[str]) -> str:
+ return items[0] if len(items) == 1 else ", ".join(items[:-1]) + " and " + items[-1]
def render_notes(entries: list[tuple[str, str]], tag: str, repo: str) -> str:
- """Release body from `(sha256, filename)` pairs.
+ """One-sentence release body from `(sha256, filename)` pairs.
Regenerated from the release's current assets on every publish rather than appended to, so
- a second run that adds the torch 2.14 half produces notes describing both halves, and a
- third run that replaces one wheel does not leave the old digest in the table.
+ a second run that adds the torch 2.14 half produces a sentence describing both halves.
"""
- rows = []
- for digest, name in entries:
- parsed = parse_wheel_name(name)
- if parsed is None:
- continue
- rows.append((parsed, digest))
- rows.sort(key = lambda row: (row[0]["torch"], row[0]["python"], row[0]["package"]))
-
- lines = [NOTES_PREAMBLE.format(repo = repo, tag = tag).rstrip("\n"), ""]
- if not rows:
- lines.append("No wheels are attached to this release yet.")
- return "\n".join(lines) + "\n"
-
- lines.append("| Wheel | Package | Version | torch | CUDA | Python | C++11 ABI | sha256 |")
- lines.append("| --- | --- | --- | --- | --- | --- | --- | --- |")
- for parsed, digest in rows:
- lines.append(
- "| `{name}` | {package} | {version} | {torch} | {cuda} | {python} | {abi} | `{digest}` |".format(
- digest = digest, **parsed
- )
- )
- lines.append("")
- lines.append(
- f"{len(rows)} wheels, each with a `.sigstore.json` bundle beside it. "
- "`SHA256SUMS` lists the same digests in `sha256sum -c` form."
+ parsed = [row for row in (parse_wheel_name(name) for _, name in entries) if row is not None]
+ if not parsed:
+ return "No wheels are attached to this release yet.\n"
+ present = {row["package"] for row in parsed}
+ packages = [
+ f"{package} {spec['version']}" for package, spec in SPECS.items() if package in present
+ ]
+ torches = sorted({row["torch"] for row in parsed}, key = lambda v: tuple(map(int, v.split("."))))
+ # cp313 -> 3.13
+ pythons = [
+ f"{cp[2]}.{cp[3:]}"
+ for cp in sorted({row["python"] for row in parsed}, key = lambda cp: int(cp[3:]))
+ ]
+ return (
+ f"Prebuilt Linux x86_64 CUDA {CUDA_TAG} wheels for {_join(packages)}, "
+ f"built for PyTorch {_join(torches)} on Python {_join(pythons)}.\n"
)
- return "\n".join(lines) + "\n"
def _cmd_matrix(args: argparse.Namespace) -> int:
diff --git a/.github/workflows/prebuilt-cuda-wheels.yml b/.github/workflows/prebuilt-cuda-wheels.yml
index 563a366cde6..68fca57f568 100644
--- a/.github/workflows/prebuilt-cuda-wheels.yml
+++ b/.github/workflows/prebuilt-cuda-wheels.yml
@@ -766,9 +766,9 @@ jobs:
run: |
set -euo pipefail
# A draft release has no tag yet, so it is found by listing, not by tag lookup.
- # shellcheck disable=SC2016 # $tag is a jq variable, not a shell one
+ # gh's --jq takes no --arg; env.TAG reads the step env instead.
existing="$(gh release list --repo "$GITHUB_REPOSITORY" --limit 200 --json tagName \
- --jq --arg tag "$TAG" '.[] | select(.tagName == $tag) | .tagName')"
+ --jq '.[] | select(.tagName == env.TAG) | .tagName')"
if [ -z "$existing" ]; then
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
@@ -794,9 +794,8 @@ jobs:
run: |
set -euo pipefail
# Listed rather than looked up by tag: a draft release has no tag object yet.
- # shellcheck disable=SC2016 # $tag is a jq variable, not a shell one
gh api --paginate "repos/$GITHUB_REPOSITORY/releases?per_page=100" \
- --jq --arg tag "$TAG" '.[] | select(.tag_name == $tag) | .assets[] | select(.name | endswith(".whl")) | "\(.digest // "sha256:unknown" | sub("^sha256:"; "")) \(.name)"' \
+ --jq '.[] | select(.tag_name == env.TAG) | .assets[] | select(.name | endswith(".whl")) | "\(.digest // "sha256:unknown" | sub("^sha256:"; "")) \(.name)"' \
> published.txt
sort -k2 -o published.txt published.txt
cat published.txt
diff --git a/tests/python/test_prebuilt_cuda_wheels.py b/tests/python/test_prebuilt_cuda_wheels.py
index 4fd94725ab9..0bfe10047db 100644
--- a/tests/python/test_prebuilt_cuda_wheels.py
+++ b/tests/python/test_prebuilt_cuda_wheels.py
@@ -426,39 +426,26 @@ class TestReleaseNotes:
entries, tag = "prebuilt-wheels-cu13", repo = "unslothai/unsloth"
)
- def test_every_wheel_is_listed_with_its_digest(self):
- notes = self._notes()
- for torch in prebuilt_wheels.TORCH_VERSIONS:
- for package in prebuilt_wheels.SPECS:
- assert f"`{prebuilt_wheels.wheel_name(package, torch, '3.13')}`" in notes
- assert "| 6 wheels" not in notes
- assert "6 wheels, each with a `.sigstore.json` bundle beside it." in notes
-
- def test_non_wheel_assets_are_not_rows(self):
- assert "| `SHA256SUMS` |" not in self._notes()
-
- def test_the_verification_commands_are_the_ones_the_workflow_signs_with(self):
- notes = self._notes()
- assert "python -m sigstore verify identity" in notes
- assert (
- "https://github.com/unslothai/unsloth/.github/workflows/prebuilt-cuda-wheels.yml"
- in notes
+ def test_the_body_is_one_sentence_naming_what_is_attached(self):
+ assert self._notes() == (
+ "Prebuilt Linux x86_64 CUDA 13 wheels for flash-attn 2.8.4, causal-conv1d 1.7.0 and "
+ "mamba-ssm 2.3.2.post1, built for PyTorch 2.13 and 2.14 on Python 3.13.\n"
)
- assert "--cert-oidc-issuer https://token.actions.githubusercontent.com" in notes
- assert "gh attestation verify <wheel> --repo unslothai/unsloth" in notes
- assert "sha256sum -c SHA256SUMS" in notes
- def test_it_says_why_these_exist_with_the_actual_symbols(self):
- notes = self._notes()
- assert "materialize_cow_storage" in notes
- assert "c10_cuda_check_implementation" in notes
- assert "Linux x86_64 only" in notes
- assert "Not covered: Windows, macOS, ROCm" in notes
+ def test_it_describes_only_the_assets_present(self):
+ notes = prebuilt_wheels.render_notes(
+ [("0" * 64, prebuilt_wheels.wheel_name("mamba-ssm", "2.14.0", "3.12"))],
+ tag = "t",
+ repo = "o/r",
+ )
+ assert notes == (
+ "Prebuilt Linux x86_64 CUDA 13 wheels for mamba-ssm 2.3.2.post1, "
+ "built for PyTorch 2.14 on Python 3.12.\n"
+ )
- def test_an_empty_release_does_not_render_an_empty_table(self):
- notes = prebuilt_wheels.render_notes([], tag = "t", repo = "o/r")
- assert "No wheels are attached" in notes
- assert "| Wheel | Package |" not in notes
+ def test_an_empty_release_says_so(self):
+ notes = prebuilt_wheels.render_notes([("deadbeef", "SHA256SUMS")], tag = "t", repo = "o/r")
+ assert notes == "No wheels are attached to this release yet.\n"
class TestMambaPatch:
@@ -765,3 +752,12 @@ class TestWarmWiring:
assert pattern.endswith("*")
assert uploaded.startswith(pattern[:-1])
assert uploaded[len(pattern) - 1 :] == "${{ matrix.shard }}"
+
+
+def test_release_lookups_do_not_pass_arg_to_gh_jq():
+ """gh's --jq has no --arg flag: `--jq --arg tag X` fails the publish job before any release call."""
+ workflow = (REPO / ".github" / "workflows" / "prebuilt-cuda-wheels.yml").read_text(
+ encoding = "utf-8"
+ )
+ assert "--jq --arg" not in workflow
+ assert workflow.count("== env.TAG") == 2