I am using Controlnet 7a4805c8 version:v1.1.410 and automatic1111 v1.6.0
Here is how i am trying to use multi-units and the error i get.
class ControlNetUnit:
'''
This class was taken from the controlnet automatic1111 plugin since the unit that
ships with webuiapi is not up to date and gives weird results for some models
'''
def __init__(
self,
input_image: Image = None,
mask: Image = None,
module: str = "none",
model: str = "None",
weight: float = 1.0,
resize_mode: Union[ResizeMode, int, str] = ResizeMode.INNER_FIT,
lowvram: bool = False,
processor_res: int = -1,
threshold_a: float = -1,
threshold_b: float = -1,
guidance: float = 1.0,
guidance_start: float = 0.0,
guidance_end: float = 1.0,
control_mode: Union[ControlMode, int, str] = ControlMode.BALANCED,
pixel_perfect: bool = False
):
self.input_image = input_image
self.mask = mask
self.module = module
self.model = model
self.weight = weight
self.resize_mode = resize_mode
self.lowvram = lowvram
self.processor_res = processor_res
self.threshold_a = threshold_a
self.threshold_b = threshold_b
self.guidance = guidance
self.guidance_start = guidance_start
self.guidance_end = guidance_end
self.control_mode = control_mode
self.pixel_perfect = pixel_perfect
image_path = 'image.png'
image = cv2.imread(image_path)
_, bytelist = cv2.imencode('.png', image)
reference_image = base64.b64encode(bytelist).decode('utf-8')
unit1 = ControlNetUnit(input_image=reference_image, module='none', model='custom_model.ckpt [55e7a0f2]')
r = cn.txt2img(prompt="photo of a country road",
height=512,
seed=100,
controlnet_units=[unit1])
r.image
<ipython-input-12-9a5c2828b23f> in <listcomp>(.0)
136 "prompt": prompt,
137 "negative_prompt": negative_prompt,
--> 138 "controlnet_units": [x.to_dict() for x in controlnet_units],
139 "enable_hr": enable_hr,
140 "denoising_strength": denoising_strength,
<ipython-input-12-9a5c2828b23f> in to_dict(self)
89 def to_dict(self):
90 return {
---> 91 "input_image": raw_b64_img(self.input_image) if self.input_image else "",
92 "mask": raw_b64_img(self.mask) if self.mask is not None else None,
93 "module": self.module,
<ipython-input-12-9a5c2828b23f> in raw_b64_img(image)
37 with io.BytesIO() as output_bytes:
38 metadata = None
---> 39 for key, value in image.info.items():
40 if isinstance(key, str) and isinstance(value, str):
41 if metadata is None:
AttributeError: 'str' object has no attribute 'info'
Hi
Thanks for your effort on this project.
I am using Controlnet
7a4805c8
version:v1.1.410
and automatic1111v1.6.0
Here is how i am trying to use multi-units and the error i get.
any insights? thanks in advance