Fix LoRA offload detection for alignment hooks (#10914)#14271
Open
Bekhouche wants to merge 2 commits into
Open
Fix LoRA offload detection for alignment hooks (#10914)#14271Bekhouche wants to merge 2 commits into
Bekhouche wants to merge 2 commits into
Conversation
Only treat hooks that actively offload weights as sequential CPU offloading, preserving alignment-only hooks while retaining genuine offload handling. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Fixes #10914.
LoRA loading previously treated every Accelerate
AlignDevicesHookas evidence that sequential CPU offloading was enabled. Alignment-only hooks, such as those installed for quantized models, were therefore removed and followed by an unintended call toenable_sequential_cpu_offload(). This could move a GPU-resident model to CPU and significantly slow inference.This change:
AlignDevicesHookinstances withoffload=Trueas sequential CPU offloading;This updates the approach from the stale attempt in #8750 by checking the hook's explicit offload state instead of inferring it only from the hook type.
Tests