Repository navigation
FIX macOS test failures and MPS float64 errors in FRoD and EVA - #4102
Conversation
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.
|
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 If you believe this PR was closed incorrectly, please ping the maintainers here. See the contribution guidelines. |
|
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
left a comment
There was a problem hiding this comment.
Thanks for taking care of MacOS failures, LGTM.
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 againstatol=1e-6. These tests now use 1e-5 on macOS and keep 1e-6 elsewhere. HiRAsafe_mergeonConv3d1x1is 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):The full suite on MPS still has about 300 unrelated failures, mostly
scaled_dot_product_attention for MPS does not support dropoutin the gradient-checkpointing tests. I left those out of this PR.