Skip to content

FIX macOS test failures and MPS float64 errors in FRoD and EVA - #4102

Merged
BenjaminBossan merged 3 commits into
huggingface:mainfrom
Alex-Wengg:fix/mps-float64
Nov 4, 2026
Merged

BenjaminBossan merged 3 commits into
huggingface:mainfrom
Alex-Wengg:fix/mps-float64

Conversation

@Alex-Wengg

@Alex-Wengg Alex-Wengg commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4042, fixes #4043

Fixes the failures from the first nightly macOS run (https://github.com/huggingface/peft/actions/runs/41554512499) and two MPS float64 crashes that the run can't see.

The 13 CI failures are tolerance issues. The GitHub macOS runners don't expose MPS (every shard logs Skipping device Apple Paravirtual device that does not support Metal 2.0), so the nightly run is macOS on CPU. There, torch's BLAS is Apple Accelerate, and its float32 rounding puts the PiSSA, OLoRA, and CorDA output comparisons at 1.5-3e-6 against atol=1e-6. These tests now use 1e-5 on macOS and keep 1e-6 elsewhere. HiRA safe_merge on Conv3d1x1 is off by ~3e-5. That model (added in #3777) was missing from the conv list that already gets 1e-3.

MPS float64 crashes (MPS has no float64):

Each has an MPS-only regression test that fails on main and passes with the fix. This replaces the closed #4044 and #4045.

Testing on an M5 Pro with the same versions as CI (Python 3.14, torch 2.15.0, transformers 5.22.1, PEFT_TEST_TINY_MODELS_ONLY=1):

  • Full suite on CPU, with MPS hidden to match the runner: 13 failed before, 0 after (35,087 passed).
  • MPS: the FRoD tests go from 171 failed to 0. All FRoD, EVA, IncrementalPCA, and the adjusted init tests pass.

The full suite on MPS still has about 300 unrelated failures, mostly scaled_dot_product_attention for MPS does not support dropout in the gradient-checkpointing tests. I left those out of this PR.

MPS does not support float64, so casting on device made get_peft_model
fail for FRoD when the model is on MPS.
IncrementalPCA accumulated its running statistics in float64 on the
input's device. MPS has no float64, so EVA initialization failed there.
Accumulate in float32 on MPS and keep float64 everywhere else.
The nightly macOS CI runs on CPU, where float32 matmuls go through
Apple Accelerate. Its rounding pushes the PiSSA, OLoRA, and CorDA
output comparisons slightly past atol=1e-6 (up to ~3e-6), so these
tests use 1e-5 on macOS. MPS shows the same small drift for CorDA.

HiRA safe_merge with the Conv3d 1x1 model differs by ~3e-5, so it now
gets the same 1e-3 tolerance as the other conv models.
@Alex-Wengg Alex-Wengg changed the title FIX MPS float64 errors in FRoD and IncrementalPCA (EVA) FIX macOS test failures and MPS float64 errors in FRoD and EVA Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Thank you for your interest in contributing to PEFT. This PR is being closed because its description does not reference an accepted PEFT discussion or an open PEFT issue with explicit approval from a maintainer or public Hugging Face organization member that applies to this PR's author.

Please open or find an issue, discuss the proposed contribution, and wait for an authorized person to comment /peft-triage approved before opening a PR. To limit approval to one contributor, the commenter can add that person's username after approved. Once approved, reference it in this PR's description (for example, Fixes #123) and reopen the PR; there is no need to create another PR.

If you believe this PR was closed incorrectly, please ping the maintainers here.

See the contribution guidelines.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@BenjaminBossan BenjaminBossan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for taking care of MacOS failures, LGTM.

@BenjaminBossan
BenjaminBossan merged commit f269f48 into huggingface:main Nov 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EVA initialization fails on MPS: IncrementalPCA accumulates in float64 FRoD fails on MPS: weights are cast to float64 before moving to CPU

3 participants