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

AssertionError #17

Open
Enferlain opened this issue May 1, 2023 · 4 comments
Open

AssertionError #17

Enferlain opened this issue May 1, 2023 · 4 comments

Comments

@Enferlain
Copy link

Wanted to try it today for something, returns this error when generating. Worked fine like a week ago I think

Traceback (most recent call last):
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/processing.py", line 626, in process_images_inner
    c = get_conds_with_caching(prompt_parser.get_multicond_learned_conditioning, prompts, p.steps, cached_c)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/processing.py", line 570, in get_conds_with_caching
    cache[1] = function(shared.sd_model, required_prompts, steps)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/prompt_parser.py", line 205, in get_multicond_learned_conditioning
    learned_conditioning = get_learned_conditioning(model, prompt_flat_list, steps)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/modules/prompt_parser.py", line 140, in get_learned_conditioning
    conds = model.get_learned_conditioning(texts)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 669, in get_learned_conditioning
    c = self.cond_stage_model(c)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1215, in _call_impl
    hook_result = hook(self, input, result)
  File "/content/drive/MyDrive/stable-diffusion-webui-colab/stable-diffusion-webui/extensions/sd-webui-cutoff/scripts/cutoff.py", line 142, in hook
    assert tensor.shape == t.shape
AssertionError
@hnmr293
Copy link
Owner

hnmr293 commented May 1, 2023

Thank you for your feedback.

  1. Let me know your generation information, especially the prompt, the negative prompt and cutoff tokens.
  2. Let me know your WebUI version - A1111, vladmandic or others, and its commit number.

@cong-bao
Copy link

@hnmr293
I'm sorry I used Machine translation, but it may not be very clear

Hello, I have also experienced this situation.
I found that this error occurs when the length of my prompt or Negative prompt exceeds 150.

I used the content of Negative prompt when testing prompt

Negative prompt:
((((ugly)))),lowres, bad anatomy, [:((No more than one thumb, index finger, middle finger, ring finger and little finger on one hand),(mutated hands and fingers:1.5 ), fused ears, one hand with more than 5 fingers, one hand with less than 5 fingers,):0.5] bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, Missing limbs, three arms, bad feet, text font ui, signature, blurry, malformed hands, long neck, mutated hands and fingers :1.5).(long body :1.3),(mutation ,poorly drawn :1.2), disfigured, malformed, mutated, multiple breasts, yaoi, three legs,

Finally, this is the version of the extension I am using.

IrisRainbowNeko/DreamArtist-sd-webui-extension@12f8077
KohakuBlueleaf/a1111-sd-webui-haku-img@5069e2b
KohakuBlueleaf/a1111-sd-webui-lycoris@4b005e3
DominikDoom/a1111-sd-webui-tagcomplete@1cb4fc8
pkuliyi2015/multidiffusion-upscaler-for-automatic1111@70b3c5e
nonnonstop/sd-webui-3d-open-pose-editor@f2d5aac
Mikubill/sd-webui-controlnet@d8551e4
3a073e9
zanllp/sd-webui-infinite-image-browsing@55d154e
Physton/sd-webui-prompt-all-in-one@937e45b
d8ahazard/sd_dreambooth_extension@b396af2
toriato/stable-diffusion-webui-wd14-tagger@3ba3a73

@aigias
Copy link

aigias commented Jul 25, 2023

I once found the same issue. In my case, it was caused by a certain prompt. After I removed it, problem resolved.
I guess it's not because that certain words but something wrong was pasted in the prompt box which is unseen. You can try remove each tag and regenerate the image to see if it can be fixed.
This is what I found, or they're not the same cause.

@greasyi
Copy link

greasyi commented Jan 11, 2024

Yes, sometimes just 1 token is the difference between getting an error or not. I don't think I had any other plugins running. Options for the plugin don't seem make a difference, once a prompt is "bad", it will repro 100% of the time as long as there is 1 target token which matches 1 thing in the prompt.

If I add 5-10 commas to the prompt, the issue goes away.

AssertionError: tensor and t must have same shape
    tensor: torch.Size([154, 768])
     t:torch.Size([77, 768])

The numbers 77 and 154 are suspicious to me, because multiples of 75 are about where prompts get split up. Could be that a mis-match in pre- and post-cutoff prompt lengths is the issue.

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

5 participants