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

[Issue]: Benchmark throwing errors when switching model to different model type #3161

Closed
2 tasks done
Tillerz opened this issue May 24, 2024 · 1 comment
Closed
2 tasks done

Comments

@Tillerz
Copy link

Tillerz commented May 24, 2024

Issue Description

when I run the benchmark with SD1.5, and then again with SDXL, SD.Next throws a lot of errors for SXDL and doesn't do anything. If I first run SDXL and then SD1.5, the same. I can restart SD.next and run SD1.5 benchmark without error, restart it again and run SDXL benchmark without error.

Possibly something like the prompt caching is interfering here?

Version Platform Description

WSL-2, Win11

Relevant log output

14:55:01-931077 DEBUG    Diffuser pipeline: StableDiffusionPipeline task=DiffusersTaskType.TEXT_2_IMAGE batch=1/1x1 set={'prompt_embeds':
                         torch.Size([1, 77, 2048]), 'negative_prompt_embeds': torch.Size([1, 77, 2048]), 'guidance_scale': 15.0,
                         'num_inference_steps': 20, 'eta': 1.0, 'guidance_rescale': 0.7, 'output_type': 'latent', 'width': 512, 'height':
                         512, 'parser': 'Full parser'}
14:55:01-938147 DEBUG    Sampler: sampler="Euler a" config={'num_train_timesteps': 1000, 'beta_start': 0.00085, 'beta_end': 0.012,
                         'beta_schedule': 'scaled_linear', 'prediction_type': 'epsilon', 'rescale_betas_zero_snr': False,
                         'timestep_spacing': 'leading'}
Progress ?it/s                                              0% 0/20 00:00 ? Base
14:55:02-001562 ERROR    Processing: args={'prompt_embeds': tensor([[[-3.8203, -2.3984,  4.2031,  ...,  0.1333,  0.4436, -0.2432],
                                  [-0.3086,  0.0493, -0.1787,  ...,  0.1885,  0.2786,  0.2222],
                                  [-1.1934,  0.5762, -0.2339,  ...,  1.2129, -0.2021, -0.3577],
                                  ...,
                                  [-0.0967,  0.7129, -0.1975,  ..., -0.7070,  1.1299,  1.1602],
                                  [-0.0812,  0.7148, -0.2534,  ..., -0.7793,  0.9316,  1.1914],
                                  [-0.1299,  0.6274, -0.2267,  ..., -0.6494,  1.2090,  1.0352]]],
                                device='cuda:0', dtype=torch.float16), 'negative_prompt_embeds': tensor([[[-3.8203, -2.3984,  4.2031,  ...,
                         0.1333,  0.4436, -0.2432],
                                  [ 0.1702,  0.5649,  2.3184,  ..., -1.7305,  1.9375, -1.0293],
                                  [ 0.8711,  1.4121,  1.7031,  ..., -0.6777,  1.1064,  0.4819],
                                  ...,
                                  [ 0.2856,  0.1072, -0.0791,  ...,  0.0754,  0.2136,  0.9551],
                                  [ 0.2856,  0.1211, -0.0730,  ...,  0.0415,  0.1313,  0.9951],
                                  [ 0.3125,  0.1519, -0.0571,  ...,  0.1489,  0.2529,  1.0762]]],
                                device='cuda:0', dtype=torch.float16), 'guidance_scale': 15.0, 'generator': [<torch._C.Generator object at
                         0x7f3a1b582010>], 'callback_on_step_end': <function diffusers_callback at 0x7f3a474f09d0>,
                         'callback_on_step_end_tensor_inputs': ['latents', 'prompt_embeds', 'negative_prompt_embeds'],
                         'num_inference_steps': 20, 'eta': 1.0, 'guidance_rescale': 0.7, 'output_type': 'latent', 'width': 512, 'height':
                         512} mat1 and mat2 shapes cannot be multiplied (154x2048 and 768x320)
14:55:02-005809 ERROR    Processing: RuntimeError
╭─────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────╮
│ /home/tillerz/dev/modules/processing_diffusers.py:118 in process_diffusers                                                               │
│                                                                                                                                          │
│   117 │   │   #    base_args['image'] = set_latents(p)                                                                                   │
│ ❱ 118 │   │   output = shared.sd_model(**base_args) # pylint: disable=not-callable                                                       │
│   119 │   │   if isinstance(output, dict):                                                                                               │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py:115 in decorate_context                                   │
│                                                                                                                                          │
│   114 │   │   with ctx_factory():                                                                                                        │
│ ❱ 115 │   │   │   return func(*args, **kwargs)                                                                                           │
│   116                                                                                                                                    │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py:971 in __call__    │
│                                                                                                                                          │
│    970 │   │   │   │   # predict the noise residual                                                                                      │
│ ❱  971 │   │   │   │   noise_pred = self.unet(                                                                                           │
│    972 │   │   │   │   │   latent_model_input,                                                                                           │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/torch/nn/modules/module.py:1532 in _wrapped_call_impl                                │
│                                                                                                                                          │
│   1531 │   │   else:                                                                                                                     │
│ ❱ 1532 │   │   │   return self._call_impl(*args, **kwargs)                                                                               │
│   1533                                                                                                                                   │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/torch/nn/modules/module.py:1541 in _call_impl                                        │
│                                                                                                                                          │
│   1540 │   │   │   │   or _global_forward_hooks or _global_forward_pre_hooks):                                                           │
│ ❱ 1541 │   │   │   return forward_call(*args, **kwargs)                                                                                  │
│   1542                                                                                                                                   │
│                                                                                                                                          │
│                                                         ... 12 frames hidden ...                                                         │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/diffusers/models/attention_processor.py:522 in forward                               │
│                                                                                                                                          │
│    521 │   │                                                                                                                             │
│ ❱  522 │   │   return self.processor(                                                                                                    │
│    523 │   │   │   self,                                                                                                                 │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/diffusers/models/attention_processor.py:1266 in __call__                             │
│                                                                                                                                          │
│   1265 │   │                                                                                                                             │
│ ❱ 1266 │   │   key = attn.to_k(encoder_hidden_states)                                                                                    │
│   1267 │   │   value = attn.to_v(encoder_hidden_states)                                                                                  │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/torch/nn/modules/module.py:1532 in _wrapped_call_impl                                │
│                                                                                                                                          │
│   1531 │   │   else:                                                                                                                     │
│ ❱ 1532 │   │   │   return self._call_impl(*args, **kwargs)                                                                               │
│   1533                                                                                                                                   │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/torch/nn/modules/module.py:1541 in _call_impl                                        │
│                                                                                                                                          │
│   1540 │   │   │   │   or _global_forward_hooks or _global_forward_pre_hooks):                                                           │
│ ❱ 1541 │   │   │   return forward_call(*args, **kwargs)                                                                                  │
│   1542                                                                                                                                   │
│                                                                                                                                          │
│ /home/tillerz/dev/venv/lib/python3.10/site-packages/torch/nn/modules/linear.py:116 in forward                                            │
│                                                                                                                                          │
│   115 │   def forward(self, input: Tensor) -> Tensor:                                                                                    │
│ ❱ 116 │   │   return F.linear(input, self.weight, self.bias)                                                                             │
│   117                                                                                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: mat1 and mat2 shapes cannot be multiplied (154x2048 and 768x320)
14:55:02-272125 DEBUG    VAE load: type=taesd model=/home/tillerz/models/TAESD/taesd_decoder.pth
14:55:02-511637 INFO     Processed: images=0 time=5.36 its=0.00 memory={'ram': {'used': 8.94, 'total': 31.35}, 'gpu': {'used': 3.99,
                         'total': 23.99}, 'retries': 0, 'oom': 0}
14:55:02-519414 ERROR    SD-System-Info benchmark error: 1 results mismatch

Backend

Diffusers

Branch

Dev

Model

SD 1.5

Acknowledgements

  • I have read the above and searched for existing issues
  • I confirm that this is classified correctly and its not an extension issue
@vladmandic
Copy link
Owner

fixed.

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