Closed winthropharvey closed 1 year ago
Can you see the following outputs?
daam run with context_size= 154
If the token is less than or equal to 75, context_size is 77. If the token is greater than 75 (and less than or equal to 150), context_size would be 154. If the prompt contains strange characters, the number of tokens may not be correctly ascertained, so there is a bug that causes it to be shifted. (In this case, the attention text will also be shifted, resulting in incorrect results.)
If context_size is 154 (or 231) and you get the above error, there may be another bug. Is it possible to share prompts and generation settings?
With some more testing I have found that the bug seems to be with the use of embeds, the script isn't correctly using the embed sizes so if the embed size causes the prompt to become larger than a given window size, it can cause a mismatch.
Here is a prompt that produces the bug
an illustration of a cat in sunglasses, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, an illustration of a Embed50 in sunglasses,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,an illustration of a cat in sunglasses,,,
The attention text is sunglasses.
This causes the script to try and run with context_size 154, which is too small because the actual size of the prompt is 169/225 tokens due to the embed size (so it should be context size 231).
Embed50 can be any embedding with vector size 50, you can make one and not train it to test.
Thank you for your reporting. I wasn't concerned about embedding, but I'm pretty sure that doesn't work correctly because it expands to multiple tokens. I'll try to fix it.
Fixed.
Traceback (most recent call last): File "C:\Users\Wint\Desktop\AIDiffusion\stable-diffusion-webui\modules\script_callbacks.py", line 121, in before_image_saved_callback c.callback(params) File "C:\Users\Wint\Desktop\AIDiffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-daam\scripts\daam_script.py", line 207, in handle_before_image_saved before_image_saved_handler(params) File "C:\Users\Wint\Desktop\AIDiffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-daam\scripts\daam_script.py", line 108, in
before_image_saved_handler = lambda params : self.before_image_saved(params)
File "C:\Users\Wint\Desktop\AIDiffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-daam\scripts\daam_script.py", line 162, in before_image_saved
global_heat_map = self.tracer.compute_global_heat_map(styled_prompot, batch_pos)
File "C:\Users\Wint\Desktop\AIDiffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-daam\scripts\daam\trace.py", line 180, in compute_global_heat_map
maps = torch.stack([torch.stack(x, 0) for x in all_merges], dim=0)
RuntimeError: stack expects a non-empty TensorList
Consistently errors whenever the prompt is more than 75 tokens.