-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix cpu_offload_with_hook code snippet #1047
Conversation
src/accelerate/big_modeling.py
Outdated
hook_3 = cpu_offload_with_hook(model_3, cuda_device, prev_module_hook=hook_2) | ||
_, hook_1 = cpu_offload_with_hook(model_1, cuda_device) | ||
_, hook_2 = cpu_offload_with_hook(model_2, cuda_device, prev_module_hook=hook_1) | ||
_, hook_3 = cpu_offload_with_hook(model_3, cuda_device, prev_module_hook=hook_2) |
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.
Or we can assign model_1
etc in the left-hand side if that's clearer.
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.
let's put the model yes!
The documentation is not available anymore as the PR was closed or merged. |
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.
Thanks for the fix!
src/accelerate/big_modeling.py
Outdated
hook_3 = cpu_offload_with_hook(model_3, cuda_device, prev_module_hook=hook_2) | ||
_, hook_1 = cpu_offload_with_hook(model_1, cuda_device) | ||
_, hook_2 = cpu_offload_with_hook(model_2, cuda_device, prev_module_hook=hook_1) | ||
_, hook_3 = cpu_offload_with_hook(model_3, cuda_device, prev_module_hook=hook_2) |
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.
let's put the model yes!
Minor fix in the code example for
cpu_offload_with_hook