-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Device map] nn.Parameter don't have children #747
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
left a comment
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.
What's a reproducer? I'm not sure how you get to a parameter here since we only apply the children method.
Haha that was fast. Here a repro: from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
StableDiffusionSafetyChecker._no_split_modules = ["CLIPEncoderLayer"]
pipe = StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker', device_map='auto')(sorry, it's 1GB of download) |
|
Which branch should I check? On main I just get an error telling me device_map auto is not supported yet |
|
Ah sorry just updated it above, can you try: from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
StableDiffusionSafetyChecker._no_split_modules = ["CLIPEncoderLayer"]
pipe = StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker', device_map='auto') |
sgugger
left a comment
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 reproducer! The function is indeed used with some parameters inside accelerate, so this is needed.
Just suggested another test.
Co-authored-by: Sylvain Gugger <[email protected]>
|
Awesome! Can I merge after one ✔️ here or wait for another reviewer? |
|
Nope, you can go ahead and merge! |
* [Device map] nn.Parameter don't have children * Update src/accelerate/utils/modeling.py Co-authored-by: Sylvain Gugger <[email protected]> Co-authored-by: Sylvain Gugger <[email protected]>
This is needed to allow to use the "device_map" for models that have
nn.Parameterat the top level, such as the safety checker ofdiffusers: https://github.com/huggingface/diffusers/pull/772/files#r990269773