-
Notifications
You must be signed in to change notification settings - Fork 6.5k
set is_sequential_cpu_offload = True only when some component is on cpu and has AlignDevicesHook simultaneously
#8750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7ee9465
0b86e90
ecc3032
eebed22
9c87a4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,7 +376,7 @@ def module_is_sequentially_offloaded(module): | |
| if not is_accelerate_available() or is_accelerate_version("<", "0.14.0"): | ||
| return False | ||
|
|
||
| return hasattr(module, "_hf_hook") and ( | ||
| return hasattr(module, "_hf_hook") and hasattr(module,'device') and module.device.type == "cpu" and ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the expansion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. manually add a hook to the model and attempting to move it to another GPU does not mean that |
||
| isinstance(module._hf_hook, accelerate.hooks.AlignDevicesHook) | ||
| or hasattr(module._hf_hook, "hooks") | ||
| and isinstance(module._hf_hook.hooks[0], accelerate.hooks.AlignDevicesHook) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks alright to me.