kijai / ComfyUI-SUPIR

SUPIR upscaling wrapper for ComfyUI
Other
1.2k stars 66 forks source link

Error occurred when executing SUPIR_conditioner: expected scalar type Float but found Half #90

Open manyart opened 3 months ago

manyart commented 3 months ago

got prompt [rgthree] Using rgthree's optimized recursive execution. [rgthree] First run patching recursive_output_delete_if_changed and recursive_will_execute. [rgthree] Note: If execution seems broken due to forward ComfyUI changes, you can disable the optimization from rgthree settings in ComfyUI. Diffusion using fp16 making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Attempting to load SUPIR model: [E:\stable-diffusion-webui\models\Stable-diffusion\SUPIR\SUPIR-v0Q.ckpt] Loaded state_dict from [E:\stable-diffusion-webui\models\Stable-diffusion\SUPIR\SUPIR-v0Q.ckpt] Attempting to load SDXL model: [E:\stable-diffusion-webui\models\Stable-diffusion\SDXL\juggernautXL_v9Rundiffusionphoto2.safetensors] Loaded state_dict from [E:\stable-diffusion-webui\models\Stable-diffusion\SDXL\juggernautXL_v9Rundiffusionphoto2.safetensors] Loading first clip model from SDXL checkpoint Loading second clip model from SDXL checkpoint Encoder using bf16 [Tiled VAE]: input_size: torch.Size([1, 3, 1536, 1536]), tile_size: 512, padding: 32 [Tiled VAE]: split to 3x3 = 9 tiles. Optimal tile size 512x512, original tile size 512x512 [Tiled VAE]: Executing Encoder Task Queue: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 819/819 [00:05<00:00, 159.19it/s] [Tiled VAE]: Done in 6.252s, max VRAM alloc 657.002 MB [Tiled VAE]: input_size: torch.Size([1, 4, 192, 192]), tile_size: 64, padding: 11 [Tiled VAE]: split to 3x3 = 9 tiles. Optimal tile size 64x64, original tile size 64x64 [Tiled VAE]: Executing Decoder Task Queue: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1107/1107 [00:07<00:00, 147.05it/s] [Tiled VAE]: Done in 7.800s, max VRAM alloc 1271.065 MB Encoder using bf16 [Tiled VAE]: input_size: torch.Size([1, 3, 1536, 1536]), tile_size: 512, padding: 32 [Tiled VAE]: split to 3x3 = 9 tiles. Optimal tile size 512x512, original tile size 512x512 [Tiled VAE]: Executing Encoder Task Queue: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 819/819 [00:03<00:00, 240.62it/s] [Tiled VAE]: Done in 3.711s, max VRAM alloc 689.002 MB captions: [['']] Batch captioning !!! Exception during processing !!! Traceback (most recent call last): File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR\nodes_v2.py", line 555, in condition _c, _uc = SUPIR_model.conditioner.get_unconditional_conditioning(cond, uncond) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR\sgm\modules\encoders\modules.py", line 187, in get_unconditional_conditioning c = self(batch_c) ^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR\sgm\modules\encoders\modules.py", line 208, in forward emb_out = embedder(batch[embedder.input_key]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR\sgm\modules\encoders\modules.py", line 568, in forward z = self.encode_with_transformer(tokens.to(self.device)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR\sgm\modules\encoders\modules.py", line 580, in encode_with_transformer x = self.text_transformer_forward(x, attn_mask=self.model.attn_mask) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR\sgm\modules\encoders\modules.py", line 612, in text_transformer_forward x = r(x, attn_mask=attn_mask) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\open_clip\transformer.py", line 241, in forward x = q_x + self.ls_1(self.attention(q_x=self.ln_1(q_x), k_x=k_x, v_x=v_x, attn_mask=attn_mask)) ^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\open_clip\transformer.py", line 20, in forward x = F.layer_norm(x.to(torch.float32), self.normalized_shape, self.weight, self.bias, self.eps) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\functional.py", line 2543, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: expected scalar type Float but found Half

Prompt executed in 70.55 seconds

kijai commented 3 months ago

With what kind of workflow? I can't seem to be able to reproduce this error at all.

manyart commented 3 months ago

With what kind of workflow? I can't seem to be able to reproduce this error at all.

I'm just running your base example workflow

manyart commented 3 months ago

With what kind of workflow? I can't seem to be able to reproduce this error at all.

ok, i am just switch diffusion_dtype from auto to fp32 and it seems to work now but very slow

kijai commented 3 months ago

I found the bug, it was in the old model loader that was still in the default workflow. Fixed the bug and also updated the example workflow with the new model loader and bit better default settings.