diff --git a/scripts/controlnet.py b/scripts/controlnet.py index 35ccfc071e6..0b99b8b7b35 100644 --- a/scripts/controlnet.py +++ b/scripts/controlnet.py @@ -731,6 +731,33 @@ def process(self, p, *args): # safe numpy input_image = np.ascontiguousarray(input_image.copy()).copy() + if unit.processor_res < 0: + try: + cfg = preprocessor_sliders_config[global_state.get_module_basename(unit.module)] + unit.processor_res = int(cfg[0]['value']) + logger.info(f'API used default config: unit.processor_res = {unit.processor_res}') + except: + unit.processor_res = 512 + logger.info(f'API used default value: unit.processor_res = {unit.processor_res}') + + if unit.threshold_a < 0: + try: + cfg = preprocessor_sliders_config[global_state.get_module_basename(unit.module)] + unit.threshold_a = float(cfg[1]['value']) + logger.info(f'API used default config: unit.threshold_a = {unit.threshold_a}') + except: + unit.threshold_a = 0 + logger.info(f'API used default value: unit.threshold_a = {unit.threshold_a}') + + if unit.threshold_b < 0: + try: + cfg = preprocessor_sliders_config[global_state.get_module_basename(unit.module)] + unit.threshold_b = float(cfg[2]['value']) + logger.info(f'API used default config: unit.threshold_b = {unit.threshold_b}') + except: + unit.threshold_b = 0 + logger.info(f'API used default value: unit.threshold_b = {unit.threshold_b}') + logger.info(f"Loading preprocessor: {unit.module}") preprocessor = self.preprocessor[unit.module] h, w, bsz = p.height, p.width, p.batch_size diff --git a/scripts/controlnet_version.py b/scripts/controlnet_version.py index 22cb7c954c3..3514b81caf8 100644 --- a/scripts/controlnet_version.py +++ b/scripts/controlnet_version.py @@ -1,4 +1,4 @@ -version_flag = 'v1.1.217' +version_flag = 'v1.1.218' from scripts.logging import logger diff --git a/scripts/external_code.py b/scripts/external_code.py index 5c84d0f9f82..93d23c4673a 100644 --- a/scripts/external_code.py +++ b/scripts/external_code.py @@ -155,9 +155,9 @@ def __init__( image: Optional[InputImage]=None, resize_mode: Union[ResizeMode, int, str] = ResizeMode.INNER_FIT, low_vram: bool=False, - processor_res: int=512, - threshold_a: float=64, - threshold_b: float=64, + processor_res: int=-1, + threshold_a: float=-1, + threshold_b: float=-1, guidance_start: float=0.0, guidance_end: float=1.0, pixel_perfect: bool=False,