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

Problem while trying to generate 1024 by 1024 image #20

Open
dfav22 opened this issue Jul 7, 2024 · 6 comments
Open

Problem while trying to generate 1024 by 1024 image #20

dfav22 opened this issue Jul 7, 2024 · 6 comments

Comments

@dfav22
Copy link

dfav22 commented Jul 7, 2024

Hi, when I try to use this method (on Forge webui) with 1024x1024 resolution (needed by SDXL) it throws this error:

File ".../extensions/CharacteristicGuidanceWebUI/scripts/CharaIte.py", line 361, in compute_correction_direction
dxs_cond_part = torch.cat( [*( [(h - 1) * dxs[:,None,...]]*num_x_in_cond )], axis=1 ).view( (dxs.shape[0]*num_x_in_cond, *dxs.shape[1:]) )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: torch.cat(): expected a non-empty list of Tensors
torch.cat(): expected a non-empty list of Tensors

Which is caused by num_x_in_cond being zero. Any ideas on how to fix that?

@dfav22 dfav22 changed the title SDXL problem Problem while trying to generate 1024 by 1024 image Jul 7, 2024
@scraed
Copy link
Owner

scraed commented Jul 8, 2024

Hi, I can't reproduce this issue on 1024*1024 image. Could you provide the batch count, batch number, and the prompt (especially special tokens) you are using?

@dfav22
Copy link
Author

dfav22 commented Jul 8, 2024

Hi,I use batch number of two and batch size of one. My prompt is: "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k".

@dfav22
Copy link
Author

dfav22 commented Jul 8, 2024

Maybe it has to do something with low vram flag I use?

@scraed
Copy link
Owner

scraed commented Jul 9, 2024

yes, I think it is related the low vram flag. Seems the positive and negative peompts aren't envalued simultaneously in this case. But I still can't reproduce it even with low vram flag on my machine. May I ask how large vram do you have? I might need to impose some hard vram limit on my machine to reproduce it.

PS. It would nice if you could print out the shape of the tensor x_in, dxs and uncond during evaluation. As num_x_in_cond is computed from their shape by
num_x_in_cond = len(x_in[:-uncond.shape[0]])//len(dxs)

@dfav22
Copy link
Author

dfav22 commented Jul 9, 2024

Hi, my VRAM size is 4 GB.

Here are sizes which cause an error:
UNCOND:torch.Size([1, 77, 2048])
X_IN:torch.Size([1, 4, 128, 128])
DXS:torch.Size([1, 4, 128, 128])

Notably, running this on CPU makes it work. Here are sizes which are printed out while running on cpu:
UNCOND:torch.Size([1, 77, 2048])
X_IN:torch.Size([2, 4, 128, 128])
DXS:torch.Size([1, 4, 128, 128])

@scraed
Copy link
Owner

scraed commented Jul 9, 2024

Bingo! X_IN:torch.Size([1, 4, 128, 128]) is causing the problem. The first dimension is usually 2. I think it is the vram saving mechanism of forge. Will try to figure out a way to fix it.

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