FIX VeRA failure on multiple GPUs #2163
Open
+12
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The shared buffers
vera_A
andvera_B
could be on the wrong device when using multiple GPUs, resulting in an error. This PR moves the them to the correct device to fix the error.Example of a failing run: https://github.com/huggingface/peft/actions/runs/11396317278/job/31709933958
Since these buffers are shared, I chose not to move the whole buffer to the device. Instead, when we create the slices from those buffers during
forward
, I move the devices only there. This could be inefficient in terms of runtime, but IIUC, the alternative would be to create new copies of these buffers per device, using more memory.The failing tests were introduced in #2076 but the error was already there beforehand.
I did not discover these failing tests earlier because we had a concurrent error caused by a transformers issue which looked very similar and I wrongly assumed that the VeRA error was caused by the same issue. But now that the issue has been fixed, the error still persists, prompting me to investigate.