Skip to content
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

The parameter of stable diffusion unet is wrong #289

Open
FlyHighest opened this issue Dec 18, 2023 · 1 comment
Open

The parameter of stable diffusion unet is wrong #289

FlyHighest opened this issue Dec 18, 2023 · 1 comment

Comments

@FlyHighest
Copy link

Describe the bug
I'm using torchinfo summary to see the number of parameters of UNet in Stable-Diffusion-2, but find it unmatch what is reported publicly.

To Reproduce

from diffusers import StableDiffusionPipeline
pipe=StableDiffusionPipeline.from_pretrained('stabilityai/stable-diffusion-2-1')
pipe.to('cuda')
from torchinfo import summary
summary(pipeline.unet,[[1,4,32,32],[1],[1,77,1024]])

Expected behavior
The total parameter should be 0.8B. But it shows 2B.

Additional context
The torchinfo is 1.8.0. diffusers is 0.24.0.

@6DammK9
Copy link

6DammK9 commented Sep 25, 2024

From my findings, currently UNet2DConditionModel is inaccurate, meanwhile other models (SD3, Flux, Auraflow, Hunyuan-DiT) are accurate.

Btw common approach here:

pytorch_total_params = sum(p.numel() for p in pipeline.unet.parameters())
#865910724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants