raysers / Mflux-ComfyUI

Quick Mflux on ComfyUI
MIT License
32 stars 6 forks source link

The ControlNet support is broken #10

Open InformEthics opened 1 day ago

InformEthics commented 1 day ago

When using controlNet through the ControlNet Loader an image input is required on the Quick MFlux generation, otherwise there is error : 'NoneType' object has no attribute 'read'"

img2img and ControlNet are 2 different features and the possibility should be given to use them separately. Also there is no way to pass the controlnet-strength variable to MFlux

I propose to integrate the controlnet-strength slider into ControlNet Loader and give the possibility to pass Images from standard ComfyUI Image Loader node to ControlNet Loader! Or make the MFlux Load Image node more universal and integrate the ControlNet-Strength Slider into it

raysers commented 1 day ago

@InformEthics Thank you for your feedback. In the early versions of this plugin, ControlNet was indeed designed as an integrated feature, as you mentioned. However, after adding the image-to-image functionality, I separated the image and strength parameters into standalone nodes, resulting in the current implementation.

What you mentioned about ControlNet and img2img being different features is true—they should ideally be handled independently. In conventional workflows, ControlNet and img2img are indeed distinct functionalities. However, in mflux, the img2img mechanism differs from the mainstream img2img denoising principle. It also uses strength, which overlaps with mflux ControlNet. This overlap was the main reason behind my redesign—to avoid redundant code. My recent tests have also confirmed this. When running the mflux ControlNet workflow, the MFlux Load Image node’s strength parameter affects ControlNet by providing the ControlNet_strength value. As for the 'NoneType' object has no attribute 'read' error, while it does occur, it shouldn’t impact usability.

Additionally, using the standard ComfyUI Image Loader to provide images for mflux is currently not feasible. This is because the node passes PyTorch tensors, which need to be converted into the MLX architecture’s required data format to work correctly. Implementing this would require in-depth research.

I deeply apologize if this has caused you any inconvenience. However, I am still actively researching real-time preview functionality. As long as the current ControlNet implementation does not affect usability, I don’t plan to make adjustments to it for the time being. Allow me to explain the priority of "real-time preview": it is the final component of mflux 0.4.X. Completing this feature is essential for fully porting mflux 0.4.X to ComfyUI. I am committed to this because we are already significantly behind the official mflux development. While I am still working on mflux 0.4.X, the official team is already advancing to mflux 0.5.0.

I can also share some good news about mflux 0.5.0—it may support more popular models and include Flux.1 Tools, which also feature ControlNet. Once I complete mflux 0.4.X and begin porting mflux 0.5.0, I will adjust my node design according to the new official features. This means there might still be a refactor of the ControlNet component, depending on what the official mflux 0.5.0 introduces.