Description
Is there an existing issue for this?
- I have searched the existing issues and checked the recent builds/commits
What happened?
Using hires fix with the FP16 SDXL fixed VAE causes RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same
, understandable maybe since it's mixing precision.
https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/tree/main
However switching VAE to Automatic, getting a NaN error, letting it fix itself with Automaticlly revert VAE to 32-bit floats
, then selecting the fixed FP16 VAE again lets it work as expected.
This makes sense if precision is all switched to FP32 after the NaN fix, unsure if that's the case, but still might or might not entirely be the desired behavior, especially trying to get the fixed VAE to work right away with hires fix.
Steps to reproduce the problem
- Use hiresfix with fixed FP16 SDXL VAE
- Get
RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same
error - Set VAE to Automatic
- Get NaN error, let it sort itself using
Automaticlly revert VAE to 32-bit floats
- Load fixed FP16 SDXL VAE again
- Works as intended
What should have happened?
FP16 SDXL VAE works right away with hires fix.
Version or Commit where the problem happens
What Python version are you running on ?
Python 3.10.x
What platforms do you use to access the UI ?
Windows
What device are you running WebUI on?
Nvidia GPUs (RTX 20 above)
Cross attention optimization
xformers
What browsers do you use to access the UI ?
Mozilla Firefox
Command Line Arguments
--xformers --no-download-sd-model --no-hashing --ad-no-huggingface
List of extensions
Console logs
Traceback (most recent call last):
File "E:\variousAI\stable-diffusion-webui\modules\call_queue.py", line 58, in f
res = list(func(*args, **kwargs))
File "E:\variousAI\stable-diffusion-webui\modules\call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "E:\variousAI\stable-diffusion-webui\modules\txt2img.py", line 62, in txt2img
processed = processing.process_images(p)
File "E:\variousAI\stable-diffusion-webui\modules\processing.py", line 677, in process_images
res = process_images_inner(p)
File "E:\variousAI\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 "E:\variousAI\stable-diffusion-webui\modules\processing.py", line 794, 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 "E:\variousAI\stable-diffusion-webui\modules\processing.py", line 1109, in sample
samples = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(decoded_samples))
File "E:\variousAI\stable-diffusion-webui\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "E:\variousAI\stable-diffusion-webui\repositories\generative-models\sgm\models\diffusion.py", line 127, in encode_first_stage
z = self.first_stage_model.encode(x)
File "E:\variousAI\stable-diffusion-webui\repositories\generative-models\sgm\models\autoencoder.py", line 321, in encode
return super().encode(x).sample()
File "E:\variousAI\stable-diffusion-webui\repositories\generative-models\sgm\models\autoencoder.py", line 308, in encode
h = self.encoder(x)
File "E:\variousAI\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "E:\variousAI\stable-diffusion-webui\repositories\generative-models\sgm\modules\diffusionmodules\model.py", line 576, in forward
hs = [self.conv_in(x)]
File "E:\variousAI\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "E:\variousAI\stable-diffusion-webui\extensions-builtin\Lora\networks.py", line 376, in network_Conv2d_forward
return torch.nn.Conv2d_forward_before_network(self, input)
File "E:\variousAI\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "E:\variousAI\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same
Additional information
No response