workflows: add build-torchaudio.yml for riscv64 wheels - #285
Open
luhenry wants to merge 2 commits into
Open
Conversation
torchaudio (github.com/pytorch/audio) is in maintenance phase: a plain setuptools build whose only real dependency is torch itself. It ships no PyPI sdist and its setup.py imports torch at module top with no [build-system] table, so we build from an upstream checkout (like build-onnx.yml) with cibuildwheel + --no-build-isolation. The build installs torch from our registry (public PyPI has no riscv64 torch wheel), builds against its stable libtorch ABI (torchaudio 2.11 is forward-compatible with any torch >=2.11), and excludes the torch-owned shared libs from the auditwheel repair so libtorch is not vendored into the wheel - yielding a 1.2 MB wheel instead of ~130 MB. Verified locally under QEMU (build + upstream smoke test) for cp313. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Resolve the build/test torch to the latest on the registry rather than a hardcoded 2.13.0+cpu pin. torchaudio 2.11 targets the stable libtorch ABI and pins no torch at runtime, so any torch >=2.11 works. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
luhenry
marked this pull request as ready for review
August 20, 2026 12:32
Member
Author
justeph
reviewed
Aug 21, 2026
| UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ | ||
| UV_INDEX_STRATEGY: unsafe-best-match | ||
| UV_ONLY_BINARY: ':all:' | ||
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| USE_CUDA=0 | ||
| BUILD_VERSION=${{ env.TORCHAUDIO_VERSION }} | ||
| PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | ||
| CIBW_ENVIRONMENT_PASS_LINUX: PIP_EXTRA_INDEX_URL |
Collaborator
There was a problem hiding this comment.
this line is redundant with the line just above
| - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | ||
| env: | ||
| CIBW_BUILD: "cp${{ matrix.python-version }}-manylinux_riscv64" | ||
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
Comment on lines
+32
to
+34
| UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ | ||
| UV_INDEX_STRATEGY: unsafe-best-match | ||
| UV_ONLY_BINARY: ':all:' |
Collaborator
There was a problem hiding this comment.
uv is not used, so this can be dropped
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.
What
Adds
.github/workflows/build-torchaudio.ymlto build riscv64 wheels fortorchaudioand publish them topypi.riseproject.dev.Relates to #228
Approach
torchaudio 2.11 is in maintenance phase — a plain setuptools build whose only real dependency is torch itself. It ships no PyPI sdist, and its
setup.pydoesimport torchat module top with no[build-system]table. So this is a build-from-checkout workflow (likebuild-onnx.yml): checkoutpytorch/audioat the tag, thencibuildwheelon the nativeubuntu-24.04-riscvrunner.Key specifics:
--no-build-isolation(CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation") with torch preinstalled inCIBW_BEFORE_BUILD, since setup.py imports torch directly.--only-binary=:all:prevents any source fallback.TORCH_TARGET_VERSION) and is forward-compatible with any torch ≥ 2.11, pinning no torch version at runtime.libtorch*,libc10,libgomp,libgfortran,libopenblas) so libtorch is not vendored — the wheel is 1.2 MB, not ~130 MB. This mirrors how upstream torchaudio wheels are built.test/smoke_test/smoke_test.pyagainst the built wheel.cp312/cp313/cp314/cp314tmatches torch's riscv64 matrix on the registry.Validation
Locally under QEMU (host is aarch64 + qemu-riscv64 binfmt) for cp313:
torchaudio-2.11.0+cpu-cp313-cp313-manylinux_2_39_riscv64.whl(1.2 MB)Draft to get CI build results across the full matrix. The
publishjob dry-runs offmain, so it's safe on this PR branch.🤖 Generated with Claude Code