-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: ControlNet fails miserably when settings are set by Config-Presets (model not loading properly) #1297
Comments
I should add that if you use the workflow above (with workaround to get good images) for a little while, eventually you start getting OOM errors, which indicates to me that there is something not being properly unloaded in certain scenarios as well. A UI refresh does not solve this, you typically need to reboot the server to recapture the memory. Just thought I would point that out since I speculated in the original issue that model unloading is likely an issue too. |
I'll also note that setting ControlNet values with a Preset does not always trigger the correct sliders to appear, depending on the Pixel Perfect setting. Any thoughts @lllyasviel or @Mikubill? Thank you! P.s. The pace and quality of development on this project is absolutely mindblowing. Thank you to all the contributors. |
After a little digging in the gradio api and looking through the controlnet + configpresets code, I believe that this has to do with the gradio event listeners not working smoothly with the way that ConfigPresets is executing its update cycle. ControlNet appears to use the appropriate listeners (e.g., .change()), which should respond to programmatic changes, but perhaps the order or timing of execution from ConfigPresets is not optimal. Unfortunately I'm not a gradio or python expert (getting back into python after many years) so I'm currently at a loss on where to start on looking for a solution, but in general it would seem that solving this problem paves the way for successful implementation of other programmatic change paradigms (like repopulating ControlNet parameters from gen params, for instance). If anyone has any ideas on where I could start looking for a potential solution please let me know. Thanks! |
I think perhaps we add wontfix tag to this. handling this seems causing deadlock in some logics |
Hi @lllyasviel -- no problem, I totally understand if it causes problems in other parts of the logic to fix. I can live with the workaround. Would you mind explaining a bit more about the solution you tested and the logic it breaks so that I tinker around with my own branch as a learning exercise? Thank you! |
Is there an existing issue for this?
What happened?
Took a few hours to track down what was happening here, but I have found the issue and the workaround. Essentially the issue is this -- if you use the Config-Presets extension (absolutely essential for complex workflow management) to manage your generation parameters and tasks, and if you add controlnet parameters to the tracking list, everything appears to work perfectly. Parameters are saved and loaded properly from the config.
HOWEVER -- when you try to generate images in img2img, the results are absolutely nonsense fuzziness and weirdness.
WORKAROUND: Click and unclick the Pixel Perfect option on your CN config. I suspect you have to do this for each controlnet that you have set up in your preset, but I have only tested with a single controlnet. I noticed when you change this option, it refreshes the model list and I think that this is what fixes the problem, which (speculation) may be that the model is not being loaded properly when the model selection is done programmatically.
Sample Image
Source:
![00036-3846871524-futuristic A game called Grand Theft Arto, fast car, hole in wall, art gallery Interior of a museum, art on the walls, no wi](https://private-user-images.githubusercontent.com/2940820/238494384-9b9ffffb-f8d9-4413-a211-05ad41b3b57a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3MDIzNDksIm5iZiI6MTcyMTcwMjA0OSwicGF0aCI6Ii8yOTQwODIwLzIzODQ5NDM4NC05YjlmZmZmYi1mOGQ5LTQ0MTMtYTIxMS0wNWFkNDFiM2I1N2EucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMDIzNDA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGY1ZDFjNTFmNzIwYzFiNzdhMjFmOTU5ODI3YzdhNWU4N2M5MzkxY2VlZTZkMjE0OWYwZDViYTg5OTRkYWM5ZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.wnPh0PjHyWfjjvONtI7rACJiM91Gpkiviu_w2YNzCUI)
Bad result:
![02934-3846871524-](https://private-user-images.githubusercontent.com/2940820/238494487-0ce89367-21d9-413f-88c8-f6d094f3564e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3MDIzNDksIm5iZiI6MTcyMTcwMjA0OSwicGF0aCI6Ii8yOTQwODIwLzIzODQ5NDQ4Ny0wY2U4OTM2Ny0yMWQ5LTQxM2YtODhjOC1mNmQwOTRmMzU2NGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMDIzNDA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWIzZTA3ZWMwNGY2YjU3MjYwMmJmZjA1YWQ0ODhmNWUyY2QxYzIwNGQ2ZjExZDFmNDYzNWIwM2E1ZmMzODExNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.G2PZPDB17MaD7m27YyOexQB8rhwepo4X7pzEGbib8Ss)
Result after workaround:
![02936-3846871524-](https://private-user-images.githubusercontent.com/2940820/238494511-360231d3-a708-4cb2-ba82-2647770a7cf0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3MDIzNDksIm5iZiI6MTcyMTcwMjA0OSwicGF0aCI6Ii8yOTQwODIwLzIzODQ5NDUxMS0zNjAyMzFkMy1hNzA4LTRjYjItYmE4Mi0yNjQ3NzcwYTdjZjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMDIzNDA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTEzNzg1MGIyODcyZDE0Yjc4NGEyZTEwZjExODVhZmQ0NmY5ZTU1NWMyNWU4NWIxODM5ZmMxNzg1MWY0OWUzMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.vlX0907sa_514sG2bRrjm7Njdboj_fuXfO0rG8qZUXQ)
Steps to reproduce the problem
What should have happened?
Model should load properly when Config-Presets is used, and then...
Beautiful CN goodness at the push of a button
... also good to ensure that previous models are unloaded when Config-Presets makes a change
Commit where the problem happens
controlnet: 1.1.173
python: 3.10.6 • torch: 1.13.1+cu117 • xformers: 0.0.16rc425 • gradio: 3.23.0 • commit: 22bcc7be
What browsers do you use to access the UI ?
No response
Command Line Arguments
set COMMANDLINE_ARGS=--opt-channelslast --use-cpu interrogate --theme dark --no-half-vae --xformers
Console logs
Additional information
ControlNet (extension)
img2img_controlnet_ControlNet-0_controlnet_enable_checkbox
img2img_controlnet_ControlNet-0_controlnet_low_vram_checkbox
img2img_controlnet_ControlNet-0_controlnet_pixel_perfect_checkbox
img2img_controlnet_ControlNet-0_controlnet_preprocessor_preview_checkbox
img2img_controlnet_ControlNet-0_controlnet_preprocessor_dropdown
img2img_controlnet_ControlNet-0_controlnet_model_dropdown
img2img_controlnet_ControlNet-0_controlnet_control_weight_slider
img2img_controlnet_ControlNet-0_controlnet_start_control_step_slider
img2img_controlnet_ControlNet-0_controlnet_ending_control_step_slider
img2img_controlnet_ControlNet-0_controlnet_control_mod_radio
img2img_controlnet_ControlNet-0_controlnet_resize_mode_radio
img2img_controlnet_ControlNet-1_controlnet_enable_checkbox
img2img_controlnet_ControlNet-1_controlnet_low_vram_checkbox
img2img_controlnet_ControlNet-1_controlnet_pixel_perfect_checkbox
img2img_controlnet_ControlNet-1_controlnet_preprocessor_preview_checkbox
img2img_controlnet_ControlNet-1_controlnet_preprocessor_dropdown
img2img_controlnet_ControlNet-1_controlnet_model_dropdown
img2img_controlnet_ControlNet-1_controlnet_control_weight_slider
img2img_controlnet_ControlNet-1_controlnet_start_control_step_slider
img2img_controlnet_ControlNet-1_controlnet_ending_control_step_slider
img2img_controlnet_ControlNet-1_controlnet_control_mod_radio
img2img_controlnet_ControlNet-1_controlnet_resize_mode_radio
img2img_controlnet_ControlNet-2_controlnet_enable_checkbox
img2img_controlnet_ControlNet-2_controlnet_low_vram_checkbox
img2img_controlnet_ControlNet-2_controlnet_pixel_perfect_checkbox
img2img_controlnet_ControlNet-2_controlnet_preprocessor_preview_checkbox
img2img_controlnet_ControlNet-2_controlnet_preprocessor_dropdown
img2img_controlnet_ControlNet-2_controlnet_model_dropdown
img2img_controlnet_ControlNet-2_controlnet_control_weight_slider
img2img_controlnet_ControlNet-2_controlnet_start_control_step_slider
img2img_controlnet_ControlNet-2_controlnet_ending_control_step_slider
img2img_controlnet_ControlNet-2_controlnet_control_mod_radio
img2img_controlnet_ControlNet-2_controlnet_resize_mode_radio
The text was updated successfully, but these errors were encountered: