Repository navigation
StableDiffusionPipeline produces nans for SD2.1 (Mac, cpu device) #6136
Description
Activity
Hi @UmerHA I was able to reproduce this. Using the MPS backend seems to resolve the issue
pipe.to("mps"). Although I will look into why this is happening on CPU.Reacted by UmerHAcc: @pcuenca
Hi @UmerHA you are right, the pipeline is unstable using CPU. I tried to isolate a minimal reproduction snippet but couldn't. In the meantime, is there any reason why you are using the cpu instead of the
mpsdevice?Hi @pcuenca, for educational purposes only. I created a very slim version of diffusers without all optimizations and wanted to compare results with the original diffusers.
Understood. What I saw is that calling
self.conv_in(sample)produced different results after movingsampleandconv_intomps. However, attempting to reproduce the same case in an isolated script worked fine, using the same convolution weights (I saved them to a numpy array).github-actions commented
on Jan 10, 2024 on Jan 10, 2024 – with GitHub ActionsContributorMore actionsThis issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
- addedstaleIssues that haven't received updatesIssues that haven't received updates
on Jan 10, 2024 This is not fixed yet, keeping open in case someone from the community can come up with a workaround.
- changed the title
[-]`StableDiffusionPipeline` produces `nans` for SD2.1[/-][+]`StableDiffusionPipeline` produces `nans` for SD2.1 (Mac, cpu device)[/+]on Jan 18, 2024 - removedstaleIssues that haven't received updatesIssues that haven't received updates
on Jan 18, 2024 github-actions commented
on Feb 12, 2024 on Feb 12, 2024 – with GitHub ActionsContributorMore actionsThis issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
- addedstaleIssues that haven't received updatesIssues that haven't received updates
on Feb 12, 2024 2 remaining items
- addedhelp wantedExtra attention is neededExtra attention is needed
on Feb 21, 2024 github-actions commented
on Mar 17, 2024 on Mar 17, 2024 – with GitHub ActionsContributorMore actionsThis issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
- addedstaleIssues that haven't received updatesIssues that haven't received updates
on Mar 17, 2024 - removedstaleIssues that haven't received updatesIssues that haven't received updates
on Mar 17, 2024 On the latest
diffusers, on Mac M2 and M3, I didn't experience this.Will keep this open as it seems to be an edge case.
github-actions commented
on Apr 11, 2024 on Apr 11, 2024 – with GitHub ActionsContributorMore actionsThis issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
- addedstaleIssues that haven't received updatesIssues that haven't received updates
on Apr 11, 2024 Gentle bump requesting status of this Issue. Got my M3 recently so can try and help out with some of the Mac issues :)
- removedstaleIssues that haven't received updatesIssues that haven't received updates
on Nov 19, 2024 github-actions commented
on Dec 13, 2024 on Dec 13, 2024 – with GitHub ActionsContributorMore actionsThis issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
- addedstaleIssues that haven't received updatesIssues that haven't received updates
on Dec 13, 2024

Describe the bug
StableDiffusionPipelineproducesnansfor SD2.1.The issue seems to be in the
pipe.unet.conv_in. Printing the mean / std forsamplebefore and afterconv_ingives:Reproduction
Make sure I'm using the latest official diffusers version
Code to reproduce
Output:
Logs
No response
System Info
diffusersversion: 0.24.0Who can help?
Questions on pipelines > Stable Diffusion: @yiyixuxu @DN6 @sayakpaul @patrickvonplaten