wcde / sd-webui-refiner

Webui Extension for integration refiner in generation process
161 stars 12 forks source link

batch size > 1 causes script to fail #23

Closed zero01101 closed 11 months ago

zero01101 commented 11 months ago

hi there :)

setting a batch size greater than 1 causes the following error response

*** Error executing callback cfg_denoiser_callback for /home/djabacus/stable-diffusion-webui/extensions/sd-webui-refiner/scripts/refiner.py
    Traceback (most recent call last):
      File "/home/djabacus/stable-diffusion-webui/modules/script_callbacks.py", line 195, in cfg_denoiser_callback
        c.callback(params)
      File "/home/djabacus/stable-diffusion-webui/extensions/sd-webui-refiner/scripts/refiner.py", line 110, in denoiser_callback
        params.text_cond['vector'] = torch.cat((params.text_cond['vector'][:, :2304], self.c_ae), 1)
    RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 3 but got size 1 for tensor number 1 in the list.

(for a batch size of 3, for example) on each refiner step, and the refiner is visibly not applied after comparing with a generation of the same seed simply with the refiner extension disabled

the regression seems to have been introduced in https://github.com/wcde/sd-webui-refiner/commit/f0b9713218c9b99c01bb5b8a5bb2b3f15e1db392 but i genuinely don't know anything about the underlying tensor stuff :( i tried trivially changing the 1 at the end of the .cat() to params.text_cond['vector'].shape[0] but that returned

IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 3)

thanks!

wcde commented 11 months ago

@zero01101 fixed

zero01101 commented 11 months ago

well that was zippy :D confirmed working great, thanks again!