Repository navigation
FIX Move FRoD weights to CPU before casting to float64 - #4044
Alex-Wengg wants to merge 1 commit into
Conversation
MPS does not support float64, so casting on device made get_peft_model fail for FRoD when the model is on MPS.
|
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 #4042.
_calculate_frod_u_and_lambdacast the base weight andVto float64 before moving them to CPU. On MPS that cast fails, since MPS has no float64, soget_peft_modelwith FRoD crashed for models on MPS. This moves the tensors to CPU first and casts there, which gives the same result on every device.Added
test_frod_on_mps, which only runs on MPS: with default initialization the adapted model must reproduce the base model's outputs. It fails on main with the float64TypeErrorand passes with this change. On MPS, all FRoD cases intest_custom_models.pythat failed before now pass, andtest_frod.pypasses on CPU and MPS.