lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
7.43k stars 720 forks source link

highresfix button breaks when this setting is ON: "Save a copy of image before applying highres fix" (->unsupported ScalarType BFloat16) #1662

Open tazztone opened 2 weeks ago

tazztone commented 2 weeks ago

after having generated an image and using highresfix button image the upscale will not even start and say: TypeError: Got unsupported ScalarType BFloat16

disabling this setting makes it work again: image Save a copy of image before applying highres fix i tried with it ON and OFF a few times and it always happened only when ON.

(BTW: it shouldn't try to save an image when using the button in the first place, because it has been saved already at this point. the setting should only apply to when hiresfix is being done when this is ON: image otherwise there are duplicates.

full error:

Traceback (most recent call last):
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules_forge\main_thread.py", line 30, in work
    self.result = self.func(*self.args, **self.kwargs)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\txt2img.py", line 98, in txt2img_upscale_function
    processed = processing.process_images(p)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\processing.py", line 816, in process_images
    res = process_images_inner(p)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\processing.py", line 959, in process_images_inner
    samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\processing.py", line 1346, in sample
    return self.sample_hr_pass(samples, decoded_samples, seeds, subseeds, subseed_strength, prompts)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\processing.py", line 1374, in sample_hr_pass
    save_intermediate(samples, i)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\processing.py", line 1363, in save_intermediate
    image = sd_samplers.sample_to_image(image, index, approximation=0)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\sd_samplers_common.py", line 86, in sample_to_image
    return single_sample_to_image(samples[index], approximation)
  File "C:\_stability_matrix\Data\Packages\stable-diffusion-webui-forge\modules\sd_samplers_common.py", line 74, in single_sample_to_image
    x_sample = 255. * np.moveaxis(x_sample.cpu().numpy(), 0, 2)
TypeError: Got unsupported ScalarType BFloat16
Got unsupported ScalarType BFloat16
DenOfEquity commented 2 weeks ago

This is/will be fixed by #1465 (on-hold). The function for the highresfix button does set an override for the 'Save a copy ...' setting, but that override is not being applied.