Repository navigation
FIX Run IncrementalPCA, and thus EVA initialization, on MPS - #4045
Alex-Wengg wants to merge 1 commit into
Conversation
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.
|
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. |
Fixes #4043.
IncrementalPCAaccumulated its running statistics in float64 on the input's device, which fails on MPS because MPS has no float64. That broke LoRA's EVA initialization on MPS. This adds a small_accumulation_dtypehelper that returns float32 on MPS and float64 everywhere else, so CPU and CUDA behavior is unchanged.Added
test_incremental_pca_on_mps_matches_cpu, which only runs on MPS and compares the fitted components and the projection with CPU. It fails on main with the float64TypeErrorand passes with this change.test_incremental_pca.pypasses, and the EVA tests intest_gpu_examples.pynow pass on MPS (they're slow there, sincetorch.svd_lowrankfalls back to CPU for these sizes).