Comfy-Org / Comfy-Org/ComfyUI

Flux nodes work fine in workflow from localhost but causes error when same workflow used in API

Open
#4,344 13 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Expected Behavior

Image created

### Actual Behavior

Error:

model weight dtype torch.float8_e4m3fn, manual cast: torch.float16
model_type FLOW
Using xformers attention in VAE
Using xformers attention in VAE
Requested to load FluxClipModel_
Loading 1 new model
Requested to load Flux
Loading 1 new model
100%|██████████████████████████████████████████████████████████████████████████████| 6/6 [01:32<00:00, 15.39s/it]
Using xformers attention in VAE
Using xformers attention in VAE
Requested to load AutoencoderKL
Loading 1 new model
!!! Exception during processing!!! Given groups=1, weight of size [4, 4, 1, 1], expected input[1, 16, 160, 90] to have 4 channels, but got 16 channels instead
Traceback (most recent call last):
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\nodes.py", line 270, in decode
return (vae.decode(samples["samples"]), )
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\comfy\sd.py", line 322, in decode
pixel_samples[x:x+batch_number] = self.process_output(self.first_stage_model.decode(samples).to(self.output_device).float())
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\comfy\ldm\models\autoencoder.py", line 199, in decode
dec = self.post_quant_conv(z)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\comfy\ops.py", line 93, in forward
return super().forward(*args, **kwargs)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\conv.py", line 458, in forward
return self._conv_forward(input, self.weight, self.bias)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\conv.py", line 454, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [4, 4, 1, 1], expected input[1, 16, 160, 90] to have 4 channels, but got 16 channels instead

Prompt executed in 194.95 seconds

### Steps to Reproduce

Run workflow...
[Flux full checkpoint API test.json](https://github.com/user-attachments/files/16606291/Flux.full.checkpoint.API.test.json)

### Debug Logs

```powershell
got prompt
[rgthree] Using rgthree's optimized recursive execution.
model weight dtype torch.float8_e4m3fn, manual cast: torch.float16
model_type FLOW
Using xformers attention in VAE
Using xformers attention in VAE
Requested to load FluxClipModel_
Loading 1 new model
Requested to load FluxClipModel_
Loading 1 new model
clip missing: ['text_projection.weight']
Requested to load Flux
Loading 1 new model
100%|██████████████████████████████████████████████████████████████████████████████| 6/6 [01:37<00:00, 16.30s/it]
Using xformers attention in VAE
Using xformers attention in VAE
Requested to load AutoencodingEngine
Loading 1 new model
Prompt executed in 255.51 seconds
got prompt
[rgthree] Using rgthree's optimized recursive execution.
100%|██████████████████████████████████████████████████████████████████████████████| 6/6 [01:37<00:00, 16.31s/it]
Requested to load AutoencodingEngine
Loading 1 new model
Prompt executed in 106.29 seconds
got prompt
[rgthree] Using rgthree's optimized recursive execution.
model weight dtype torch.float8_e4m3fn, manual cast: torch.float16
model_type FLOW
Using xformers attention in VAE
Using xformers attention in VAE
Requested to load FluxClipModel_
Loading 1 new model
Requested to load Flux
Loading 1 new model
100%|██████████████████████████████████████████████████████████████████████████████| 6/6 [01:32<00:00, 15.39s/it]
Using xformers attention in VAE
Using xformers attention in VAE
Requested to load AutoencoderKL
Loading 1 new model
!!! Exception during processing!!! Given groups=1, weight of size [4, 4, 1, 1], expected input[1, 16, 160, 90] to have 4 channels, but got 16 channels instead
Traceback (most recent call last):
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\nodes.py", line 270, in decode
return (vae.decode(samples["samples"]), )
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\comfy\sd.py", line 322, in decode
pixel_samples[x:x+batch_number] = self.process_output(self.first_stage_model.decode(samples).to(self.output_device).float())
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\comfy\ldm\models\autoencoder.py", line 199, in decode
dec = self.post_quant_conv(z)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "C:\inetpub\wwwroot\ComfyUI\ComfyUI\comfy\ops.py", line 93, in forward
return super().forward(*args, **kwargs)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\conv.py", line 458, in forward
return self._conv_forward(input, self.weight, self.bias)
File "C:\inetpub\wwwroot\ComfyUI\python_embeded\lib\site-packages\torch\nn\modules\conv.py", line 454, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [4, 4, 1, 1], expected input[1, 16, 160, 90] to have 4 channels, but got 16 channels instead

Prompt executed in 194.95 seconds
```

### Other

To confirm, I can run this workflow myself in the web interface without any issues. But when I copy the workflow to an API I get the above error. Some how the vae does not appear to be matching I believe.. 16 channels instead of 4.. I don't understand how this works in the web interface but not through the API.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.