Skip to content

ci: validate PyTorch MPS support#8

Merged
stefan-jansen merged 1 commit into
mainfrom
validate-mps-ci-pr4
Jul 11, 2026
Merged

ci: validate PyTorch MPS support#8
stefan-jansen merged 1 commit into
mainfrom
validate-mps-ci-pr4

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

@/tmp/ml4t-models-mps-pr-body.md

Copilot AI review requested due to automatic review settings July 11, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class validation for PyTorch MPS usage by extending the internal torch runtime helpers and introducing both unit tests and a macOS CI smoke job to ensure MPS is actually available and usable on Apple Silicon runners.

Changes:

  • Extend resolve_device() and seed_torch() to support the PyTorch MPS backend when available.
  • Add unit tests covering device resolution and seeding dispatch for CPU/CUDA/MPS using a small fake torch shim.
  • Add a macOS (Apple Silicon) CI smoke job to verify torch.backends.mps is built/available and that basic tensor ops run on MPS.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/test_torch_runtime.py Adds unit tests validating device resolution and seeding behavior across CPU/CUDA/MPS.
src/ml4t/models/_internal/torch_runtime.py Implements MPS-aware device selection and MPS seeding support.
.github/workflows/ci.yml Adds a macOS MPS smoke job and gates the build on it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to 21
requested_device = requested.strip().lower()
if requested_device.startswith("cuda") and torch.cuda.is_available():
return torch.device(requested)
@stefan-jansen stefan-jansen merged commit b29e8e5 into main Jul 11, 2026
9 checks passed
@stefan-jansen stefan-jansen deleted the validate-mps-ci-pr4 branch July 11, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants