Skip to content
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

New alwayson_scripts / controlnet units question #40

Open
notintricate opened this issue Mar 25, 2023 · 6 comments
Open

New alwayson_scripts / controlnet units question #40

notintricate opened this issue Mar 25, 2023 · 6 comments

Comments

@notintricate
Copy link

Can't get my head around this new implementation?
How should we use controlnet_units now?

@Gamfel
Copy link

Gamfel commented Mar 27, 2023

Hey there! As far as I understand it you have to create an instance of a controlnet_unit with all parameters you desire. In Addition when giving the instance to the im2img-function of the api-instance, you also have to enable use_deprecated_controlnet = True like this:

api_instance = webuiapi.WebUIApi(host="127.0.0.1", port=7861, sampler="Euler a", steps=30)

controlnet_image = "Your c-net image"
unit1 = webuiapi.ControlNetUnit(input_image=controlnet_image, module="canny", model="control_sd15_canny [fef5e48e]")

prompt = "Your Prompt"
image = "Your Image"

#When using Img2Img
result = api_instance.img2img(images=[image], prompt=prompt, controlnet_units=[unit1], use_deprecated_controlnet=True)

#When using Txt2Img
result = api_instance.txt2img(prompt=prompt, controlnet_units=[unit1], use_deprecated_controlnet=True)

When disabling "use_deprecated_controlnet" the controlnet-features will not activate. But thats just my take on the code at the moment.

@barshag
Copy link

barshag commented Apr 8, 2023

is it possible to do it only with txt2img + a controlled image?

Using only img2img is kinda limited...

@BrofessorNFT
Copy link

does not seem to work with alwayson scripts for me. what is sd_APIInterface?

There is API reference in SD to use control net, but no reference for these alwayson scripts

@Gamfel
Copy link

Gamfel commented Apr 12, 2023

does not seem to work with alwayson scripts for me. what is sd_APIInterface?

There is API reference in SD to use control net, but no reference for these alwayson scripts

Hey, sorry for the confusion, I updated the codeexample. sd_APIinterface was a placeholder for webuiapi.

@Gamfel
Copy link

Gamfel commented Apr 12, 2023

is it possible to do it only with txt2img + a controlled image?

Using only img2img is kinda limited...

Hey. Well i think it should be possible, looking at the code. Try to use api_instance.txt2img(...) instead api_instance.img2img(...) .

@LLLYF
Copy link

LLLYF commented May 12, 2023

Sry to bother you ! I want to add more controlnet units in my code which use SD api to finish img2img.How to do that? My code is use "alwayson_scripts" too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants