Skip to content

FIX Move FRoD weights to CPU before casting to float64 - #4044

Closed
Alex-Wengg wants to merge 1 commit into
huggingface:mainfrom
Alex-Wengg:fix/frod-mps-float64
Closed

Alex-Wengg wants to merge 1 commit into
huggingface:mainfrom
Alex-Wengg:fix/frod-mps-float64

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Contributor

Fixes #4042.

_calculate_frod_u_and_lambda cast the base weight and V to float64 before moving them to CPU. On MPS that cast fails, since MPS has no float64, so get_peft_model with 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 float64 TypeError and passes with this change. On MPS, all FRoD cases in test_custom_models.py that failed before now pass, and test_frod.py passes on CPU and MPS.

MPS does not support float64, so casting on device made get_peft_model
fail for FRoD when the model is on MPS.
@github-actions

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.

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.

FRoD fails on MPS: weights are cast to float64 before moving to CPU

1 participant